PSCF v1.1
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
31 class Monomer
32 {
33 public:
34
38 Monomer();
39
45 void setId(int id);
46
50 int id() const;
51
55 double kuhn() const;
56
60 void setKuhn(double kuhn);
61
68 template <class Archive>
69 void serialize(Archive ar, const unsigned int version);
70
71 private:
72
73 // Integer identifier
74 int id_;
75
76 // Statistical segment length / kuhn length
77 double kuhn_;
78
79 //friends
80
81 friend
82 std::istream& operator >> (std::istream& in, Monomer& monomer);
83
84 friend
85 std::ostream& operator << (std::ostream& out, const Monomer& monomer);
86
87 };
88
96 std::istream& operator >> (std::istream& in, Monomer& monomer);
97
105 std::ostream& operator << (std::ostream& out, const Monomer& monomer);
106
107 // inline member functions
108
109 /*
110 * Get monomer type index.
111 */
112 inline int Monomer::id() const
113 { return id_; }
114
115 /*
116 * Statistical segment length.
117 */
118 inline double Monomer::kuhn() const
119 { return kuhn_; }
120
121 /*
122 * Set statistical segment length.
123 *
124 * \param kuhn new value for statistical segement length
125 */
126 inline void Monomer::setKuhn(double kuhn)
127 { kuhn_ = kuhn; }
128
129 /*
130 * Serialize to or from an archive.
131 */
132 template <class Archive>
133 void Monomer::serialize(Archive ar, const unsigned int version)
134 {
135 ar & id_;
136 ar & kuhn_;
137 }
138
139}
140#endif
Descriptor for a monomer or particle type.
Definition: Monomer.h:32
void setKuhn(double kuhn)
Set statistical segment length.
Definition: Monomer.h:126
void serialize(Archive ar, const unsigned int version)
Serialize to or from an archive.
Definition: Monomer.h:133
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:118
friend std::istream & operator>>(std::istream &in, Monomer &monomer)
istream extractor for a Monomer.
Definition: Monomer.cpp:24
int id() const
Unique integer index for monomer type.
Definition: Monomer.h:112
friend std::ostream & operator<<(std::ostream &out, const Monomer &monomer)
ostream inserter for a Monomer.
Definition: Monomer.cpp:34
C++ namespace for polymer self-consistent field theory (PSCF).
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