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