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