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

: partition elements and nodes and vertices More...

#include <string.h>
#include "../../classes/classes.h"
#include "../../shared/shared.h"
#include "./ModelProcessorx.h"

Go to the source code of this file.

Functions

void FacesPartitioning (IoModel *iomodel)
 

Detailed Description

: partition elements and nodes and vertices

Definition in file FacesPartitioning.cpp.

Function Documentation

◆ FacesPartitioning()

void FacesPartitioning ( IoModel iomodel)

Definition at line 10 of file FacesPartitioning.cpp.

10  {
11 
12  /*If faces are already present, exit*/
13  if(iomodel->my_faces) return;
14 
15  /*Get faces and elements*/
16  CreateFaces(iomodel);
18 
19  /*Mesh dependent variables*/
20  int elementnbf;
21  if(iomodel->domaintype==Domain2DhorizontalEnum){
22  elementnbf = 3;
23  }
24  else if(iomodel->domaintype==Domain2DverticalEnum){
25  elementnbf = 3;
26  }
27  else if(iomodel->domaintype==Domain3DEnum){
28  elementnbf = 5;
29  }
30  else{
31  _error_("mesh dimension not supported yet");
32  }
33  /*output: */
34  iomodel->my_faces=xNewZeroInit<bool>(iomodel->numberoffaces);
35 
36  for(int i=0;i<iomodel->numberofelements;i++){
37  if(iomodel->my_elements[i]){
38  for(int j=0;j<elementnbf;j++){
39  _assert_(iomodel->elementtofaceconnectivity[i*elementnbf+j] >= 0);
40  _assert_(iomodel->elementtofaceconnectivity[i*elementnbf+j] < iomodel->numberoffaces);
41  iomodel->my_faces[iomodel->elementtofaceconnectivity[i*elementnbf+j]] = true;
42  }
43  }
44  }
45 
46  if(iomodel->meshelementtype==PentaEnum){
47  iomodel->my_vfaces = xNewZeroInit<bool>(iomodel->numberofverticalfaces);
48  for(int i=0;i<iomodel->numberofelements;i++){
49  if(iomodel->my_elements[i]){
50  for(int j=0;j<3;j++){
52  iomodel->my_vfaces[iomodel->elementtoverticalfaceconnectivity[i*3+j]] = true;
53  }
54  }
55  }
56  }
57 }
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IoModel::elementtofaceconnectivity
int * elementtofaceconnectivity
Definition: IoModel.h:86
IoModel::my_vfaces
bool * my_vfaces
Definition: IoModel.h:68
IoModel::numberoffaces
int numberoffaces
Definition: IoModel.h:97
IoModel::my_elements
bool * my_elements
Definition: IoModel.h:66
Domain2DhorizontalEnum
@ Domain2DhorizontalEnum
Definition: EnumDefinitions.h:534
IoModel::numberofelements
int numberofelements
Definition: IoModel.h:96
Domain3DEnum
@ Domain3DEnum
Definition: EnumDefinitions.h:536
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
IoModel::numberofverticalfaces
int numberofverticalfaces
Definition: IoModel.h:98
PentaEnum
@ PentaEnum
Definition: EnumDefinitions.h:1231
IoModel::meshelementtype
int meshelementtype
Definition: IoModel.h:91
CreateFaces
void CreateFaces(IoModel *iomodel)
Definition: CreateFaces.cpp:9
IoModel::elementtoverticalfaceconnectivity
int * elementtoverticalfaceconnectivity
Definition: IoModel.h:87
IoModel::my_faces
bool * my_faces
Definition: IoModel.h:67
IoModel::domaintype
int domaintype
Definition: IoModel.h:78
Domain2DverticalEnum
@ Domain2DverticalEnum
Definition: EnumDefinitions.h:535