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 "../ModelProcessorx.h"
|
---|
11 |
|
---|
12 | void CreateConstraintsDiagnosticHutter(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
|
---|
13 |
|
---|
14 | int i;
|
---|
15 | int count=0;
|
---|
16 |
|
---|
17 | DataSet* constraints = NULL;
|
---|
18 | Spc* spc = NULL;
|
---|
19 |
|
---|
20 | /*Create constraints: */
|
---|
21 | constraints = new DataSet(ConstraintsEnum);
|
---|
22 |
|
---|
23 | /*Now, is the flag ishutter on? otherwise, do nothing: */
|
---|
24 | if (!iomodel->ishutter) goto cleanup_and_return;
|
---|
25 |
|
---|
26 | /*Fetch data: */
|
---|
27 | IoModelFetchData(&iomodel->gridonhutter,NULL,NULL,iomodel_handle,"gridonhutter");
|
---|
28 |
|
---|
29 | count=1; //matlab indexing
|
---|
30 | /*vx and vy are spc'd if we are not on gridonhutter: */
|
---|
31 | for (i=0;i<iomodel->numberofvertices;i++){
|
---|
32 | /*keep only this partition's nodes:*/
|
---|
33 | if((iomodel->my_vertices[i])){
|
---|
34 | if (!(int)iomodel->gridonhutter[i]){
|
---|
35 |
|
---|
36 | constraints->AddObject(new Spc(count,i+1,1,0));
|
---|
37 | count++;
|
---|
38 |
|
---|
39 | constraints->AddObject(new Spc(count,i+1,2,0));
|
---|
40 | count++;
|
---|
41 | }
|
---|
42 | } //if((my_vertices[i]))
|
---|
43 | }
|
---|
44 |
|
---|
45 | /*Free data: */
|
---|
46 | xfree((void**)&iomodel->gridonhutter);
|
---|
47 |
|
---|
48 | /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
|
---|
49 | * datasets, it will not be redone: */
|
---|
50 | constraints->Presort();
|
---|
51 |
|
---|
52 | cleanup_and_return:
|
---|
53 |
|
---|
54 | /*Assign output pointer: */
|
---|
55 | *pconstraints=constraints;
|
---|
56 | }
|
---|