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

: create connectivity table More...

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

Go to the source code of this file.

Functions

void CreateSingleNodeToElementConnectivity (IoModel *iomodel)
 

Detailed Description

: create connectivity table

Definition in file CreateSingleNodeToElementConnectivity.cpp.

Function Documentation

◆ CreateSingleNodeToElementConnectivity()

void CreateSingleNodeToElementConnectivity ( IoModel iomodel)

! in parallel we do not want the vertex to be connected to an element that is not in its partition!!

Definition at line 10 of file CreateSingleNodeToElementConnectivity.cpp.

10  {
11 
12  /*Intermediary*/
13  int vertexid;
14  int elementswidth;
15 
16  /*output*/
17  int* connectivity=NULL;
18 
19  /*Return if connectivity already present*/
20  if(iomodel->singlenodetoelementconnectivity) return;
21 
22  /*Some checks if debugging*/
23  _assert_(iomodel->numberofvertices);
24  _assert_(iomodel->numberofelements);
25  _assert_(iomodel->my_elements);
26  _assert_(iomodel->elements);
27 
28  /*Allocate ouput*/
29  connectivity=xNewZeroInit<int>(iomodel->numberofvertices);
30 
31  /*Get element width*/
32  switch(iomodel->meshelementtype){
33  case TriaEnum: elementswidth=3; break;
34  case PentaEnum: elementswidth=6; break;
35  case TetraEnum: elementswidth=4; break;
36  default: _error_("mesh type "<<EnumToStringx(iomodel->domaintype)<<" not supported yet");
37  }
38 
39  /*Create connectivity table*/
40  for(int i=0;i<iomodel->numberofelements;i++){
42  if(iomodel->my_elements[i]){
43  for(int j=0;j<elementswidth;j++){
44  vertexid=iomodel->elements[elementswidth*i+j];
45  _assert_(vertexid>0 && vertexid-1<iomodel->numberofvertices);
46  connectivity[vertexid-1]=i+1;
47  }
48  }
49  }
50 
51  /*Assign to iomodel*/
52  iomodel->singlenodetoelementconnectivity=connectivity;
53 }
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
TetraEnum
@ TetraEnum
Definition: EnumDefinitions.h:1300
IoModel::my_elements
bool * my_elements
Definition: IoModel.h:66
IoModel::numberofvertices
int numberofvertices
Definition: IoModel.h:99
IoModel::numberofelements
int numberofelements
Definition: IoModel.h:96
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
IoModel::singlenodetoelementconnectivity
int * singlenodetoelementconnectivity
Definition: IoModel.h:100
_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
IoModel::domaintype
int domaintype
Definition: IoModel.h:78
TriaEnum
@ TriaEnum
Definition: EnumDefinitions.h:1318