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

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

Before computer shutdown, commiting changes to the almost final interface for dynamic I/O

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->constants->FindParam(&dim,DimEnum);
29 iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
30 iomodel->constants->FindParam(&heatcapacity,HeatcapacityEnum);
31 iomodel->constants->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.