1 |
/* |
2 |
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
* |
4 |
* Contact: oopse@oopse.org |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Lesser General Public License |
8 |
* as published by the Free Software Foundation; either version 2.1 |
9 |
* of the License, or (at your option) any later version. |
10 |
* All we ask is that proper credit is given for our work, which includes |
11 |
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
* of your source code files, and to any copyright notice that you may distribute |
13 |
* with programs based on this work. |
14 |
* |
15 |
* This program is distributed in the hope that it will be useful, |
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
* GNU Lesser General Public License for more details. |
19 |
* |
20 |
* You should have received a copy of the GNU Lesser General Public License |
21 |
* along with this program; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
* |
24 |
*/ |
25 |
|
26 |
#include "brains/Snapshot.hpp" |
27 |
#include "integrators/Integrator.hpp" |
28 |
#include "utils/simError.h" |
29 |
namespace oopse { |
30 |
Integrator::Integrator(SimInfo* info) |
31 |
: info_(info), forceMan_(NULL) , needPotential(false), needStress(false), velocitizer_(NULL), |
32 |
needVelocityScaling(false), dumpWriter(NULL), statWriter(NULL), thermo(info), |
33 |
currentSnapshot_(info->getSnapshotManager()->getCurrentSnapshot()) { |
34 |
|
35 |
Globals* simParams = info->getSimParams(); |
36 |
|
37 |
if (simParams->haveDt()) { |
38 |
dt = simParams->getDt(); |
39 |
} |
40 |
|
41 |
if (simParams->haveRunTime()) { |
42 |
runTime = simParams->getRunTime(); |
43 |
} |
44 |
|
45 |
// set the status, sample, and thermal kick times |
46 |
if (simParams->haveSampleTime()){ |
47 |
sampleTime = simParams->getSampleTime(); |
48 |
statusTime = sampleTime; |
49 |
} |
50 |
else{ |
51 |
sampleTime = simParams->getRunTime(); |
52 |
statusTime = sampleTime; |
53 |
} |
54 |
|
55 |
if (simParams->haveStatusTime()){ |
56 |
statusTime = simParams->getStatusTime(); |
57 |
} |
58 |
|
59 |
if (simParams->haveThermalTime()){ |
60 |
thermalTime = simParams->getThermalTime(); |
61 |
} else { |
62 |
thermalTime = simParams->getRunTime(); |
63 |
} |
64 |
|
65 |
if (!simParams->getUseInitTime()) { |
66 |
currentSnapshot_->setTime(0.0); |
67 |
} |
68 |
|
69 |
//create a default a ForceManager |
70 |
//if the subclass want to using different ForceManager, use setForceManager |
71 |
forceMan_ = new ForceManager(info); |
72 |
|
73 |
// check for the temperature set flag (velocity scaling) |
74 |
if (simParams->haveTempSet()) { |
75 |
needVelocityScaling = simParams->getTempSet(); |
76 |
|
77 |
if (simParams->haveTargetTemp()) { |
78 |
targetScalingTemp = simParams->getTargetTemp(); |
79 |
} |
80 |
else { |
81 |
sprintf(painCave.errMsg, |
82 |
"Integrator Error: Target Temperature is not set\n"); |
83 |
painCave.isFatal = 1; |
84 |
simError(); |
85 |
|
86 |
} |
87 |
} |
88 |
|
89 |
//create a default a velocitizer |
90 |
//if the subclass want to using different velocitizer, use setVelocitizer |
91 |
velocitizer_ = new Velocitizer(info); |
92 |
|
93 |
} |
94 |
|
95 |
Integrator::~Integrator(){ |
96 |
delete forceMan_; |
97 |
delete velocitizer_; |
98 |
|
99 |
delete dumpWriter; |
100 |
delete statWriter; |
101 |
} |
102 |
|
103 |
|
104 |
} |
105 |
|