Changeset 13553
- Timestamp:
- 10/05/12 10:24:48 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp ¶
r13549 r13553 12 12 #include "../Container/Container.h" 13 13 #include "../modules/ModelProcessorx/ModelProcessorx.h" 14 #include "../solutions/solutions.h" 14 15 #include "../io/io.h" 15 16 #include "./classes.h" … … 19 20 20 21 /*Object constructors and destructor*/ 21 /*FUNCTION FemModel::constructor {{{*/ 22 /*FUNCTION FemModel::FemModel(int argc,char** argv){{{*/ 23 FemModel::FemModel(int argc,char** argv){ 24 25 /*configuration: */ 26 int* analyses=NULL; 27 int numanalyses; 28 int solution_type; 29 30 /*File names*/ 31 char *lockfilename = NULL; 32 char *binfilename = NULL; 33 char *outbinfilename = NULL; 34 char *petscfilename = NULL; 35 char *rootpath = NULL; 36 37 /*Start profiler: */ 38 this->profiler=new Profiler(); 39 profiler->Tag(Start); 40 41 /*From command line arguments, retrieve different filenames needed to create the FemModel: */ 42 ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,&rootpath,argc,argv); 43 44 /*out of solution_type, figure out types of analyses needed in the femmodel: */ 45 AnalysisConfiguration(&analyses,&numanalyses,solution_type); 46 47 /*Create femmodel from input files: */ 48 profiler->Tag(StartInit); 49 this->InitFromFiles(rootpath,binfilename,outbinfilename,petscfilename,lockfilename,solution_type,analyses,numanalyses); 50 profiler->Tag(FinishInit); 51 52 /*Free resources */ 53 xDelete<int>(analyses); 54 xDelete<char>(lockfilename); 55 xDelete<char>(binfilename); 56 xDelete<char>(outbinfilename); 57 xDelete<char>(petscfilename); 58 xDelete<char>(rootpath); 59 60 } 61 /*}}}*/ 62 /*FUNCTION FemModel::FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int in_solution_type,const int* analyses,const int nummodels){{{*/ 22 63 FemModel::FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int in_solution_type,const int* analyses,const int nummodels){ 23 64 65 /*Call InitFromFiles. This constructor is just a wrapper: */ 66 this->InitFromFiles(rootpath, inputfilename, outputfilename, petscfilename, lockfilename, in_solution_type,analyses,nummodels); 67 68 } 69 /*}}}*/ 70 /*FUNCTION FemModel::InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int in_solution_type,const int* analyses,const int nummodels){{{*/ 71 void FemModel::InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int in_solution_type,const int* analyses,const int nummodels){ 72 24 73 /*intermediary*/ 25 74 int i; … … 122 171 delete parameters; 123 172 delete results; 173 delete profiler; 124 174 125 175 } … … 127 177 128 178 /*Object management*/ 179 /*FUNCTION FemModel::Solve {{{*/ 180 void FemModel::Solve(void){ 181 182 int solution_type; 183 void (*solutioncore)(FemModel*)=NULL; //core solution function pointer 184 185 _pprintLine_("call computational core:"); 186 187 /*Retrieve solution_type from parameters: */ 188 this->parameters->FindParam(&solution_type,SolutionTypeEnum); 189 190 /*Figure out which solution core we are going to run with the current solution type: */ 191 CorePointerFromSolutionEnum(&solutioncore,this->parameters,solution_type); 192 193 /*run solutoin core: */ 194 profiler->Tag(StartCore); 195 solutioncore(this); 196 profiler->Tag(FinishCore); 197 198 /*run AD core if needed: */ 199 profiler->Tag(StartAdCore); 200 ad_core(this); 201 profiler->Tag(FinishAdCore); 202 203 204 } 205 /*}}}*/ 129 206 /*FUNCTION FemModel::Echo {{{*/ 130 207 void FemModel::Echo(void){ -
TabularUnified issm/trunk-jpl/src/c/classes/FemModel.h ¶
r13549 r13553 19 19 class Loads; 20 20 class Materials; 21 class Profiler; 21 22 /*}}}*/ 22 23 … … 33 34 int analysis_counter; //counter into analysis_type_list 34 35 36 Profiler* profiler; //keep time, cpu and mem statistics while we are running. 37 35 38 Elements *elements; //elements (one set for all analyses) 36 39 Nodes *nodes; //one set of nodes … … 43 46 44 47 /*constructors, destructors: */ 48 FemModel(int argc,char** argv); 45 49 FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels); 46 50 ~FemModel(); 51 void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels); 47 52 48 53 /*Methods: */ 49 54 void Echo(); 55 void Solve(void); 50 56 51 57 /*Fem: */ -
TabularUnified issm/trunk-jpl/src/c/solutions/issm.cpp ¶
r13549 r13553 14 14 FemModel *femmodel = NULL; 15 15 16 /*configuration: */ 17 void (*solutioncore)(FemModel*)=NULL; //core solution function pointer 18 int* analyses=NULL; 19 int numanalyses; 20 int solution_type; 21 22 /*File names*/ 23 char *lockfilename = NULL; 24 char *binfilename = NULL; 25 char *outbinfilename = NULL; 26 char *petscfilename = NULL; 27 char *rootpath = NULL; 28 29 /*profiling*/ 30 Profiler* profiler=NULL; 16 /*Print starting banner: {{{*/ 17 _pprintLine_(""); 18 _pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION); 19 _pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")"); 20 _pprintLine_(""); 21 /*}}}*/ 31 22 32 23 /*Initialize exception trapping: */ … … 35 26 /*Initialize environment (MPI, PETSC, MUMPS, etc ...)*/ 36 27 EnvironmentInit(argc,argv); 37 38 /*Start profiler: */ 39 profiler=new Profiler(); 40 profiler->Tag(Start); 41 42 /*First process inputs*/ 43 _pprintLine_(""); 44 _pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION); 45 _pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")"); 46 _pprintLine_(""); 28 29 /*Initialize femmodel from arguments provided command line: */ 30 femmodel=new FemModel(argc,argv); 47 31 48 ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,&rootpath,argc,argv); 32 /*Solve: */ 33 femmodel->Solve(); 49 34 50 /*out of solution_type, figure out types of analyses needed in the femmodel: */ 51 AnalysisConfiguration(&analyses,&numanalyses,solution_type); 52 53 /*Create femmodel from input files: */ 54 profiler->Tag(StartInit); 55 femmodel=new FemModel(rootpath,binfilename,outbinfilename,petscfilename,lockfilename,solution_type,analyses,numanalyses); 56 profiler->Tag(FinishInit); 57 58 /*call cores: */ 59 _pprintLine_("call computational core:"); 60 CorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type); 61 profiler->Tag(StartCore); solutioncore(femmodel); profiler->Tag(FinishCore); 62 profiler->Tag(StartAdCore); ad_core(femmodel); profiler->Tag(FinishAdCore); 63 ProfilerEnd(profiler,femmodel->results,femmodel->parameters); 35 /*Some profiling: */ 36 ProfilerEnd(femmodel->profiler,femmodel->results,femmodel->parameters); 64 37 65 38 _pprintLine_("write results to disk:"); … … 67 40 68 41 /*Profiling at the end: */ 69 profiler->Tag(Finish);70 ProfilerEcho( profiler);42 femmodel->profiler->Tag(Finish); 43 ProfilerEcho(femmodel->profiler); 71 44 72 /*Free resources */ 73 xDelete<int>(analyses); 74 xDelete<char>(lockfilename); 75 xDelete<char>(binfilename); 76 xDelete<char>(outbinfilename); 77 xDelete<char>(petscfilename); 78 xDelete<char>(rootpath); 45 /*Wrap up: */ 79 46 delete femmodel; 80 47
Note:
See TracChangeset
for help on using the changeset viewer.