45 |
|
#include <string> |
46 |
|
|
47 |
|
#include "io/Globals.hpp" |
48 |
+ |
#include "io/ParamConstraint.hpp" |
49 |
+ |
#include "utils/MemoryUtils.hpp" |
50 |
|
#include "utils/simError.h" |
51 |
|
|
50 |
– |
#include "io/ParamConstraint.hpp" |
51 |
– |
|
52 |
|
namespace oopse { |
53 |
|
Globals::Globals() { |
54 |
|
DefineParameter(ForceField, "forceField") |
121 |
|
} |
122 |
|
|
123 |
|
Globals::~Globals() { |
124 |
< |
|
125 |
< |
|
124 |
> |
MemoryUtils::deletePointers(components_); |
125 |
> |
MemoryUtils::deletePointers(zconstraints_); |
126 |
|
} |
127 |
|
|
128 |
|
void Globals::validate() { |
181 |
|
|
182 |
|
for(std::vector<Component*>::iterator i = components_.begin(); i != components_.end(); ++i) { |
183 |
|
if (!(*i)->findMoleculeStamp(moleculeStamps_)) { |
184 |
< |
std::cout << "Globals Error: can not find molecule stamp for component" << std::endl; |
184 |
> |
std::ostringstream oss; |
185 |
> |
oss << "Globals Error: can not find molecule stamp for component " << (*i)->getType() << std::endl; |
186 |
> |
throw OOPSEException(oss.str()); |
187 |
|
} |
188 |
|
} |
189 |
|
} |
207 |
|
moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(molStampName, molStamp)); |
208 |
|
ret = true; |
209 |
|
} else { |
210 |
< |
|
210 |
> |
std::ostringstream oss; |
211 |
> |
oss << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; |
212 |
> |
throw OOPSEException(oss.str()); |
213 |
|
} |
214 |
|
return ret; |
215 |
|
} |