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

Last change on this file since 21341 was 21341, checked in by Mathieu Morlighem, 8 years ago

merged trunk-jpl and trunk for revision 21337

File size: 3.6 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/classes.h"
12#include "../../shared/shared.h"
13#include "./ModelProcessorx.h"
14
15void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters,IoModel* iomodel,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){
16
17 int i,analysis_enum,verbose;
18
19 /*Initialize datasets*/
20 Elements *elements = new Elements();
21 Nodes *nodes = new Nodes();
22 Vertices *vertices = new Vertices();
23 Materials *materials = new Materials();
24 Constraints *constraints = new Constraints();
25 Loads *loads = new Loads();
26 Parameters *parameters = new Parameters();
27
28 /*Fetch parameters: */
29 iomodel->FindConstant(&verbose,"md.verbose");
30 SetVerbosityLevel(verbose);
31
32 if(VerboseMProcessor()) _printf0_(" starting model processor \n");
33
34 /*Partition Elements and Nodes*/
35 ElementsAndVerticesPartitioning(&iomodel->my_elements,&iomodel->my_vertices,iomodel);
36
37 /*Create elements, vertices and materials, independent of analysis_enum: */
38 CreateElementsVerticesAndMaterials(elements,vertices,materials,iomodel,nummodels);
39
40 /*Create Parameters*/
41 CreateParameters(parameters,iomodel,rootpath,toolkitfile,solution_enum);
42
43 for(i=0;i<nummodels;i++){
44
45 analysis_enum=analysis_enum_list[i];
46 parameters->AddObject(new IntParam(AnalysisCounterEnum,i));
47
48 if(VerboseMProcessor()) _printf0_(" creating datasets for analysis " << EnumToStringx(analysis_enum) << "\n");
49 Analysis* analysis = EnumToAnalysis(analysis_enum);
50 analysis->UpdateParameters(parameters,iomodel,solution_enum,analysis_enum);
51 analysis->CreateNodes(nodes,iomodel);
52 analysis->CreateConstraints(constraints,iomodel);
53 analysis->CreateLoads(loads,iomodel);
54 analysis->UpdateElements(elements,iomodel,i,analysis_enum);
55 delete analysis;
56
57
58 /* Update counters, because we have created more nodes, loads and
59 * constraints, and ids for objects created in next call to CreateDataSets
60 * will need to start at the end of the updated counters: */
61 if(nodes->Size()) iomodel->nodecounter = nodes->MaximumId();
62 iomodel->loadcounter = loads->NumberOfLoads();
63 iomodel->constraintcounter = constraints->NumberOfConstraints();
64
65 /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
66 _assert_(iomodel->nodecounter>=0);
67 }
68
69 /*Solution specific updates*/
70 UpdateElementsAndMaterialsControl(elements,materials,iomodel);
71 #ifdef _HAVE_DAKOTA_
72 UpdateElementsAndMaterialsDakota(elements,materials,iomodel);
73 #endif
74 if(solution_enum==TransientSolutionEnum){
75 UpdateElementsTransient(elements,parameters,iomodel,analysis_enum);
76 }
77
78 /*Output definitions dataset: */
79 CreateOutputDefinitions(elements,parameters,iomodel);
80
81 /* Sort datasets:
82 * All our datasets are already ordered by ids. Set presort flag so that
83 * later on, when sorting is requested on these datasets, it will not be
84 * redone: */
85 elements->Presort();
86 nodes->Presort();
87 vertices->Presort();
88 loads->Presort();
89 materials->Presort();
90
91 constraints->Presort();
92 if(VerboseMProcessor()) _printf0_(" done with model processor \n");
93
94 /*Assign output pointers:*/
95 *pelements = elements;
96 *pnodes = nodes;
97 *pvertices = vertices;
98 *pmaterials = materials;
99 *pconstraints = constraints;
100 *ploads = loads;
101 *pparameters = parameters;
102}
Note: See TracBrowser for help on using the repository browser.