Ice Sheet System Model  4.18
Code documentation
Functions
BamgConvertMesh.cpp File Reference
#include "./BamgConvertMesh.h"

Go to the source code of this file.

Functions

void BamgConvertMeshUsage (void)
 
 WRAPPER (BamgConvertMesh_python)
 

Function Documentation

◆ BamgConvertMeshUsage()

void BamgConvertMeshUsage ( void  )

Definition at line 6 of file BamgConvertMesh.cpp.

6  {/*{{{*/
7  _printf0_("BAMGCONVERTMESH - convert [x y index] to a bamg geom and mesh geom");
8  _printf0_("\n");
9  _printf0_(" Usage:\n");
10  _printf0_(" [bamggeom bamgmesh]=BamgConvertMesh(index,x,y)\n");
11  _printf0_(" index: index of the mesh\n");
12  _printf0_(" x,y: coordinates of the nodes\n");
13  _printf0_("\n");
14 }/*}}}*/

◆ WRAPPER()

WRAPPER ( BamgConvertMesh_python  )

Definition at line 15 of file BamgConvertMesh.cpp.

15  {
16 
17  /*input: */
18  int *index = NULL;
19  double *x = NULL;
20  double *y = NULL;
21  int nods,nels,test1,test2;
22 
23  /*Output*/
24  BamgMesh *bamgmesh = NULL;
25  BamgGeom *bamggeom = NULL;
26 
27  /*Boot module: */
28  MODULEBOOT();
29 
30  /*checks on arguments on the matlab side: */
31  CHECKARGUMENTS(NLHS,NRHS,&BamgConvertMeshUsage);
32 
33  /*Initialize Bamg outputs*/
34  bamggeom=new BamgGeom();
35  bamgmesh=new BamgMesh();
36 
37  /*Input datasets: */
38  FetchData(&index,&nels,&test1,INDEXHANDLE);
39  FetchData(&x,&nods,XHANDLE);
40  FetchData(&y,&test2,YHANDLE);
41 
42  /*Check inputs*/
43  if(nels<0) _error_("Number of elements must be positive, check index number of lines");
44  if(nods<0) _error_("Number of nods must be positive, check x and y sizes");
45  if(test1!=3) _error_("index should have 3 columns");
46  if(test2!=nods) _error_("x and y do not have the same length");
47 
48  /* Run core computations: */
49  BamgConvertMeshx(bamgmesh,bamggeom,index,x,y,nods,nels);
50 
51  /*Generate output Matlab Structures*/
52  WriteData(BAMGGEOMOUT,bamggeom);
53  WriteData(BAMGMESHOUT,bamgmesh);
54 
55  /*Clean up*/
56  xDelete<int>(index);
57  xDelete<double>(x);
58  xDelete<double>(y);
59  delete bamggeom;
60  delete bamgmesh;
61 
62  /*end module: */
63  MODULEEND();
64 }
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
WriteData
void WriteData(IssmPDouble **pmatrix, int *pnel, int *matrix, int M, int N)
Definition: WriteJavascriptData.cpp:16
BamgConvertMeshx
int BamgConvertMeshx(BamgMesh *bamgmesh, BamgGeom *bamggeom, int *index, double *x, double *y, int nods, int nels)
Definition: BamgConvertMeshx.cpp:13
NRHS
#define NRHS
Definition: BamgConvertMesh.h:52
BamgMesh
Definition: BamgMesh.h:7
BamgConvertMeshUsage
void BamgConvertMeshUsage(void)
Definition: BamgConvertMesh.cpp:6
FetchData
void FetchData(char **pstring, char *stringin)
Definition: FetchJavascriptData.cpp:16
NLHS
#define NLHS
Definition: BamgConvertMesh.h:50
BamgGeom
Definition: BamgGeom.h:7
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49