Changeset 13589
- Timestamp:
- 10/10/12 20:48:24 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 added
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r13557 r13589 68 68 ./classes/objects/Vertex.cpp\ 69 69 ./classes/objects/AdolcEdf.h\ 70 ./classes/IssmComm.h\ 71 ./classes/IssmComm.cpp\ 70 72 ./classes/Hook.h\ 71 73 ./classes/Hook.cpp\ … … 343 345 ./modules/InputConvergencex/InputConvergencex.cpp\ 344 346 ./modules/InputConvergencex/InputConvergencex.h\ 345 ./solutions/PrintBanner.cpp\346 347 ./solutions/convergence.cpp\ 347 348 ./solutions/ProcessArguments.cpp\ -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r13574 r13589 21 21 /*Object constructors and destructor*/ 22 22 /*FUNCTION FemModel::FemModel(int argc,char** argv){{{*/ 23 FemModel::FemModel(int argc,char** argv ){23 FemModel::FemModel(int argc,char** argv,COMM incomm){ 24 24 25 25 /*configuration: */ … … 34 34 char *petscfilename = NULL; 35 35 char *rootpath = NULL; 36 37 /*First things first, store the communicator, and set it as a global variable: */ 38 this->comm=incomm; 39 this->SetStaticComm(); 40 41 /*Print starting banner:*/ 42 this->PrintBanner(); 36 43 37 44 /*Start profiler: */ … … 264 271 } 265 272 /*}}}*/ 273 /*FUNCTION FemModel::SetStaticComm {{{*/ 274 void FemModel::SetStaticComm(void){ 275 276 /*This routine sets the global communicator variable hidden inside the IssmComm 277 *class: */ 278 IssmComm::SetComm(this->comm); 279 280 } 281 /*}}}*/ 282 /*FUNCTION FemModel::PrintBanner {{{*/ 283 void FemModel::PrintBanner(void){ 284 285 _pprintLine_(""); 286 _pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION); 287 _pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")"); 288 _pprintLine_(""); 289 290 } 291 /*}}}*/ 266 292 267 293 /*Numerics: */ -
issm/trunk-jpl/src/c/classes/FemModel.h
r13554 r13589 44 44 Parameters *parameters; //one set of parameters, independent of the analysis_type 45 45 Results *results; //results that cannot be fit into the elements 46 COMM comm; //communicator for this particular model 46 47 47 48 /*constructors, destructors: */ 48 FemModel(int argc,char** argv );49 FemModel(int argc,char** argv,COMM comm_init); 49 50 FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels); 50 51 ~FemModel(); … … 55 56 void Solve(void); 56 57 void OutputResults(void); 58 void SetStaticComm(); 59 void PrintBanner(void); 57 60 58 61 /*Fem: */ -
issm/trunk-jpl/src/c/classes/IoModel.cpp
r13576 r13589 1340 1340 } 1341 1341 } 1342 #ifdef _HAVE_MPI_1342 #ifdef _HAVE_MPI_ 1343 1343 MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD); 1344 1344 if(!found)_error_("could not find data with name " << EnumToStringx(data_enum) << " in binary file"); 1345 #endif1345 #endif 1346 1346 1347 1347 /*Broadcast code and vector type: */ 1348 #ifdef _HAVE_MPI_1348 #ifdef _HAVE_MPI_ 1349 1349 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD); 1350 1350 MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD); 1351 1351 if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD); 1352 #endif1352 #endif 1353 1353 1354 1354 /*Assign output pointers:*/ -
issm/trunk-jpl/src/c/classes/classes.h
r13530 r13589 31 31 #include "./OptPars.h" 32 32 #include "./AdolcEdf.h" 33 #include "./IssmComm.h" 33 34 34 35 #endif -
issm/trunk-jpl/src/c/include/globals.h
r11942 r13589 6 6 #define GLOBALS_H_ 7 7 8 9 #include "./types.h" 10 #include "../classes/IssmComm.h" 11 COMM IssmComm::comm; 12 8 13 int my_rank=0; 9 14 int num_procs=1; -
issm/trunk-jpl/src/c/include/types.h
r13414 r13589 40 40 #endif 41 41 42 /*Define communicator: */ 43 #ifdef _HAVE_MPI_ 44 #include "mpi.h" 45 typedef MPI_Comm COMM; 46 #else 47 typedef int COMM; 48 #endif 49 42 50 #endif //ifndef _TYPES_H_ -
issm/trunk-jpl/src/c/solutions/EnvironmentInit.cpp
r13534 r13589 10 10 #include "../toolkits/toolkits.h" 11 11 12 void EnvironmentInit(int argc,char** argv){ 13 14 extern int my_rank; 15 extern int num_procs; 12 COMM EnvironmentInit(int argc,char** argv){ 16 13 17 14 /*Initialize environments: Petsc, MPI, etc...: */ … … 19 16 int ierr=PetscInitialize(&argc,&argv,(char*)0,""); 20 17 if(ierr) _error_("Could not initialize Petsc"); 18 return MPI_COMM_WORLD; 21 19 #else 22 20 #ifdef _HAVE_MPI_ 23 21 MPI_Init(&argc,&argv); 22 return MPI_COMM_WORLD; 23 #else 24 return 1; //return bogus number for comm, which does not exist anyway. 24 25 #endif 25 26 #endif 26 27 27 /*Size and rank: */ 28 #ifdef _HAVE_MPI_ 29 MPI_Comm_rank(MPI_COMM_WORLD,&my_rank); 30 MPI_Comm_size(MPI_COMM_WORLD,&num_procs); 31 #endif 28 32 29 } -
issm/trunk-jpl/src/c/solutions/issm.cpp
r13554 r13589 7 7 int main(int argc,char **argv){ 8 8 9 /*Print starting banner:*/ 10 PrintBanner(); 9 COMM comm_init; 11 10 12 11 /*Initialize exception trapping: */ … … 14 13 15 14 /*Initialize environment (MPI, PETSC, MUMPS, etc ...)*/ 16 EnvironmentInit(argc,argv); 17 15 comm_init=EnvironmentInit(argc,argv); 16 17 /*Hack for now: */ 18 MPI_Comm_rank(comm_init,&my_rank); 19 MPI_Comm_size(comm_init,&num_procs); 20 18 21 /*Initialize femmodel from arguments provided command line: */ 19 FemModel *femmodel = new FemModel(argc,argv );22 FemModel *femmodel = new FemModel(argc,argv,comm_init); 20 23 21 24 /*Solve: */ -
issm/trunk-jpl/src/c/solutions/solutions.h
r13554 r13589 8 8 #include "../classes/objects/objects.h" 9 9 #include "../io/io.h" 10 #include "../toolkits/toolkits.h" 10 11 11 12 struct OptArgs; … … 47 48 void controlrestart(FemModel* femmodel,IssmDouble* J); 48 49 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type); 49 voidEnvironmentInit(int argc,char** argv);50 COMM EnvironmentInit(int argc,char** argv); 50 51 void EnvironmentFinalize(void); 51 52 int DakotaSpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter);
Note:
See TracChangeset
for help on using the changeset viewer.