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 "integrators/Integrator.hpp" |
27 |
#include "utils/simError.h" |
28 |
namespace oopse { |
29 |
Integrator::Integrator(SimInfo* info) |
30 |
: info_(info), forceMan_(NULL) , needPotential(false), needStress(false), |
31 |
velocitizer_(NULL), dumpWriter(NULL), statWriter(NULL), thermo(info), |
32 |
currentSnapshot_(info->getSnapshotManager()->getCurrentSnapshot()) { |
33 |
|
34 |
Globals* simParams = info->getSimParams(); |
35 |
|
36 |
if (simParams->haveDt()) { |
37 |
dt = simParams->getDt(); |
38 |
} |
39 |
|
40 |
if (simParams->haveRunTime()) { |
41 |
runTime = simParams->getRunTime(); |
42 |
} |
43 |
|
44 |
// set the status, sample, and thermal kick times |
45 |
if (simParams->haveSampleTime()){ |
46 |
sampleTime = simParams->getSampleTime(); |
47 |
statusTime = sampleTime; |
48 |
} |
49 |
else{ |
50 |
sampleTime = simParams->getRunTime(); |
51 |
statusTime = sampleTime; |
52 |
} |
53 |
|
54 |
if (simParams->haveStatusTime()){ |
55 |
statusTime = simParams->getStatusTime(); |
56 |
} |
57 |
|
58 |
if (simParams->haveThermalTime()){ |
59 |
thermalTime = simParams->getThermalTime(); |
60 |
} else { |
61 |
thermalTime = simParams->getRunTime(); |
62 |
} |
63 |
|
64 |
|
65 |
//create a default a ForceManager |
66 |
//if the subclass want to using different ForceManager, use setForceManager |
67 |
forceMan_ = new ForceManager(info); |
68 |
|
69 |
// check for the temperature set flag (velocity scaling) |
70 |
if (simParams->haveTempSet()) { |
71 |
needVelocityScaling = simParams->getTempSet(); |
72 |
|
73 |
if (simParams->haveTargetTemp()) { |
74 |
targetScalingTemp = simParams->getTargetTemp(); |
75 |
} |
76 |
else { |
77 |
sprintf(painCave.errMsg, |
78 |
"Integrator Error: Target Temperature is not set\n"); |
79 |
painCave.isFatal = 1; |
80 |
simError(); |
81 |
|
82 |
} |
83 |
} |
84 |
|
85 |
//create a default a velocitizer |
86 |
//if the subclass want to using different velocitizer, use setVelocitizer |
87 |
velocitizer_ = new Velocitizer(info); |
88 |
|
89 |
} |
90 |
|
91 |
Integrator::~Integrator(){ |
92 |
delete forceMan_; |
93 |
delete velocitizer_; |
94 |
|
95 |
delete dumpWriter; |
96 |
delete statWriter; |
97 |
} |
98 |
|
99 |
|
100 |
} |
101 |
|