1 | /*
|
---|
2 | * CreateConstraintsPrognostic2.c:
|
---|
3 | */
|
---|
4 |
|
---|
5 |
|
---|
6 | #include "../../DataSet/DataSet.h"
|
---|
7 | #include "../../toolkits/toolkits.h"
|
---|
8 | #include "../../EnumDefinitions/EnumDefinitions.h"
|
---|
9 | #include "../../objects/objects.h"
|
---|
10 | #include "../../shared/shared.h"
|
---|
11 | #include "../IoModel.h"
|
---|
12 |
|
---|
13 |
|
---|
14 | void CreateConstraintsPrognostic2(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
|
---|
15 |
|
---|
16 |
|
---|
17 | int i;
|
---|
18 | int count;
|
---|
19 |
|
---|
20 | DataSet* constraints = NULL;
|
---|
21 | Spc* spc = NULL;
|
---|
22 |
|
---|
23 | /*spc intermediary data: */
|
---|
24 | int spc_sid;
|
---|
25 | int spc_node;
|
---|
26 | int spc_dof;
|
---|
27 | double spc_value;
|
---|
28 |
|
---|
29 | double* spcthickness=NULL;
|
---|
30 |
|
---|
31 | /*Create constraints: */
|
---|
32 | constraints = new DataSet(ConstraintsEnum());
|
---|
33 |
|
---|
34 | /*Fetch data: */
|
---|
35 | IoModelFetchData(&spcthickness,NULL,NULL,iomodel_handle,"spcthickness");
|
---|
36 |
|
---|
37 | count=0;
|
---|
38 |
|
---|
39 | /*Create spcs from x,y,z, as well as the spc values on those spcs: */
|
---|
40 | for (i=0;i<iomodel->numberofnodes;i++){
|
---|
41 | #ifdef _PARALLEL_
|
---|
42 | /*keep only this partition's nodes:*/
|
---|
43 | if((iomodel->my_grids[i]==1)){
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | if ((int)spcthickness[2*i]){
|
---|
47 |
|
---|
48 | /*This grid needs to be spc'd: */
|
---|
49 |
|
---|
50 | spc_sid=count;
|
---|
51 | spc_node=i+1;
|
---|
52 | spc_dof=1; //we enforce first translation degree of freedom, for temperature
|
---|
53 | spc_value=*(spcthickness+2*i+1);
|
---|
54 |
|
---|
55 | spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
|
---|
56 | constraints->AddObject(spc);
|
---|
57 | count++;
|
---|
58 | }
|
---|
59 |
|
---|
60 | #ifdef _PARALLEL_
|
---|
61 | } //if((my_grids[i]==1))
|
---|
62 | #endif
|
---|
63 | }
|
---|
64 |
|
---|
65 | /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
|
---|
66 | * datasets, it will not be redone: */
|
---|
67 | constraints->Presort();
|
---|
68 |
|
---|
69 | /*Free data: */
|
---|
70 | xfree((void**)&spcthickness);
|
---|
71 |
|
---|
72 | cleanup_and_return:
|
---|
73 |
|
---|
74 | /*Assign output pointer: */
|
---|
75 | *pconstraints=constraints;
|
---|
76 | }
|
---|