source: issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp@ 9356

Last change on this file since 9356 was 9356, checked in by Eric.Larour, 14 years ago

Major rewrite of the code so that IoModel now has a parameters dataset, which gets
loaded with all the int,char and double objects in the input file.
This is a lot more flexible, as anyone can add a field to the model, and it will
automatically appear in the IoModel parameters dataset.

Not debugged with respect to nightly runs yet. Trying to get the whole change finished.

File size: 1.8 KB
Line 
1/*
2 * CreateConstraintsEnthalpy.c:
3 */
4
5#include "../../../Container/Container.h"
6#include "../../../io/io.h"
7#include "../../../toolkits/toolkits.h"
8#include "../../../EnumDefinitions/EnumDefinitions.h"
9#include "../../../objects/objects.h"
10#include "../../../shared/shared.h"
11#include "../ModelProcessorx.h"
12
13void CreateConstraintsEnthalpy(Constraints** pconstraints, IoModel* iomodel){
14
15 /*Intermediary*/
16 int i;
17 int count;
18 int dim;
19 int numberofvertices;
20 double heatcapacity;
21 double referencetemperature;
22
23 /*Output*/
24 Constraints* constraints = NULL;
25 SpcStatic* spcstatic = NULL;
26
27 /*Fetch parameters: */
28 iomodel->parameters->FindParam(&dim,DimEnum);
29 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum);
30 iomodel->parameters->FindParam(&heatcapacity,HeatcapacityEnum);
31 iomodel->parameters->FindParam(&referencetemperature,ReferencetemperatureEnum);
32
33 /*Recover pointer: */
34 constraints=*pconstraints;
35
36 /*Create constraints if they do not exist yet*/
37 if(!constraints) constraints = new Constraints(ConstraintsEnum);
38
39 /*return if 2d mesh*/
40 if (dim==2) goto cleanup_and_return;
41
42 /*Fetch data: */
43 iomodel->FetchData(&iomodel->spctemperature,NULL,NULL,SpctemperatureEnum);
44
45 /*Initialize counter*/
46 count=0;
47
48 /*Create constraints from x,y,z: */
49 for (i=0;i<numberofvertices;i++){
50 /*keep only this partition's nodes:*/
51 if((iomodel->my_vertices[i])){
52
53 if ((int)iomodel->spctemperature[2*i]){
54
55 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,heatcapacity*(iomodel->spctemperature[2*i+1]-referencetemperature),EnthalpyAnalysisEnum));
56 count++;
57
58 }
59 }
60 }
61
62 /*Free data: */
63 xfree((void**)&iomodel->spctemperature);
64
65 cleanup_and_return:
66
67 /*Assign output pointer: */
68 *pconstraints=constraints;
69}
Note: See TracBrowser for help on using the repository browser.