1 | /*
|
---|
2 | * CreateConstraintsDiagnosticHutter.c:
|
---|
3 | */
|
---|
4 |
|
---|
5 | #undef __FUNCT__
|
---|
6 | #define __FUNCT__ "CreateConstraintsDiagnosticHutter"
|
---|
7 |
|
---|
8 | #include "../../DataSet/DataSet.h"
|
---|
9 | #include "../../toolkits/toolkits.h"
|
---|
10 | #include "../../EnumDefinitions/EnumDefinitions.h"
|
---|
11 | #include "../../objects/objects.h"
|
---|
12 | #include "../../shared/shared.h"
|
---|
13 | #include "../IoModel.h"
|
---|
14 |
|
---|
15 |
|
---|
16 | void CreateConstraintsDiagnosticHutter(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
|
---|
17 |
|
---|
18 | int i,j;
|
---|
19 | int count;
|
---|
20 |
|
---|
21 | DataSet* constraints = NULL;
|
---|
22 |
|
---|
23 | Spc* spc = NULL;
|
---|
24 | Rgb* rgb = NULL;
|
---|
25 |
|
---|
26 | /*spc intermediary data: */
|
---|
27 | int spc_sid;
|
---|
28 | int spc_node;
|
---|
29 | int spc_dof;
|
---|
30 | double spc_value;
|
---|
31 |
|
---|
32 | /*rgb constructor data: */
|
---|
33 | int rgb_id;
|
---|
34 | int rgb_dof;
|
---|
35 | int rgb_nodeid1;
|
---|
36 | int rgb_nodeid2;
|
---|
37 |
|
---|
38 | /*Create constraints: */
|
---|
39 | constraints = new DataSet(ConstraintsEnum());
|
---|
40 |
|
---|
41 | /*Now, is the flag ishutter on? otherwise, do nothing: */
|
---|
42 | if (!iomodel->ishutter)goto cleanup_and_return;
|
---|
43 |
|
---|
44 | count=0;
|
---|
45 |
|
---|
46 | /*Fetch data: */
|
---|
47 | IoModelFetchData(&iomodel->gridonhutter,NULL,NULL,iomodel_handle,"gridonhutter");
|
---|
48 |
|
---|
49 | /*vx and vy are spc'd if we are not on gridonhutter: */
|
---|
50 | for (i=0;i<iomodel->numberofnodes;i++){
|
---|
51 | #ifdef _PARALLEL_
|
---|
52 | /*keep only this partition's nodes:*/
|
---|
53 | if((iomodel->my_grids[i])){
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | if (!(int)iomodel->gridonhutter[i]){
|
---|
57 |
|
---|
58 | spc_sid=count;
|
---|
59 | spc_node=i+1;
|
---|
60 | spc_dof=1; //we enforce first x translation degree of freedom
|
---|
61 | spc_value=0;
|
---|
62 |
|
---|
63 | spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
|
---|
64 | constraints->AddObject(spc);
|
---|
65 | count++;
|
---|
66 |
|
---|
67 | spc_sid=count;
|
---|
68 | spc_node=i+1;
|
---|
69 | spc_dof=2; //we enforce first y translation degree of freedom
|
---|
70 | spc_value=0;
|
---|
71 |
|
---|
72 | spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
|
---|
73 | constraints->AddObject(spc);
|
---|
74 | count++;
|
---|
75 | }
|
---|
76 |
|
---|
77 | #ifdef _PARALLEL_
|
---|
78 | } //if((my_grids[i]))
|
---|
79 | #endif
|
---|
80 | }
|
---|
81 |
|
---|
82 | /*Free data: */
|
---|
83 | xfree((void**)&iomodel->gridonhutter);
|
---|
84 |
|
---|
85 | /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
|
---|
86 | * datasets, it will not be redone: */
|
---|
87 | constraints->Presort();
|
---|
88 |
|
---|
89 | cleanup_and_return:
|
---|
90 |
|
---|
91 | /*Assign output pointer: */
|
---|
92 | *pconstraints=constraints;
|
---|
93 | }
|
---|