source: issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp@ 3703

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

Big commit

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