source: issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp@ 9340

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

Propping up IoModel class, to contain the iomodel handlle. This simplifies IoModelFetchDAta,
which then becomes the FetchData method of the IoModel class.

File size: 2.3 KB
Line 
1/*
2 * CreateNodesDiagnosticHutter.c:
3 */
4
5#include "../../../Container/Container.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 "../../MeshPartitionx/MeshPartitionx.h"
12#include "../../../include/include.h"
13#include "../ModelProcessorx.h"
14
15void CreateNodesDiagnosticHutter(Nodes** pnodes, IoModel* iomodel){
16
17 /*Intermediary*/
18 int i;
19 bool continuous_galerkin=true;
20
21 /*DataSets: */
22 Nodes* nodes = NULL;
23
24 /*Recover pointer: */
25 nodes=*pnodes;
26
27 /*Create nodes if they do not exist yet*/
28 if(!nodes) nodes = new Nodes(NodesEnum);
29
30 /*Now, is the flag ishutter on? otherwise, do nothing: */
31 if (!iomodel->ishutter)goto cleanup_and_return;
32
33 /*Continuous Galerkin partition of nodes: */
34 NodesPartitioning(&iomodel->my_nodes,iomodel->my_elements,iomodel->my_vertices,iomodel,continuous_galerkin);
35
36 /*First fetch data: */
37 iomodel->FetchData(&iomodel->nodeonbed,NULL,NULL,NodeOnBedEnum);
38 iomodel->FetchData(&iomodel->nodeonsurface,NULL,NULL,NodeOnSurfaceEnum);
39 iomodel->FetchData(&iomodel->nodeonhutter,NULL,NULL,NodeOnHutterEnum);
40 iomodel->FetchData(&iomodel->nodeonicesheet,NULL,NULL,NodeOnIceSheetEnum);
41 iomodel->FetchData(&iomodel->nodeoniceshelf,NULL,NULL,NodeOnIceShelfEnum);
42 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum);
43 iomodel->FetchData(&iomodel->vertices_type,NULL,NULL,VerticesTypeEnum);
44 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum);
45
46 CreateNumberNodeToElementConnectivity(iomodel);
47
48 for (i=0;i<iomodel->numberofvertices;i++){
49
50 if(iomodel->my_vertices[i]){
51
52 /*Add node to nodes dataset: */
53 nodes->AddObject(new Node(iomodel->nodecounter+i+1,i,i+1,i,iomodel,DiagnosticHutterAnalysisEnum));
54
55 }
56 }
57
58 /*Clean fetched data: */
59 xfree((void**)&iomodel->nodeonbed);
60 xfree((void**)&iomodel->nodeonsurface);
61 xfree((void**)&iomodel->nodeonhutter);
62 xfree((void**)&iomodel->nodeonicesheet);
63 xfree((void**)&iomodel->nodeoniceshelf);
64 xfree((void**)&iomodel->elements);
65 xfree((void**)&iomodel->nodeonwater);
66 xfree((void**)&iomodel->numbernodetoelementconnectivity);
67 xfree((void**)&iomodel->vertices_type);
68
69 cleanup_and_return:
70
71 /*Assign output pointer: */
72 *pnodes=nodes;
73}
Note: See TracBrowser for help on using the repository browser.