PSCF v1.2
Monomer.h
1#ifndef PSCF_MONOMER_H
2#define PSCF_MONOMER_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <string>
12#include <iostream>
13
14namespace Pscf
15{
16
38 class Monomer
39 {
40 public:
41
45 Monomer();
46
52 void setId(int id);
53
59 void setKuhn(double kuhn);
60
64 int id() const;
65
69 double kuhn() const;
70
77 template <class Archive>
78 void serialize(Archive ar, const unsigned int version);
79
80 private:
81
82 // Integer identifier
83 int id_;
84
85 // Statistical segment length / kuhn length
86 double kuhn_;
87
88 //friends
89
90 friend
91 std::istream& operator >> (std::istream& in, Monomer& monomer);
92
93 friend
94 std::ostream& operator << (std::ostream& out, const Monomer& monomer);
95
96 };
97
109 std::istream& operator >> (std::istream& in, Monomer& monomer);
110
118 std::ostream& operator << (std::ostream& out, const Monomer& monomer);
119
120 // inline member functions
121
122 /*
123 * Get monomer type index.
124 */
125 inline int Monomer::id() const
126 { return id_; }
127
128 /*
129 * Statistical segment length.
130 */
131 inline double Monomer::kuhn() const
132 { return kuhn_; }
133
134 /*
135 * Set statistical segment length.
136 *
137 * \param kuhn new value for statistical segement length
138 */
139 inline void Monomer::setKuhn(double kuhn)
140 { kuhn_ = kuhn; }
141
142 /*
143 * Serialize to or from an archive.
144 */
145 template <class Archive>
146 void Monomer::serialize(Archive ar, const unsigned int version)
147 {
148 ar & id_;
149 ar & kuhn_;
150 }
151
152}
153#endif
Descriptor for a monomer type.
Definition Monomer.h:39
void setKuhn(double kuhn)
Set statistical segment length.
Definition Monomer.h:139
void serialize(Archive ar, const unsigned int version)
Serialize to or from an archive.
Definition Monomer.h:146
void setId(int id)
Set the integer index for this monomer type.
Definition Monomer.cpp:18
Monomer()
Constructor.
Definition Monomer.cpp:13
double kuhn() const
Statistical segment length (random walk step size).
Definition Monomer.h:131
friend std::istream & operator>>(std::istream &in, Monomer &monomer)
Stream extractor (>>) for a Monomer.
Definition Monomer.cpp:24
int id() const
Unique integer index for monomer type.
Definition Monomer.h:125
friend std::ostream & operator<<(std::ostream &out, const Monomer &monomer)
Stream inserter (<<) for a Monomer.
Definition Monomer.cpp:34
PSCF package top-level namespace.
Definition param_pc.dox:1
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
Definition Pair.h:44
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition Pair.h:57