| 64 |
|
Shape* shape; |
| 65 |
|
}; |
| 66 |
|
void registerHydrodynamicsModels(); |
| 67 |
< |
void calcHydrodynamicsProp(HydrodynamicsModel* model, Shape* shape,double viscosity, double temperature, std::ostream& os, const std::string& prefix); |
| 67 |
> |
void writeHydroProps(std::ostream& os); |
| 68 |
|
|
| 69 |
|
int main(int argc, char* argv[]){ |
| 70 |
|
//register force fields |
| 71 |
|
registerForceFields(); |
| 72 |
< |
|
| 72 |
> |
registerHydrodynamicsModels(); |
| 73 |
|
|
| 74 |
|
gengetopt_args_info args_info; |
| 75 |
|
std::string dumpFileName; |
| 113 |
|
identMat(2,2) = 1.0; |
| 114 |
|
|
| 115 |
|
Globals* simParams = info->getSimParams(); |
| 116 |
< |
double temperature; |
| 117 |
< |
double viscosity; |
| 116 |
> |
RealType temperature; |
| 117 |
> |
RealType viscosity; |
| 118 |
|
|
| 119 |
|
if (simParams->haveViscosity()) { |
| 120 |
|
viscosity = simParams->getViscosity(); |
| 121 |
|
} else { |
| 122 |
< |
sprintf(painCave.errMsg, "target temperature must be set\n"); |
| 122 |
> |
sprintf(painCave.errMsg, "viscosity must be set\n"); |
| 123 |
|
painCave.isFatal = 1; |
| 124 |
|
simError(); |
| 125 |
|
} |
| 127 |
|
if (simParams->haveTargetTemp()) { |
| 128 |
|
temperature = simParams->getTargetTemp(); |
| 129 |
|
} else { |
| 130 |
< |
sprintf(painCave.errMsg, "viscosity must be set\n"); |
| 130 |
> |
sprintf(painCave.errMsg, "target temperature must be set\n"); |
| 131 |
|
painCave.isFatal = 1; |
| 132 |
|
simError(); |
| 133 |
|
} |
| 139 |
|
integrableObject = mol->nextIntegrableObject(ii)) { |
| 140 |
|
if (uniqueStuntDoubles.find(integrableObject->getType()) == uniqueStuntDoubles.end()) { |
| 141 |
|
|
| 142 |
– |
SDShape tmp; |
| 143 |
– |
tmp.shape = ShapeBuilder::createShape(integrableObject); |
| 144 |
– |
tmp.sd = integrableObject; |
| 145 |
– |
uniqueStuntDoubles.insert(std::map<std::string, SDShape>::value_type(integrableObject->getType(), tmp)); |
| 142 |
|
integrableObject->setPos(V3Zero); |
| 143 |
|
integrableObject->setA(identMat); |
| 144 |
|
if (integrableObject->isRigidBody()) { |
| 145 |
|
RigidBody* rb = static_cast<RigidBody*>(integrableObject); |
| 146 |
|
rb->updateAtoms(); |
| 147 |
|
} |
| 148 |
+ |
|
| 149 |
+ |
SDShape tmp; |
| 150 |
+ |
tmp.shape = ShapeBuilder::createShape(integrableObject); |
| 151 |
+ |
tmp.sd = integrableObject; |
| 152 |
+ |
uniqueStuntDoubles.insert(std::map<std::string, SDShape>::value_type(integrableObject->getType(), tmp)); |
| 153 |
+ |
|
| 154 |
|
} |
| 155 |
|
} |
| 156 |
|
} |
| 159 |
|
|
| 160 |
|
std::ofstream outputDiff(outputFilename.c_str()); |
| 161 |
|
std::map<std::string, SDShape>::iterator si; |
| 162 |
< |
for (si != uniqueStuntDoubles.begin(); si != uniqueStuntDoubles.end(); ++si) { |
| 162 |
> |
for (si = uniqueStuntDoubles.begin(); si != uniqueStuntDoubles.end(); ++si) { |
| 163 |
|
HydrodynamicsModel* model; |
| 164 |
|
Shape* shape = si->second.shape; |
| 165 |
|
StuntDouble* sd = si->second.sd;; |
| 170 |
|
} else { |
| 171 |
|
model = new BeadModel(sd, info); |
| 172 |
|
} |
| 173 |
< |
calcHydrodynamicsProp(model, shape, viscosity, temperature, outputDiff, prefix); |
| 173 |
> |
|
| 174 |
> |
model->init(); |
| 175 |
> |
|
| 176 |
> |
std::ofstream ofs; |
| 177 |
> |
std::stringstream outputBeads; |
| 178 |
> |
outputBeads << prefix << "_" << model->getStuntDoubleName() << ".xyz"; |
| 179 |
> |
ofs.open(outputBeads.str().c_str()); |
| 180 |
> |
model->writeBeads(ofs); |
| 181 |
> |
ofs.close(); |
| 182 |
> |
|
| 183 |
> |
//if beads option is turned on, skip the calculation |
| 184 |
> |
if (!args_info.beads_flag) { |
| 185 |
> |
model->calcHydroProps(shape, viscosity, temperature); |
| 186 |
> |
model->writeHydroProps(outputDiff); |
| 187 |
> |
} |
| 188 |
> |
|
| 189 |
|
delete model; |
| 190 |
|
} |
| 191 |
|
|
| 201 |
|
HydrodynamicsModelFactory::getInstance()->registerHydrodynamicsModel(new HydrodynamicsModelBuilder<AnalyticalModel>("AnalyticalModel")); |
| 202 |
|
|
| 203 |
|
} |
| 187 |
– |
void calcHydrodynamicsProp(HydrodynamicsModel* model, Shape* shape,double viscosity, double temperature, std::ostream& os, const std::string& prefix) { |
| 188 |
– |
|
| 189 |
– |
shape->calcHydroProps(model, viscosity, temperature); |
| 190 |
– |
model->writeHydroProps(os); |
| 191 |
– |
std::ofstream ofs; |
| 192 |
– |
std::stringstream outputBeads; |
| 193 |
– |
outputBeads << prefix << "_" << model->getStuntDoubleName() << ".xyz"; |
| 194 |
– |
ofs.open(outputBeads.str().c_str()); |
| 195 |
– |
model->writeBeads(ofs); |
| 196 |
– |
ofs.close(); |
| 197 |
– |
} |