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

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

Propping up IoModel class, to contain the iomodel handlle. This simplifies IoModelFetchDAta,
which then becomes the FetchData method of the IoModel class.

File size: 1.4 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
19 /*Output*/
20 Constraints* constraints = NULL;
21 SpcStatic* spcstatic = NULL;
22
23 /*Recover pointer: */
24 constraints=*pconstraints;
25
26 /*Create constraints if they do not exist yet*/
27 if(!constraints) constraints = new Constraints(ConstraintsEnum);
28
29 /*return if 2d mesh*/
30 if (iomodel->dim==2) goto cleanup_and_return;
31
32 /*Fetch data: */
33 iomodel->FetchData(&iomodel->spctemperature,NULL,NULL,SpctemperatureEnum);
34
35 /*Initialize counter*/
36 count=0;
37
38 /*Create constraints from x,y,z: */
39 for (i=0;i<iomodel->numberofvertices;i++){
40 /*keep only this partition's nodes:*/
41 if((iomodel->my_vertices[i])){
42
43 if ((int)iomodel->spctemperature[2*i]){
44
45 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->heatcapacity*(iomodel->spctemperature[2*i+1]-iomodel->referencetemperature),EnthalpyAnalysisEnum));
46 count++;
47
48 }
49 }
50 }
51
52 /*Free data: */
53 xfree((void**)&iomodel->spctemperature);
54
55 cleanup_and_return:
56
57 /*Assign output pointer: */
58 *pconstraints=constraints;
59}
Note: See TracBrowser for help on using the repository browser.