source: issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp@ 13395

Last change on this file since 13395 was 13395, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13393

File size: 4.3 KB
Line 
1/*!\file ModelProcessorx
2 * \brief: create datasets using input binary file and a set of requested analyses
3 */
4
5#ifdef HAVE_CONFIG_H
6 #include <config.h>
7#else
8#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
9#endif
10
11#include "../../classes/objects/objects.h"
12#include "../../shared/shared.h"
13#include "../../io/io.h"
14#include "../../Container/Container.h"
15#include "../../EnumDefinitions/EnumDefinitions.h"
16#include "../../include/include.h"
17#include "../../modules/modules.h"
18
19void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters, FILE* IOMODEL,char* rootpath,const int solution_type,const int nummodels,const int* analysis_type_list){
20
21 int i,analysis_type,dim,verbose;
22 bool isthermal,isprognostic,isdiagnostic,isgroundingline,isenthalpy,autodiff;
23
24 /*output: */
25 Elements *elements = NULL;
26 Nodes *nodes = NULL;
27 Vertices *vertices = NULL;
28 Materials *materials = NULL;
29 Constraints *constraints = NULL;
30 Loads *loads = NULL;
31 Parameters *parameters = NULL;
32
33
34 /*Initialize IoModel from input file*/
35 IoModel* iomodel = new IoModel(IOMODEL);
36
37 /*Fetch parameters: */
38 iomodel->Constant(&dim,MeshDimensionEnum);
39 iomodel->Constant(&verbose,VerboseEnum);
40 iomodel->Constant(&isthermal,TransientIsthermalEnum);
41 iomodel->Constant(&isenthalpy,ThermalIsenthalpyEnum);
42 iomodel->Constant(&isprognostic,TransientIsprognosticEnum);
43 iomodel->Constant(&isdiagnostic,TransientIsdiagnosticEnum);
44 iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
45 iomodel->Constant(&autodiff,AutodiffIsautodiffEnum);
46
47 /*If we are running in AD mode, we need to declare our independent variables now, before
48 *and prevent them from being erased during successive calls to iomodel->FetchData and
49 iomodel->DeleteData:*/
50 if(autodiff)iomodel->DeclareIndependents();
51
52 SetVerbosityLevel(verbose);
53
54 for(i=0;i<nummodels;i++){
55
56 analysis_type=analysis_type_list[i];
57
58 /*Hack for trasient runs (to be improved)*/
59 if(solution_type==TransientSolutionEnum && analysis_type==ThermalAnalysisEnum && dim==2) continue;
60 if(solution_type==TransientSolutionEnum && analysis_type==MeltingAnalysisEnum && dim==2) continue;
61 if(solution_type==TransientSolutionEnum && analysis_type==EnthalpyAnalysisEnum && dim==2) continue;
62 if(solution_type==TransientSolutionEnum && analysis_type==ThermalAnalysisEnum && isthermal==false) continue;
63 if(solution_type==TransientSolutionEnum && analysis_type==MeltingAnalysisEnum && isthermal==false) continue;
64 if(solution_type==TransientSolutionEnum && analysis_type==EnthalpyAnalysisEnum && isthermal==false) continue;
65 if(solution_type==TransientSolutionEnum && analysis_type==ThermalAnalysisEnum && isenthalpy==true) continue;
66 if(solution_type==TransientSolutionEnum && analysis_type==MeltingAnalysisEnum && isenthalpy==true) continue;
67 if(solution_type==TransientSolutionEnum && analysis_type==EnthalpyAnalysisEnum && isenthalpy==false) continue;
68 if(solution_type==TransientSolutionEnum && analysis_type==PrognosticAnalysisEnum && isprognostic==false && isgroundingline==false) continue;
69 if(solution_type==TransientSolutionEnum && analysis_type==DiagnosticHorizAnalysisEnum && isdiagnostic==false) continue;
70 if(solution_type==TransientSolutionEnum && analysis_type==DiagnosticVertAnalysisEnum && isdiagnostic==false) continue;
71 if(solution_type==TransientSolutionEnum && analysis_type==DiagnosticHutterAnalysisEnum && isdiagnostic==false) continue;
72 if(solution_type==SteadystateSolutionEnum && analysis_type==ThermalAnalysisEnum && isenthalpy==true) continue;
73 if(solution_type==SteadystateSolutionEnum && analysis_type==MeltingAnalysisEnum && isenthalpy==true) continue;
74 if(solution_type==SteadystateSolutionEnum && analysis_type==EnthalpyAnalysisEnum && isenthalpy==false) continue;
75
76 if(VerboseMProcessor()) _pprintLine_(" creating datasets for analysis " << EnumToStringx(analysis_type));
77 CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,rootpath,solution_type,analysis_type,nummodels,i);
78 }
79
80 /*Free resources:*/
81 delete iomodel;
82
83 /*Assign output pointers:*/
84 *pelements=elements;
85 *pnodes=nodes;
86 *pvertices=vertices;
87 *pmaterials=materials;
88 *pconstraints=constraints;
89 *ploads=loads;
90 *pparameters=parameters;
91
92}
Note: See TracBrowser for help on using the repository browser.