ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/hydrodynamics/Hydro.cpp
(Generate patch)

Comparing trunk/src/applications/hydrodynamics/Hydro.cpp (file contents):
Revision 906 by tim, Fri Mar 17 23:20:35 2006 UTC vs.
Revision 945 by gezelter, Tue Apr 25 02:09:01 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines