Ice Sheet System Model  4.18
Code documentation
Functions
CreateNumberNodeToElementConnectivity.cpp File Reference

: create connectivity table More...

#include "../../shared/shared.h"
#include "../../classes/classes.h"
#include "../../shared/io/io.h"
#include "./ModelProcessorx.h"

Go to the source code of this file.

Functions

void CreateNumberNodeToElementConnectivity (IoModel *iomodel)
 

Detailed Description

: create connectivity table

Definition in file CreateNumberNodeToElementConnectivity.cpp.

Function Documentation

◆ CreateNumberNodeToElementConnectivity()

void CreateNumberNodeToElementConnectivity ( IoModel iomodel)

Definition at line 16 of file CreateNumberNodeToElementConnectivity.cpp.

16  {
17 
18  /*Intermediary*/
19  int i,j;
20  int vertexid;
21  int elementswidth;
22 
23  /*output*/
24  int* connectivity=NULL;
25 
26  /*Check that this has not been done yet*/
27  if(iomodel->numbernodetoelementconnectivity) return;
28 
29  /*Some checks if debugging*/
30  _assert_(iomodel->numberofvertices);
31  _assert_(iomodel->numberofelements);
32  _assert_(iomodel->elements);
33 
34  /*Allocate ouput*/
35  connectivity=xNewZeroInit<int>(iomodel->numberofvertices);
36 
37  /*Get element width*/
38  switch(iomodel->meshelementtype){
39  case TriaEnum: elementswidth=3; break;
40  case TetraEnum: elementswidth=4; break;
41  case PentaEnum: elementswidth=6; break;
42  default: _error_("mesh not supported yet");
43  }
44 
45  /*Create connectivity table*/
46  for (i=0;i<iomodel->numberofelements;i++){
47  for (j=0;j<elementswidth;j++){
48  vertexid=iomodel->elements[elementswidth*i+j];
49  _assert_(vertexid>0 && vertexid-1<iomodel->numberofvertices);
50  connectivity[vertexid-1]+=1;
51  }
52  }
53 
54  /*Assign to iomodel*/
55  iomodel->numbernodetoelementconnectivity=connectivity;
56 }
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
TetraEnum
@ TetraEnum
Definition: EnumDefinitions.h:1300
IoModel::numbernodetoelementconnectivity
int * numbernodetoelementconnectivity
Definition: IoModel.h:92
IoModel::numberofvertices
int numberofvertices
Definition: IoModel.h:99
IoModel::numberofelements
int numberofelements
Definition: IoModel.h:96
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
PentaEnum
@ PentaEnum
Definition: EnumDefinitions.h:1231
IoModel::elements
int * elements
Definition: IoModel.h:79
IoModel::meshelementtype
int meshelementtype
Definition: IoModel.h:91
TriaEnum
@ TriaEnum
Definition: EnumDefinitions.h:1318