1 |
– |
#ifdef IS_MPI |
1 |
|
#include <iostream> |
2 |
|
#include <fstream> |
3 |
|
#include <cstdlib> |
4 |
|
#include <cmath> |
5 |
|
#include <cstring> |
6 |
+ |
|
7 |
+ |
#ifdef IS_MPI |
8 |
|
#include <mpi.h> |
9 |
+ |
#endif |
10 |
|
|
11 |
|
#ifdef PROFILE |
12 |
|
#include "mdProfile.hpp" |
32 |
|
|
33 |
|
// first things first, all of the initializations |
34 |
|
|
35 |
+ |
#ifdef IS_MPI |
36 |
|
MPI_Init( &argc, &argv ); // the MPI communicators |
37 |
+ |
#endif |
38 |
|
|
39 |
|
initSimError(); // the error handler |
40 |
|
srand48( 1337 ); // the random number generator. |
47 |
|
|
48 |
|
program_name = argv[0]; // save the program name in case we need it |
49 |
|
|
50 |
+ |
#ifdef IS_MPI |
51 |
|
if( worldRank == 0 ){ |
52 |
+ |
#endif |
53 |
|
std::cerr << |
54 |
|
" +----------------------------------------------------------------------+\n" << |
55 |
|
" | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" << |
70 |
|
"\n"; |
71 |
|
|
72 |
|
if( argc < 2 ){ |
73 |
< |
strcpy( painCave.errMsg, "Error, bass file is needed to run.\n" ); |
73 |
> |
strcpy( painCave.errMsg, "Error, a meta-data file is needed to run.\n" ); |
74 |
|
painCave.isFatal = 1; |
75 |
|
simError(); |
76 |
|
} |
77 |
+ |
#ifdef IS_MPI |
78 |
|
} |
79 |
+ |
#endif |
80 |
|
|
81 |
|
in_name = argv[1]; |
82 |
|
|
83 |
+ |
#ifdef IS_MPI |
84 |
|
strcpy( checkPointMsg, "Successful number of arguments" ); |
85 |
|
MPIcheckPoint(); |
86 |
+ |
#endif |
87 |
|
|
88 |
|
// create the simulation objects, and get the show on the road |
89 |
< |
|
90 |
< |
entry_plug = new SimInfo; |
91 |
< |
startMe = new SimSetup; |
92 |
< |
|
89 |
> |
|
90 |
> |
entry_plug = new SimInfo(); |
91 |
> |
startMe = new SimSetup(); |
92 |
> |
|
93 |
|
startMe->setSimInfo( entry_plug ); |
94 |
|
|
95 |
+ |
#ifdef PROFILE |
96 |
+ |
startProfile( pro1 ); |
97 |
+ |
#endif //profile |
98 |
|
|
99 |
|
startMe->parseFile( in_name ); |
100 |
|
|
101 |
+ |
#ifdef PROFILE |
102 |
+ |
endProfile( pro1 ); |
103 |
+ |
|
104 |
+ |
startProfile( pro2 ); |
105 |
+ |
#endif //profile |
106 |
|
|
107 |
|
startMe->createSim(); |
90 |
– |
|
108 |
|
delete startMe; |
109 |
|
|
110 |
+ |
#ifdef PROFILE |
111 |
+ |
endProfile( pro2 ); |
112 |
+ |
|
113 |
+ |
startProfile( pro3 ); |
114 |
+ |
#endif //profile |
115 |
+ |
|
116 |
|
if (!entry_plug->has_minimizer) |
117 |
|
entry_plug->the_integrator->integrate(); |
118 |
|
else |
119 |
|
entry_plug->the_minimizer->minimize(); |
97 |
– |
|
120 |
|
#ifdef PROFILE |
121 |
+ |
endProfile( pro3 ); |
122 |
+ |
|
123 |
|
writeProfiles(); |
124 |
|
#endif //profile |
125 |
|
|
126 |
+ |
#ifdef IS_MPI |
127 |
|
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
128 |
|
MPIcheckPoint(); |
129 |
|
|
130 |
|
MPI_Finalize(); |
131 |
+ |
#endif |
132 |
+ |
|
133 |
|
return 0 ; |
134 |
|
} |
108 |
– |
|
109 |
– |
#endif |