1 | /*!\file: CreateDataSets
|
---|
2 | * \brief general driver for creating all datasets that make a finite element iomodel
|
---|
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 "../MeshPartitionx/MeshPartitionx.h"
|
---|
14 | #include "./ModelProcessorx.h"
|
---|
15 |
|
---|
16 | void CreateDataSets(Elements** pelements,Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads,Parameters** pparameters,IoModel* iomodel,char* rootpath,const int solution_type,const int analysis_type,const int nummodels,int analysis_counter){
|
---|
17 |
|
---|
18 | Elements *elements = NULL;
|
---|
19 | Materials *materials = NULL;
|
---|
20 | Parameters *parameters = NULL;
|
---|
21 |
|
---|
22 | /*Process Finite Element Mesh*/
|
---|
23 |
|
---|
24 | /*Partition Elements and Nodes*/
|
---|
25 | ElementsAndVerticesPartitioning(&iomodel->my_elements,&iomodel->my_vertices,iomodel);
|
---|
26 |
|
---|
27 | /*Create elements, vertices and materials, independent of analysis_type: */
|
---|
28 | CreateElementsVerticesAndMaterials(pelements, pvertices, pmaterials, iomodel,nummodels);
|
---|
29 |
|
---|
30 | /*Recover elements and materials, for future update: */
|
---|
31 | elements = *pelements;
|
---|
32 | materials = *pmaterials;
|
---|
33 |
|
---|
34 | /*Creates Nodes and constraints datasets if empty*/
|
---|
35 | if(!*pnodes) *pnodes = new Nodes();
|
---|
36 | if(!*pconstraints) *pconstraints = new Constraints();
|
---|
37 | if(!*ploads) *ploads = new Loads();
|
---|
38 |
|
---|
39 | /*Now, branch onto analysis dependent model generation: */
|
---|
40 | switch(analysis_type){
|
---|
41 |
|
---|
42 | #ifdef _HAVE_DIAGNOSTIC_
|
---|
43 | case DiagnosticHorizAnalysisEnum:
|
---|
44 | CreateNodesDiagnosticHoriz(pnodes, iomodel);
|
---|
45 | CreateConstraintsDiagnosticHoriz(pconstraints,iomodel);
|
---|
46 | CreateLoadsDiagnosticHoriz(ploads,iomodel);
|
---|
47 | UpdateElementsDiagnosticHoriz(elements,iomodel,analysis_counter,analysis_type);
|
---|
48 | break;
|
---|
49 |
|
---|
50 | case DiagnosticVertAnalysisEnum:
|
---|
51 | CreateNodesDiagnosticVert(pnodes, iomodel);
|
---|
52 | CreateConstraintsDiagnosticVert(pconstraints,iomodel);
|
---|
53 | CreateLoadsDiagnosticVert(ploads,iomodel);
|
---|
54 | UpdateElementsDiagnosticVert(elements,iomodel,analysis_counter,analysis_type);
|
---|
55 | break;
|
---|
56 |
|
---|
57 | case DiagnosticSIAAnalysisEnum:
|
---|
58 | CreateNodesDiagnosticSIA(pnodes, iomodel);
|
---|
59 | CreateConstraintsDiagnosticSIA(pconstraints,iomodel);
|
---|
60 | CreateLoadsDiagnosticSIA(ploads,iomodel);
|
---|
61 | UpdateElementsDiagnosticSIA(elements,iomodel,analysis_counter,analysis_type);
|
---|
62 | break;
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | #ifdef _HAVE_HYDROLOGY_
|
---|
66 | case HydrologyShreveAnalysisEnum:
|
---|
67 | CreateNodesHydrologyShreve(pnodes, iomodel);
|
---|
68 | CreateConstraintsHydrologyShreve(pconstraints,iomodel);
|
---|
69 | CreateLoadsHydrologyShreve(ploads,iomodel);
|
---|
70 | UpdateElementsHydrologyShreve(elements,iomodel,analysis_counter,analysis_type);
|
---|
71 | break;
|
---|
72 | case HydrologyDCInefficientAnalysisEnum:
|
---|
73 | CreateNodesHydrologyDCInefficient(pnodes, iomodel);
|
---|
74 | CreateConstraintsHydrologyDCInefficient(pconstraints,iomodel);
|
---|
75 | CreateLoadsHydrologyDCInefficient(ploads,iomodel);
|
---|
76 | UpdateElementsHydrologyDCInefficient(elements,iomodel,analysis_counter,analysis_type);
|
---|
77 | break;
|
---|
78 | case HydrologyDCEfficientAnalysisEnum:
|
---|
79 | CreateNodesHydrologyDCEfficient(pnodes, iomodel);
|
---|
80 | CreateConstraintsHydrologyDCEfficient(pconstraints,iomodel);
|
---|
81 | CreateLoadsHydrologyDCEfficient(ploads,iomodel);
|
---|
82 | UpdateElementsHydrologyDCEfficient(elements,iomodel,analysis_counter,analysis_type);
|
---|
83 | break;
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | #ifdef _HAVE_THERMAL_
|
---|
87 | case ThermalAnalysisEnum:
|
---|
88 | CreateNodesThermal(pnodes, iomodel);
|
---|
89 | CreateConstraintsThermal(pconstraints,iomodel);
|
---|
90 | CreateLoadsThermal(ploads,iomodel);
|
---|
91 | UpdateElementsThermal(elements,iomodel,analysis_counter,analysis_type);
|
---|
92 | break;
|
---|
93 |
|
---|
94 | case EnthalpyAnalysisEnum:
|
---|
95 | CreateNodesEnthalpy(pnodes, iomodel);
|
---|
96 | CreateConstraintsEnthalpy(pconstraints,iomodel);
|
---|
97 | CreateLoadsEnthalpy(ploads,iomodel);
|
---|
98 | UpdateElementsEnthalpy(elements,iomodel,analysis_counter,analysis_type);
|
---|
99 | break;
|
---|
100 |
|
---|
101 | case MeltingAnalysisEnum:
|
---|
102 | CreateNodesMelting(pnodes, iomodel);
|
---|
103 | CreateConstraintsMelting(pconstraints,iomodel);
|
---|
104 | CreateLoadsMelting(ploads,iomodel);
|
---|
105 | UpdateElementsMelting(elements,iomodel,analysis_counter,analysis_type);
|
---|
106 | break;
|
---|
107 | #endif
|
---|
108 |
|
---|
109 | #ifdef _HAVE_BALANCED_
|
---|
110 | case BalancethicknessAnalysisEnum:
|
---|
111 | CreateNodesBalancethickness(pnodes, iomodel);
|
---|
112 | CreateConstraintsBalancethickness(pconstraints,iomodel);
|
---|
113 | CreateLoadsBalancethickness(ploads,iomodel);
|
---|
114 | UpdateElementsBalancethickness(elements,iomodel,analysis_counter,analysis_type);
|
---|
115 | break;
|
---|
116 | #endif
|
---|
117 |
|
---|
118 | #ifdef _HAVE_GIA_
|
---|
119 | case GiaAnalysisEnum:
|
---|
120 | CreateNodesGia(pnodes, iomodel);
|
---|
121 | CreateConstraintsGia(pconstraints,iomodel);
|
---|
122 | CreateLoadsGia(ploads,iomodel);
|
---|
123 | UpdateElementsGia(elements,iomodel,analysis_counter,analysis_type);
|
---|
124 | break;
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | #ifdef _HAVE_SLOPE_
|
---|
128 | case BedSlopeAnalysisEnum:
|
---|
129 | CreateNodesBedSlope(pnodes, iomodel);
|
---|
130 | CreateConstraintsBedSlope(pconstraints,iomodel);
|
---|
131 | CreateLoadsBedSlope(ploads,iomodel);
|
---|
132 | UpdateElementsBedSlope(elements,iomodel,analysis_counter,analysis_type);
|
---|
133 | break;
|
---|
134 |
|
---|
135 | case SurfaceSlopeAnalysisEnum:
|
---|
136 | CreateNodesSurfaceSlope(pnodes, iomodel);
|
---|
137 | CreateConstraintsSurfaceSlope(pconstraints,iomodel);
|
---|
138 | CreateLoadsSurfaceSlope(ploads,iomodel);
|
---|
139 | UpdateElementsSurfaceSlope(elements,iomodel,analysis_counter,analysis_type);
|
---|
140 | break;
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | #ifdef _HAVE_PROGNOSTIC_
|
---|
144 | case PrognosticAnalysisEnum:
|
---|
145 | CreateNodesPrognostic(pnodes, iomodel);
|
---|
146 | CreateConstraintsPrognostic(pconstraints,iomodel);
|
---|
147 | CreateLoadsPrognostic(ploads,iomodel);
|
---|
148 | UpdateElementsPrognostic(elements,iomodel,analysis_counter,analysis_type);
|
---|
149 | break;
|
---|
150 | #endif
|
---|
151 |
|
---|
152 | default:
|
---|
153 | _error_("analysis_type: " << EnumToStringx(analysis_type) << " not supported yet!");
|
---|
154 | }
|
---|
155 |
|
---|
156 | /*Update Elements and Materials For Control methods*/
|
---|
157 | #ifdef _HAVE_CONTROL_
|
---|
158 | UpdateElementsAndMaterialsControl(elements,materials,iomodel);
|
---|
159 | #endif
|
---|
160 |
|
---|
161 | /*Generate objects that are not dependent on any analysis_type: */
|
---|
162 | CreateParameters(pparameters,iomodel,rootpath,solution_type,analysis_type,analysis_counter);
|
---|
163 |
|
---|
164 | /*Update Elements in case we are running a transient solution: */
|
---|
165 | #ifdef _HAVE_TRANSIENT_
|
---|
166 | parameters=*pparameters;
|
---|
167 | if(analysis_counter==(nummodels-1)&& solution_type==TransientSolutionEnum){
|
---|
168 | UpdateElementsTransient(elements,parameters,iomodel,analysis_counter,analysis_type);
|
---|
169 | }
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | /*Sort datasets: */
|
---|
173 | SortDataSets(pelements,pnodes,pvertices, ploads, pmaterials, pconstraints, pparameters);
|
---|
174 |
|
---|
175 | /* Update counters, because we have created more nodes, loads and
|
---|
176 | * constraints, and ids for objects created in next call to CreateDataSets
|
---|
177 | * will need to start at the end of the updated counters: */
|
---|
178 | UpdateCounters(iomodel,pnodes,ploads,pconstraints);
|
---|
179 | }
|
---|