Changeset 5154


Ignore:
Timestamp:
08/11/10 14:22:30 (15 years ago)
Author:
Mathieu Morlighem
Message:

Bamg Arguments are now classes

Location:
issm/trunk/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk/src/c/Makefile.am

    r5146 r5154  
    6767                                        ./objects/Bamg/Triangle.cpp\
    6868                                        ./objects/Bamg/Triangle.h\
    69                                         ./objects/Bamg/Mesh.cpp\
    70                                         ./objects/Bamg/Mesh.h\
    7169                                        ./objects/Bamg/BamgVertex.cpp\
    7270                                        ./objects/Bamg/BamgVertex.h\
     
    7775                                        ./objects/Bamg/VertexOnVertex.h\
    7876                                        ./objects/Bamg/VertexOnVertex.cpp\
     77                                        ./objects/Bamg/Mesh.cpp\
     78                                        ./objects/Bamg/Mesh.h\
    7979                                        ./objects/Update.h\
    8080                                        ./objects/Element.h\
     
    603603                                        ./objects/Bamg/Triangle.cpp\
    604604                                        ./objects/Bamg/Triangle.h\
    605                                         ./objects/Bamg/Mesh.h\
    606                                         ./objects/Bamg/Mesh.cpp\
    607605                                        ./objects/Bamg/BamgVertex.cpp\
    608606                                        ./objects/Bamg/BamgVertex.h\
     
    612610                                        ./objects/Bamg/VertexOnGeom.cpp\
    613611                                        ./objects/Bamg/VertexOnVertex.h\
     612                                        ./objects/Bamg/Mesh.h\
     613                                        ./objects/Bamg/Mesh.cpp\
    614614                                        ./objects/Update.h\
    615615                                        ./objects/Element.h\
     
    11061106bin_PROGRAMS =
    11071107else
    1108 bin_PROGRAMS = issm.exe 
     1108bin_PROGRAMS = issm.exe
    11091109endif
    11101110
  • TabularUnified issm/trunk/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp

    r5095 r5154  
    2121        /*Options*/
    2222        BamgOpts bamgopts;
    23         BamgOptsInit(&bamgopts);
    2423
    2524        // read mesh
  • TabularUnified issm/trunk/src/c/objects/Bamg/BamgGeom.cpp

    r5091 r5154  
    22#include "../objects.h"
    33
    4 void BamgGeomInit(BamgGeom* bamggeom){
     4/*Constructors/Destructors*/
     5/*FUNCTION BamgGeom::BamgGeom(){{{1*/
     6BamgGeom::BamgGeom(){
    57
    6         bamggeom->VerticesSize[0]=0,  bamggeom->VerticesSize[1]=0;  bamggeom->Vertices=NULL;
    7         bamggeom->EdgesSize[0]=0,     bamggeom->EdgesSize[1]=0;     bamggeom->Edges=NULL;
    8         bamggeom->hVertices=NULL;
    9         bamggeom->MetricVertices=NULL;
    10         bamggeom->TangentAtEdgesSize[0]=0,    bamggeom->TangentAtEdgesSize[1]=0;    bamggeom->TangentAtEdges=NULL;
    11         bamggeom->CornersSize[0]=0,           bamggeom->CornersSize[1]=0;           bamggeom->Corners=NULL;
    12         bamggeom->RequiredVerticesSize[0]=0,  bamggeom->RequiredVerticesSize[1]=0;  bamggeom->RequiredVertices=NULL;
    13         bamggeom->RequiredEdgesSize[0]=0,     bamggeom->RequiredEdgesSize[1]=0;     bamggeom->RequiredEdges=NULL;
    14         bamggeom->CrackedEdgesSize[0]=0,      bamggeom->CrackedEdgesSize[1]=0;      bamggeom->CrackedEdges=NULL;
    15         bamggeom->SubDomainsSize[0]=0,        bamggeom->SubDomainsSize[1]=0;        bamggeom->SubDomains=NULL;
     8        this->VerticesSize[0]=0,          this->VerticesSize[1]=0;          this->Vertices=NULL;
     9        this->EdgesSize[0]=0,             this->EdgesSize[1]=0;             this->Edges=NULL;
     10        this->hVertices=NULL;
     11        this->MetricVertices=NULL;
     12        this->TangentAtEdgesSize[0]=0,    this->TangentAtEdgesSize[1]=0;    this->TangentAtEdges=NULL;
     13        this->CornersSize[0]=0,           this->CornersSize[1]=0;           this->Corners=NULL;
     14        this->RequiredVerticesSize[0]=0,  this->RequiredVerticesSize[1]=0;  this->RequiredVertices=NULL;
     15        this->RequiredEdgesSize[0]=0,     this->RequiredEdgesSize[1]=0;     this->RequiredEdges=NULL;
     16        this->CrackedEdgesSize[0]=0,      this->CrackedEdgesSize[1]=0;      this->CrackedEdges=NULL;
     17        this->SubDomainsSize[0]=0,        this->SubDomainsSize[1]=0;        this->SubDomains=NULL;
    1618
    1719}
     20/*}}}*/
     21/*FUNCTION BamgGeom::~BamgGeom(){{{1*/
     22BamgGeom::~BamgGeom(){
     23
     24        xfree((void**)&this->Vertices);
     25        xfree((void**)&this->EdgesSize);
     26        xfree((void**)&this->hVertices);
     27        xfree((void**)&this->MetricVertices);
     28        xfree((void**)&this->TangentAtEdges);
     29        xfree((void**)&this->Corners);
     30        xfree((void**)&this->RequiredVertices);
     31        xfree((void**)&this->RequiredEdges);
     32        xfree((void**)&this->CrackedEdges);
     33        xfree((void**)&this->SubDomains);
     34
     35}
     36/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Bamg/BamgGeom.h

    r5091 r5154  
    55#define _BAMGGEOM_H_
    66
    7 struct BamgGeom{
     7class BamgGeom{
    88
    9         int     VerticesSize[2];
    10         double* Vertices;
     9        public:
     10                int     VerticesSize[2];
     11                double* Vertices;
     12                int     EdgesSize[2];
     13                double* Edges;
     14                double* hVertices;
     15                double* MetricVertices;
     16                int     TangentAtEdgesSize[2];
     17                double* TangentAtEdges;
     18                int     CornersSize[2];
     19                double* Corners;
     20                int     RequiredVerticesSize[2];
     21                double* RequiredVertices;
     22                int     RequiredEdgesSize[2];
     23                double* RequiredEdges;
     24                int     CrackedEdgesSize[2];
     25                double* CrackedEdges;
     26                int     SubDomainsSize[2];
     27                double* SubDomains;
    1128
    12         int     EdgesSize[2];
    13         double* Edges;
    14 
    15         double* hVertices;
    16         double* MetricVertices;
    17 
    18         int     TangentAtEdgesSize[2];
    19         double* TangentAtEdges;
    20 
    21         int     CornersSize[2];
    22         double* Corners;
    23 
    24         int     RequiredVerticesSize[2];
    25         double* RequiredVertices;
    26 
    27         int     RequiredEdgesSize[2];
    28         double* RequiredEdges;
    29 
    30         int     CrackedEdgesSize[2];
    31         double* CrackedEdges;
    32 
    33         int     SubDomainsSize[2];
    34         double* SubDomains;
     29                BamgGeom();
     30                ~BamgGeom();
    3531};
    3632
    37 void BamgGeomInit(BamgGeom* bamggeom);
    38 
    3933#endif
  • TabularUnified issm/trunk/src/c/objects/Bamg/BamgMesh.cpp

    r5091 r5154  
    22#include "../objects.h"
    33
    4 void BamgMeshInit(BamgMesh* bamgmesh){
     4/*Constructors/Destructors*/
     5/*FUNCTION BamgMesh::BamgMesh(){{{1*/
     6BamgMesh::BamgMesh(){
    57
    6         bamgmesh->VerticesSize[0]=0,      bamgmesh->VerticesSize[1]=0;       bamgmesh->Vertices=NULL;
    7         bamgmesh->EdgesSize[0]=0,         bamgmesh->EdgesSize[1]=0;          bamgmesh->Edges=NULL;
    8         bamgmesh->TrianglesSize[0]=0,     bamgmesh->TrianglesSize[1]=0;      bamgmesh->Triangles=NULL;
    9         bamgmesh->QuadrilateralsSize[0]=0,bamgmesh->QuadrilateralsSize[1]=0; bamgmesh->Quadrilaterals=NULL;
    10         bamgmesh->VerticesOnGeometricVertexSize[0]=0, bamgmesh->VerticesOnGeometricVertexSize[1]=0;bamgmesh->VerticesOnGeometricVertex=NULL;
    11         bamgmesh->VerticesOnGeometricEdgeSize[0]=0,   bamgmesh->VerticesOnGeometricEdgeSize[1]=0;  bamgmesh->VerticesOnGeometricEdge=NULL;
    12         bamgmesh->EdgesOnGeometricEdgeSize[0]=0,      bamgmesh->EdgesOnGeometricEdgeSize[1]=0;     bamgmesh->EdgesOnGeometricEdge=NULL;
    13         bamgmesh->SubDomainsSize[0]=0,         bamgmesh->SubDomainsSize[1]=0;          bamgmesh->SubDomains=NULL;
    14         bamgmesh->SubDomainsFromGeomSize[0]=0, bamgmesh->SubDomainsFromGeomSize[1]=0;  bamgmesh->SubDomainsFromGeom=NULL;
    15         bamgmesh->hVertices=NULL;
    16         bamgmesh->IssmEdgesSize[0]=0,  bamgmesh->IssmEdgesSize[1]=0;   bamgmesh->IssmEdges=NULL;
    17         bamgmesh->IssmSegmentsSize[0]=0,             bamgmesh->IssmSegmentsSize[1]=0;             bamgmesh->IssmSegments=NULL;
    18         bamgmesh->ElementConnectivitySize[0]=0,      bamgmesh->ElementConnectivitySize[1]=0;      bamgmesh->ElementConnectivity=NULL;
    19         bamgmesh->NodalConnectivitySize[0]=0,        bamgmesh->NodalConnectivitySize[1]=0;        bamgmesh->NodalConnectivity=NULL;
    20         bamgmesh->NodalElementConnectivitySize[0]=0, bamgmesh->NodalElementConnectivitySize[1]=0; bamgmesh->NodalElementConnectivity=NULL;
    21         bamgmesh->CrackedVerticesSize[0]=0, bamgmesh->CrackedVerticesSize[1]=0; bamgmesh->CrackedVertices=NULL;
    22         bamgmesh->CrackedEdgesSize[0]=0, bamgmesh->CrackedEdgesSize[1]=0; bamgmesh->CrackedEdges=NULL;
     8        this->VerticesSize[0]=0,                  this->VerticesSize[1]=0;                 this->Vertices=NULL;
     9        this->EdgesSize[0]=0,                     this->EdgesSize[1]=0;                    this->Edges=NULL;
     10        this->TrianglesSize[0]=0,                 this->TrianglesSize[1]=0;                this->Triangles=NULL;
     11        this->QuadrilateralsSize[0]=0,            this->QuadrilateralsSize[1]=0;           this->Quadrilaterals=NULL;
     12        this->VerticesOnGeometricVertexSize[0]=0, this->VerticesOnGeometricVertexSize[1]=0;this->VerticesOnGeometricVertex=NULL;
     13        this->VerticesOnGeometricEdgeSize[0]=0,   this->VerticesOnGeometricEdgeSize[1]=0;  this->VerticesOnGeometricEdge=NULL;
     14        this->EdgesOnGeometricEdgeSize[0]=0,      this->EdgesOnGeometricEdgeSize[1]=0;     this->EdgesOnGeometricEdge=NULL;
     15        this->SubDomainsSize[0]=0,                this->SubDomainsSize[1]=0;               this->SubDomains=NULL;
     16        this->SubDomainsFromGeomSize[0]=0,        this->SubDomainsFromGeomSize[1]=0;       this->SubDomainsFromGeom=NULL;
     17        this->hVertices=NULL;
     18        this->IssmEdgesSize[0]=0,                 this->IssmEdgesSize[1]=0;                this->IssmEdges=NULL;
     19        this->IssmSegmentsSize[0]=0,              this->IssmSegmentsSize[1]=0;             this->IssmSegments=NULL;
     20        this->ElementConnectivitySize[0]=0,       this->ElementConnectivitySize[1]=0;      this->ElementConnectivity=NULL;
     21        this->NodalConnectivitySize[0]=0,         this->NodalConnectivitySize[1]=0;        this->NodalConnectivity=NULL;
     22        this->NodalElementConnectivitySize[0]=0,  this->NodalElementConnectivitySize[1]=0; this->NodalElementConnectivity=NULL;
     23        this->CrackedVerticesSize[0]=0,           this->CrackedVerticesSize[1]=0;          this->CrackedVertices=NULL;
     24        this->CrackedEdgesSize[0]=0,              this->CrackedEdgesSize[1]=0;             this->CrackedEdges=NULL;
    2325
    2426}
     27/*}}}*/
     28/*FUNCTION BamgMesh::~BamgMesh(){{{1*/
     29BamgMesh::~BamgMesh(){
     30
     31        xfree((void**)this->Vertices);
     32        xfree((void**)this->Edges);
     33        xfree((void**)this->Triangles);
     34        xfree((void**)this->Quadrilaterals);
     35        xfree((void**)this->VerticesOnGeometricVertex);
     36        xfree((void**)this->VerticesOnGeometricEdge);
     37        xfree((void**)this->EdgesOnGeometricEdge);
     38        xfree((void**)this->SubDomains);
     39        xfree((void**)this->SubDomainsFromGeom);
     40        xfree((void**)this->hVertices);
     41        xfree((void**)this->IssmEdges);
     42        xfree((void**)this->IssmSegments);
     43        xfree((void**)this->ElementConnectivity);
     44        xfree((void**)this->NodalConnectivity);
     45        xfree((void**)this->NodalElementConnectivity);
     46        xfree((void**)this->CrackedVertices);
     47        xfree((void**)this->CrackedEdges);
     48
     49}
     50/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Bamg/BamgMesh.h

    r5091 r5154  
    55#define _BAMGMESH_H_
    66
    7 struct BamgMesh{
     7class BamgMesh{
    88
    9         /*Bamg input/output*/
    10         int     VerticesSize[2];
    11         double* Vertices;
     9        public:
    1210
    13         int     EdgesSize[2];
    14         double* Edges;
     11                int     VerticesSize[2];
     12                double* Vertices;
     13                int     EdgesSize[2];
     14                double* Edges;
     15                int     TrianglesSize[2];
     16                double* Triangles;
     17                int     QuadrilateralsSize[2];
     18                double* Quadrilaterals;
     19                int     VerticesOnGeometricVertexSize[2];
     20                double* VerticesOnGeometricVertex;
     21                int     VerticesOnGeometricEdgeSize[2];
     22                double* VerticesOnGeometricEdge;
     23                int     EdgesOnGeometricEdgeSize[2];
     24                double* EdgesOnGeometricEdge;
     25                int     SubDomainsSize[2];
     26                double* SubDomains;
     27                int     SubDomainsFromGeomSize[2];
     28                double* SubDomainsFromGeom;
     29                int     CrackedVerticesSize[2];
     30                double* CrackedVertices;
     31                int     CrackedEdgesSize[2];
     32                double* CrackedEdges;
     33                double* hVertices;
    1534
    16         int     TrianglesSize[2];
    17         double* Triangles;
     35                /*Output for ISSM*/
     36                int     IssmEdgesSize[2];
     37                double* IssmEdges;
     38                int     IssmSegmentsSize[2];
     39                double* IssmSegments;
     40                int     ElementConnectivitySize[2];
     41                double* ElementConnectivity;
     42                int     NodalConnectivitySize[2];
     43                double* NodalConnectivity;
     44                int     NodalElementConnectivitySize[2];
     45                double* NodalElementConnectivity;
    1846
    19         int     QuadrilateralsSize[2];
    20         double* Quadrilaterals;
    21 
    22         int     VerticesOnGeometricVertexSize[2];
    23         double* VerticesOnGeometricVertex;
    24 
    25         int     VerticesOnGeometricEdgeSize[2];
    26         double* VerticesOnGeometricEdge;
    27 
    28         int     EdgesOnGeometricEdgeSize[2];
    29         double* EdgesOnGeometricEdge;
    30 
    31         int     SubDomainsSize[2];
    32         double* SubDomains;
    33 
    34         int     SubDomainsFromGeomSize[2];
    35         double* SubDomainsFromGeom;
    36 
    37         int     CrackedVerticesSize[2];
    38         double* CrackedVertices;
    39 
    40         int     CrackedEdgesSize[2];
    41         double* CrackedEdges;
    42 
    43         double* hVertices;
    44 
    45         /*Output for ISSM*/
    46         int     IssmEdgesSize[2];
    47         double* IssmEdges;
    48 
    49         int     IssmSegmentsSize[2];
    50         double* IssmSegments;
    51 
    52         int     ElementConnectivitySize[2];
    53         double* ElementConnectivity;
    54 
    55         int     NodalConnectivitySize[2];
    56         double* NodalConnectivity;
    57 
    58         int     NodalElementConnectivitySize[2];
    59         double* NodalElementConnectivity;
     47                BamgMesh();
     48                ~BamgMesh();
    6049
    6150};
    6251
    63 void BamgMeshInit(BamgMesh* bamgmesh);
    64 
    6552#endif
  • TabularUnified issm/trunk/src/c/objects/Bamg/BamgOpts.cpp

    r5091 r5154  
    44#include "../objects.h"
    55
    6 void BamgOptsInit(BamgOpts* bamgopts){
     6/*Constructors/Destructors*/
     7/*FUNCTION BamgOpts::BamgOpts() {{{1*/
     8BamgOpts::BamgOpts(){
    79
    8         bamgopts->iso=0;
    9         bamgopts->maxnbv=0;
    10         bamgopts->MaxCornerAngle=0;
    11         bamgopts->Hessiantype=0;
    12         bamgopts->Metrictype=0;
    13         bamgopts->KeepVertices=0;
    14         bamgopts->Crack=0;
    15         bamgopts->maxsubdiv=0;
    16         bamgopts->power=0;
    17         bamgopts->anisomax=0;
    18         bamgopts->nbsmooth=0;
    19         bamgopts->nbjacobi=0;
    20         bamgopts->omega=0;
    21         bamgopts->hmin=0;
    22         bamgopts->hmax=0;
    23         bamgopts->hminVertices=NULL;
    24         bamgopts->hmaxVertices=NULL;
    25         bamgopts->gradation=0;
    26         bamgopts->cutoff=0;
    27         bamgopts->splitcorners=0;
    28         bamgopts->geometricalmetric=0;
    29         bamgopts->verbose=0;
    30         bamgopts->err=NULL;
    31         bamgopts->errg=0;
    32         bamgopts->coeff=0;
    33         bamgopts->metric=NULL;
    34         bamgopts->field=NULL;
    35         bamgopts->numfields=0;
     10        this->iso=0;
     11        this->maxnbv=0;
     12        this->MaxCornerAngle=0;
     13        this->Hessiantype=0;
     14        this->Metrictype=0;
     15        this->KeepVertices=0;
     16        this->Crack=0;
     17        this->maxsubdiv=0;
     18        this->power=0;
     19        this->anisomax=0;
     20        this->nbsmooth=0;
     21        this->nbjacobi=0;
     22        this->omega=0;
     23        this->hmin=0;
     24        this->hmax=0;
     25        this->hminVertices=NULL;
     26        this->hmaxVertices=NULL;
     27        this->gradation=0;
     28        this->cutoff=0;
     29        this->splitcorners=0;
     30        this->geometricalmetric=0;
     31        this->verbose=0;
     32        this->err=NULL;
     33        this->errg=0;
     34        this->coeff=0;
     35        this->metric=NULL;
     36        this->field=NULL;
     37        this->numfields=0;
    3638
    3739}
     40/*}}}*/
     41/*FUNCTION BamgOpts::~BamgOpts() {{{1*/
     42BamgOpts::~BamgOpts(){
    3843
    39 void BamgOptsCheck(BamgOpts* bamgopts){
     44        xfree((void**)&this->hminVertices);
     45        xfree((void**)&this->hmaxVertices);
     46        xfree((void**)&this->err);
     47        xfree((void**)&this->metric);
     48        xfree((void**)&this->field);
     49
     50}
     51/*}}}*/
     52
     53/*Methods*/
     54/*FUNCTION BamgOpts::Check{{{1*/
     55void BamgOpts::Check(void){
    4056
    4157        int i;
    4258
    43         if (bamgopts->coeff==0) ISSMERROR("'coeff' should be positive");
    44         if (bamgopts->maxsubdiv<=1) ISSMERROR("'maxsubdiv' should be >1");
    45         if (bamgopts->Crack!=0  && bamgopts->Crack!=1) ISSMERROR("'Crack' supported options are 0 and 1");
    46         if (bamgopts->Hessiantype!=0  && bamgopts->Hessiantype!=1) ISSMERROR("'Hessiantype' supported options are 0 and 1");
    47         if (bamgopts->Metrictype!=0   && bamgopts->Metrictype!=1 && bamgopts->Metrictype!=2) ISSMERROR("'Metrictype' supported options are 0, 1 and 2");
    48         if (bamgopts->KeepVertices!=0 && bamgopts->KeepVertices!=1) ISSMERROR("'KeepVertices' supported options are 0 and 1");
    49         if (bamgopts->errg<0) ISSMERROR("'errg' option should be >0");
    50         if (bamgopts->nbjacobi<=0) ISSMERROR("'nbjacobi' option should be >0");
    51         if (bamgopts->geometricalmetric!=0  && bamgopts->geometricalmetric!=1) ISSMERROR("'geometricalmetric' supported options are 0 and 1");
    52         if (bamgopts->nbsmooth<=0) ISSMERROR("'nbsmooth' option should be >0");
    53         if (bamgopts->maxnbv<3) ISSMERROR("'maxnbv' option should be >3");
    54         if (bamgopts->hmin<=0) ISSMERROR("'hmin' option should be >0");
    55         if (bamgopts->hmax<=0 || bamgopts->hmax<bamgopts->hmin) ISSMERROR("'hmax' option should be between 0 and hmin=%g",bamgopts->hmin);
    56         if (bamgopts->anisomax<1) ISSMERROR("'anisomax' option should be >=1");
    57         if (bamgopts->gradation<1) ISSMERROR("'gradation' option should be >=1");
    58         for (i=0;i<bamgopts->numfields;i++) {if (bamgopts->err[i]<=0) ISSMERROR("'err' option should be >0");};
     59        if (this->coeff==0) ISSMERROR("'coeff' should be positive");
     60        if (this->maxsubdiv<=1) ISSMERROR("'maxsubdiv' should be >1");
     61        if (this->Crack!=0  && this->Crack!=1) ISSMERROR("'Crack' supported options are 0 and 1");
     62        if (this->Hessiantype!=0  && this->Hessiantype!=1) ISSMERROR("'Hessiantype' supported options are 0 and 1");
     63        if (this->Metrictype!=0   && this->Metrictype!=1 && this->Metrictype!=2) ISSMERROR("'Metrictype' supported options are 0, 1 and 2");
     64        if (this->KeepVertices!=0 && this->KeepVertices!=1) ISSMERROR("'KeepVertices' supported options are 0 and 1");
     65        if (this->errg<0) ISSMERROR("'errg' option should be >0");
     66        if (this->nbjacobi<=0) ISSMERROR("'nbjacobi' option should be >0");
     67        if (this->geometricalmetric!=0  && this->geometricalmetric!=1) ISSMERROR("'geometricalmetric' supported options are 0 and 1");
     68        if (this->nbsmooth<=0) ISSMERROR("'nbsmooth' option should be >0");
     69        if (this->maxnbv<3) ISSMERROR("'maxnbv' option should be >3");
     70        if (this->hmin<=0) ISSMERROR("'hmin' option should be >0");
     71        if (this->hmax<=0 || this->hmax<this->hmin) ISSMERROR("'hmax' option should be between 0 and hmin=%g",this->hmin);
     72        if (this->anisomax<1) ISSMERROR("'anisomax' option should be >=1");
     73        if (this->gradation<1) ISSMERROR("'gradation' option should be >=1");
     74        for (i=0;i<this->numfields;i++) {if (this->err[i]<=0) ISSMERROR("'err' option should be >0");};
    5975
    6076}
     77/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Bamg/BamgOpts.h

    r5091 r5154  
    66#define _BAMGOPTS_H_
    77
    8 struct BamgOpts{
     8class BamgOpts{
    99
    10         int     iso;
    11         int     maxnbv;
    12         double  MaxCornerAngle;
    13         int     Crack;
    14         int     Hessiantype;
    15         int     Metrictype;
    16         int     KeepVertices;
    17         double  maxsubdiv;
    18         double  power;
    19         double  anisomax;
    20         int     nbsmooth;
    21         int     nbjacobi;
    22         double  omega;
    23         double  hmin;
    24         double  hmax;
    25         double* hminVertices;
    26         double* hmaxVertices;
    27         double  gradation;
    28         double  cutoff;
    29         int     splitcorners;
    30         int     geometricalmetric;
    31         int     verbose;
    32         double* err;
    33         double  errg;
    34         double  coeff;
    35         double* metric;
    36         double* field;
    37         int     numfields;
     10        public:
     11
     12                int     iso;
     13                int     maxnbv;
     14                double  MaxCornerAngle;
     15                int     Crack;
     16                int     Hessiantype;
     17                int     Metrictype;
     18                int     KeepVertices;
     19                double  maxsubdiv;
     20                double  power;
     21                double  anisomax;
     22                int     nbsmooth;
     23                int     nbjacobi;
     24                double  omega;
     25                double  hmin;
     26                double  hmax;
     27                double* hminVertices;
     28                double* hmaxVertices;
     29                double  gradation;
     30                double  cutoff;
     31                int     splitcorners;
     32                int     geometricalmetric;
     33                int     verbose;
     34                double* err;
     35                double  errg;
     36                double  coeff;
     37                double* metric;
     38                double* field;
     39                int     numfields;
     40
     41                BamgOpts();
     42                ~BamgOpts();
     43
     44                void Check(void);
    3845
    3946};
    40 
    41 void BamgOptsInit(BamgOpts* bamgopts);
    42 
    43 void BamgOptsCheck(BamgOpts* bamgopts);
    44 
    4547#endif
  • TabularUnified issm/trunk/src/c/objects/Bamg/Geometry.cpp

    r5149 r5154  
    290290                /*Get options*/
    291291                verbose=bamgopts->verbose;
    292 
    293                 /*Initialize output*/
    294                 BamgGeomInit(bamggeom);
    295292
    296293                /*Vertices*/
  • TabularUnified issm/trunk/src/c/objects/Bamg/Mesh.cpp

    r5150 r5154  
    528528                /*Get options*/
    529529                int verbose=bamgopts->verbose;
    530 
    531                 /*Initialize output*/
    532                 BamgMeshInit(bamgmesh);
    533530
    534531                /*Build reft that holds the number the subdomain number of each triangle, and the real numbering of the elements*/
  • TabularUnified issm/trunk/src/m/solvers/solver_linear.m

    r5057 r5154  
    2121        %Solve 
    2222        u_f=Solver(K_ff,p_f,[],femmodel.parameters);
     23        size(u_f)
     24        error
    2325       
    2426        %Merge back to g set
  • TabularUnified issm/trunk/src/mex/Bamg/Bamg.cpp

    r5092 r5154  
    1313        int   i;
    1414        int   lines,cols;
    15         BamgOpts bamgopts;
    16         BamgMesh bamgmesh_in,bamgmesh_out;
    17         BamgGeom bamggeom_in,bamggeom_out;
     15        BamgOpts *bamgopts=NULL;
     16        BamgMesh *bamgmesh_in=NULL;
     17        BamgGeom *bamggeom_in=NULL;
     18        BamgMesh *bamgmesh_out=NULL;
     19        BamgGeom *bamggeom_out=NULL;
    1820
    1921        /*Boot module: */
     
    2325        CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&BamgUsage);
    2426
     27        /*Initialize variables*/
     28        bamgopts=new BamgOpts;
     29        bamggeom_in=new BamgGeom;
     30        bamgmesh_in=new BamgMesh;
     31        bamggeom_out=new BamgGeom;
     32        bamgmesh_out=new BamgMesh;
     33
    2534        /*create bamg geometry input*/
    26         BamgGeomInit(&bamggeom_in);
    27         FetchData(&bamggeom_in.Vertices,        &bamggeom_in.VerticesSize[0],        &bamggeom_in.VerticesSize[1],        mxGetField(BAMGGEOMETRY,0,"Vertices"));
    28         FetchData(&bamggeom_in.Edges,           &bamggeom_in.EdgesSize[0],           &bamggeom_in.EdgesSize[1],           mxGetField(BAMGGEOMETRY,0,"Edges"));
    29         FetchData(&bamggeom_in.Corners,         &bamggeom_in.CornersSize[0],         &bamggeom_in.CornersSize[1],         mxGetField(BAMGGEOMETRY,0,"Corners"));
    30         FetchData(&bamggeom_in.RequiredVertices,&bamggeom_in.RequiredVerticesSize[0],&bamggeom_in.RequiredVerticesSize[1],mxGetField(BAMGGEOMETRY,0,"RequiredVertices"));
    31         FetchData(&bamggeom_in.RequiredEdges,   &bamggeom_in.RequiredEdgesSize[0],   &bamggeom_in.RequiredEdgesSize[1],   mxGetField(BAMGGEOMETRY,0,"RequiredEdges"));
    32         FetchData(&bamggeom_in.CrackedEdges,    &bamggeom_in.CrackedEdgesSize[0],    &bamggeom_in.CrackedEdgesSize[1],    mxGetField(BAMGGEOMETRY,0,"CrackedEdges"));
    33         FetchData(&bamggeom_in.SubDomains,      &bamggeom_in.SubDomainsSize[0],      &bamggeom_in.SubDomainsSize[1],      mxGetField(BAMGGEOMETRY,0,"SubDomains"));
    34         FetchData(&bamggeom_in.hVertices,&lines,&cols,mxGetField(BAMGGEOMETRY,0,"hVertices"));
    35         if (bamggeom_in.hVertices && (cols!=1 || lines!=bamggeom_in.VerticesSize[0])){ISSMERROR("the size of 'hVertices' should be [%i %i]",bamggeom_in.VerticesSize[0],1);}
     35        FetchData(&bamggeom_in->Vertices,        &bamggeom_in->VerticesSize[0],        &bamggeom_in->VerticesSize[1],        mxGetField(BAMGGEOMETRY,0,"Vertices"));
     36        FetchData(&bamggeom_in->Edges,           &bamggeom_in->EdgesSize[0],           &bamggeom_in->EdgesSize[1],           mxGetField(BAMGGEOMETRY,0,"Edges"));
     37        FetchData(&bamggeom_in->Corners,         &bamggeom_in->CornersSize[0],         &bamggeom_in->CornersSize[1],         mxGetField(BAMGGEOMETRY,0,"Corners"));
     38        FetchData(&bamggeom_in->RequiredVertices,&bamggeom_in->RequiredVerticesSize[0],&bamggeom_in->RequiredVerticesSize[1],mxGetField(BAMGGEOMETRY,0,"RequiredVertices"));
     39        FetchData(&bamggeom_in->RequiredEdges,   &bamggeom_in->RequiredEdgesSize[0],   &bamggeom_in->RequiredEdgesSize[1],   mxGetField(BAMGGEOMETRY,0,"RequiredEdges"));
     40        FetchData(&bamggeom_in->CrackedEdges,    &bamggeom_in->CrackedEdgesSize[0],    &bamggeom_in->CrackedEdgesSize[1],    mxGetField(BAMGGEOMETRY,0,"CrackedEdges"));
     41        FetchData(&bamggeom_in->SubDomains,      &bamggeom_in->SubDomainsSize[0],      &bamggeom_in->SubDomainsSize[1],      mxGetField(BAMGGEOMETRY,0,"SubDomains"));
     42        FetchData(&bamggeom_in->hVertices,&lines,&cols,mxGetField(BAMGGEOMETRY,0,"hVertices"));
     43        if (bamggeom_in->hVertices && (cols!=1 || lines!=bamggeom_in->VerticesSize[0])){ISSMERROR("the size of 'hVertices' should be [%i %i]",bamggeom_in->VerticesSize[0],1);}
    3644
    3745        /*create bamg mesh input*/
    38         BamgMeshInit(&bamgmesh_in);
    39         FetchData(&bamgmesh_in.Triangles,&bamgmesh_in.TrianglesSize[0],&bamgmesh_in.TrianglesSize[1],mxGetField(BAMGMESH,0,"Triangles"));
    40         FetchData(&bamgmesh_in.Vertices, &bamgmesh_in.VerticesSize[0], &bamgmesh_in.VerticesSize[1], mxGetField(BAMGMESH,0,"Vertices"));
    41         FetchData(&bamgmesh_in.Edges,    &bamgmesh_in.EdgesSize[0],    &bamgmesh_in.EdgesSize[1],    mxGetField(BAMGMESH,0,"Edges"));
    42         FetchData(&bamgmesh_in.IssmSegments, &bamgmesh_in.IssmSegmentsSize[0], &bamgmesh_in.IssmSegmentsSize[1], mxGetField(BAMGMESH,0,"IssmSegments"));
    43         FetchData(&bamgmesh_in.CrackedEdges,&bamgmesh_in.CrackedEdgesSize[0],&bamgmesh_in.CrackedEdgesSize[1],mxGetField(BAMGMESH,0,"CrackedEdges"));
    44         FetchData(&bamgmesh_in.EdgesOnGeometricEdge,&bamgmesh_in.EdgesOnGeometricEdgeSize[0],&bamgmesh_in.EdgesOnGeometricEdgeSize[1],mxGetField(BAMGMESH,0,"EdgesOnGeometricEdge"));
    45         FetchData(&bamgmesh_in.VerticesOnGeometricEdge,&bamgmesh_in.VerticesOnGeometricEdgeSize[0],&bamgmesh_in.VerticesOnGeometricEdgeSize[1],mxGetField(BAMGMESH,0,"VerticesOnGeometricEdge"));
    46         FetchData(&bamgmesh_in.VerticesOnGeometricVertex,&bamgmesh_in.VerticesOnGeometricVertexSize[0],&bamgmesh_in.VerticesOnGeometricVertexSize[1],mxGetField(BAMGMESH,0,"VerticesOnGeometricVertex"));
    47         FetchData(&bamgmesh_in.hVertices,&lines,&cols,mxGetField(BAMGMESH,0,"hVertices"));
    48         if (bamgmesh_in.hVertices && (cols!=1 || lines!=bamgmesh_in.VerticesSize[0])){ISSMERROR("the size of 'hVertices' should be [%i %i]",bamgmesh_in.VerticesSize[0],1);}
     46        FetchData(&bamgmesh_in->Triangles,&bamgmesh_in->TrianglesSize[0],&bamgmesh_in->TrianglesSize[1],mxGetField(BAMGMESH,0,"Triangles"));
     47        FetchData(&bamgmesh_in->Vertices, &bamgmesh_in->VerticesSize[0], &bamgmesh_in->VerticesSize[1], mxGetField(BAMGMESH,0,"Vertices"));
     48        FetchData(&bamgmesh_in->Edges,    &bamgmesh_in->EdgesSize[0],    &bamgmesh_in->EdgesSize[1],    mxGetField(BAMGMESH,0,"Edges"));
     49        FetchData(&bamgmesh_in->IssmSegments, &bamgmesh_in->IssmSegmentsSize[0], &bamgmesh_in->IssmSegmentsSize[1], mxGetField(BAMGMESH,0,"IssmSegments"));
     50        FetchData(&bamgmesh_in->CrackedEdges,&bamgmesh_in->CrackedEdgesSize[0],&bamgmesh_in->CrackedEdgesSize[1],mxGetField(BAMGMESH,0,"CrackedEdges"));
     51        FetchData(&bamgmesh_in->EdgesOnGeometricEdge,&bamgmesh_in->EdgesOnGeometricEdgeSize[0],&bamgmesh_in->EdgesOnGeometricEdgeSize[1],mxGetField(BAMGMESH,0,"EdgesOnGeometricEdge"));
     52        FetchData(&bamgmesh_in->VerticesOnGeometricEdge,&bamgmesh_in->VerticesOnGeometricEdgeSize[0],&bamgmesh_in->VerticesOnGeometricEdgeSize[1],mxGetField(BAMGMESH,0,"VerticesOnGeometricEdge"));
     53        FetchData(&bamgmesh_in->VerticesOnGeometricVertex,&bamgmesh_in->VerticesOnGeometricVertexSize[0],&bamgmesh_in->VerticesOnGeometricVertexSize[1],mxGetField(BAMGMESH,0,"VerticesOnGeometricVertex"));
     54        FetchData(&bamgmesh_in->hVertices,&lines,&cols,mxGetField(BAMGMESH,0,"hVertices"));
     55        if (bamgmesh_in->hVertices && (cols!=1 || lines!=bamgmesh_in->VerticesSize[0])){ISSMERROR("the size of 'hVertices' should be [%i %i]",bamgmesh_in->VerticesSize[0],1);}
    4956
    5057        /*create bamg options input*/
    51         BamgOptsInit(&bamgopts);
    52         FetchData(&bamgopts.coeff,mxGetField(BAMGOPTIONS,0,"coeff"));
    53         FetchData(&bamgopts.maxsubdiv,mxGetField(BAMGOPTIONS,0,"maxsubdiv"));
    54         FetchData(&bamgopts.Crack,mxGetField(BAMGOPTIONS,0,"Crack"));
    55         FetchData(&bamgopts.Hessiantype,mxGetField(BAMGOPTIONS,0,"Hessiantype"));
    56         FetchData(&bamgopts.Metrictype,mxGetField(BAMGOPTIONS,0,"Metrictype"));
    57         FetchData(&bamgopts.KeepVertices,mxGetField(BAMGOPTIONS,0,"KeepVertices"));
    58         FetchData(&bamgopts.power,mxGetField(BAMGOPTIONS,0,"power"));
    59         FetchData(&bamgopts.errg,mxGetField(BAMGOPTIONS,0,"errg"));
    60         FetchData(&bamgopts.nbjacobi,mxGetField(BAMGOPTIONS,0,"nbjacobi"));
    61         FetchData(&bamgopts.nbsmooth,mxGetField(BAMGOPTIONS,0,"nbsmooth"));
    62         FetchData(&bamgopts.omega,mxGetField(BAMGOPTIONS,0,"omega"));
    63         FetchData(&bamgopts.maxnbv,mxGetField(BAMGOPTIONS,0,"maxnbv"));
    64         FetchData(&bamgopts.hmin,mxGetField(BAMGOPTIONS,0,"hmin"));
    65         FetchData(&bamgopts.hmax,mxGetField(BAMGOPTIONS,0,"hmax"));
    66         FetchData(&bamgopts.anisomax,mxGetField(BAMGOPTIONS,0,"anisomax"));
    67         FetchData(&bamgopts.gradation,mxGetField(BAMGOPTIONS,0,"gradation"));
    68         FetchData(&bamgopts.cutoff,mxGetField(BAMGOPTIONS,0,"cutoff"));
    69         FetchData(&bamgopts.verbose,mxGetField(BAMGOPTIONS,0,"verbose"));
    70         FetchData(&bamgopts.splitcorners,mxGetField(BAMGOPTIONS,0,"splitcorners"));
    71         FetchData(&bamgopts.geometricalmetric,mxGetField(BAMGOPTIONS,0,"geometricalmetric"));
    72         FetchData(&bamgopts.MaxCornerAngle,mxGetField(BAMGOPTIONS,0,"MaxCornerAngle"));
    73         FetchData(&bamgopts.hminVertices,&lines,&cols,mxGetField(BAMGOPTIONS,0,"hminVertices"));
    74         if (bamgopts.hminVertices && (cols!=1 || lines!=bamgmesh_in.VerticesSize[0])){ISSMERROR("the size of 'hminVertices' should be [%i %i]",bamgmesh_in.VerticesSize[0],1);}
    75         FetchData(&bamgopts.hmaxVertices,&lines,&cols,mxGetField(BAMGOPTIONS,0,"hmaxVertices"));
    76         if (bamgopts.hmaxVertices && (cols!=1 || lines!=bamgmesh_in.VerticesSize[0])){ISSMERROR("the size of 'hmaxVertices' should be [%i %i]",bamgmesh_in.VerticesSize[0],1);}
    77         FetchData(&bamgopts.metric,&lines,&cols,mxGetField(BAMGOPTIONS,0,"metric"));
    78         if (bamgopts.metric && (cols!=3 || lines!=bamgmesh_in.VerticesSize[0])){ISSMERROR("the size of 'metric' should be [%i %i]",bamgmesh_in.VerticesSize[0],3);}
    79         FetchData(&bamgopts.field,&lines,&bamgopts.numfields,mxGetField(BAMGOPTIONS,0,"field"));
    80         if (bamgopts.field && lines!=bamgmesh_in.VerticesSize[0]){ISSMERROR("the size of 'field' should be [%i %i]",bamgmesh_in.VerticesSize[0],bamgopts.numfields);}
    81         FetchData(&bamgopts.err,NULL,&cols,mxGetField(BAMGOPTIONS,0,"err"));
    82         if (bamgopts.numfields!=0 && cols!=bamgopts.numfields){ISSMERROR("the size of 'err' should be the same as 'field'");}
    83         BamgOptsCheck(&bamgopts);
     58        FetchData(&bamgopts->coeff,mxGetField(BAMGOPTIONS,0,"coeff"));
     59        FetchData(&bamgopts->maxsubdiv,mxGetField(BAMGOPTIONS,0,"maxsubdiv"));
     60        FetchData(&bamgopts->Crack,mxGetField(BAMGOPTIONS,0,"Crack"));
     61        FetchData(&bamgopts->Hessiantype,mxGetField(BAMGOPTIONS,0,"Hessiantype"));
     62        FetchData(&bamgopts->Metrictype,mxGetField(BAMGOPTIONS,0,"Metrictype"));
     63        FetchData(&bamgopts->KeepVertices,mxGetField(BAMGOPTIONS,0,"KeepVertices"));
     64        FetchData(&bamgopts->power,mxGetField(BAMGOPTIONS,0,"power"));
     65        FetchData(&bamgopts->errg,mxGetField(BAMGOPTIONS,0,"errg"));
     66        FetchData(&bamgopts->nbjacobi,mxGetField(BAMGOPTIONS,0,"nbjacobi"));
     67        FetchData(&bamgopts->nbsmooth,mxGetField(BAMGOPTIONS,0,"nbsmooth"));
     68        FetchData(&bamgopts->omega,mxGetField(BAMGOPTIONS,0,"omega"));
     69        FetchData(&bamgopts->maxnbv,mxGetField(BAMGOPTIONS,0,"maxnbv"));
     70        FetchData(&bamgopts->hmin,mxGetField(BAMGOPTIONS,0,"hmin"));
     71        FetchData(&bamgopts->hmax,mxGetField(BAMGOPTIONS,0,"hmax"));
     72        FetchData(&bamgopts->anisomax,mxGetField(BAMGOPTIONS,0,"anisomax"));
     73        FetchData(&bamgopts->gradation,mxGetField(BAMGOPTIONS,0,"gradation"));
     74        FetchData(&bamgopts->cutoff,mxGetField(BAMGOPTIONS,0,"cutoff"));
     75        FetchData(&bamgopts->verbose,mxGetField(BAMGOPTIONS,0,"verbose"));
     76        FetchData(&bamgopts->splitcorners,mxGetField(BAMGOPTIONS,0,"splitcorners"));
     77        FetchData(&bamgopts->geometricalmetric,mxGetField(BAMGOPTIONS,0,"geometricalmetric"));
     78        FetchData(&bamgopts->MaxCornerAngle,mxGetField(BAMGOPTIONS,0,"MaxCornerAngle"));
     79        FetchData(&bamgopts->hminVertices,&lines,&cols,mxGetField(BAMGOPTIONS,0,"hminVertices"));
     80        if (bamgopts->hminVertices && (cols!=1 || lines!=bamgmesh_in->VerticesSize[0])){ISSMERROR("the size of 'hminVertices' should be [%i %i]",bamgmesh_in->VerticesSize[0],1);}
     81        FetchData(&bamgopts->hmaxVertices,&lines,&cols,mxGetField(BAMGOPTIONS,0,"hmaxVertices"));
     82        if (bamgopts->hmaxVertices && (cols!=1 || lines!=bamgmesh_in->VerticesSize[0])){ISSMERROR("the size of 'hmaxVertices' should be [%i %i]",bamgmesh_in->VerticesSize[0],1);}
     83        FetchData(&bamgopts->metric,&lines,&cols,mxGetField(BAMGOPTIONS,0,"metric"));
     84        if (bamgopts->metric && (cols!=3 || lines!=bamgmesh_in->VerticesSize[0])){ISSMERROR("the size of 'metric' should be [%i %i]",bamgmesh_in->VerticesSize[0],3);}
     85        FetchData(&bamgopts->field,&lines,&bamgopts->numfields,mxGetField(BAMGOPTIONS,0,"field"));
     86        if (bamgopts->field && lines!=bamgmesh_in->VerticesSize[0]){ISSMERROR("the size of 'field' should be [%i %i]",bamgmesh_in->VerticesSize[0],bamgopts->numfields);}
     87        FetchData(&bamgopts->err,NULL,&cols,mxGetField(BAMGOPTIONS,0,"err"));
     88        if (bamgopts->numfields!=0 && cols!=bamgopts->numfields){ISSMERROR("the size of 'err' should be the same as 'field'");}
     89        bamgopts->Check();
    8490
    8591        /*!Generate internal degree of freedom numbers: */
    86         Bamgx(&bamgmesh_out,&bamggeom_out,&bamgmesh_in,&bamggeom_in,&bamgopts);
     92        Bamgx(bamgmesh_out,bamggeom_out,bamgmesh_in,bamggeom_in,bamgopts);
    8793
    8894        /*Generate output Matlab Structures*/
    89         WriteData(&bamgmesh_mat,&bamgmesh_out);
    90         WriteData(&bamggeom_mat,&bamggeom_out);
     95        WriteData(&bamgmesh_mat,bamgmesh_out);
     96        WriteData(&bamggeom_mat,bamggeom_out);
    9197
    9298        /*assign output datasets: */
  • TabularUnified issm/trunk/src/mex/BamgConvertMesh/BamgConvertMesh.cpp

    r3558 r5154  
    1616
    1717        /*Output*/
    18         BamgMesh bamgmesh;
    19         BamgGeom bamggeom;
     18        BamgMesh* bamgmesh=NULL;
     19        BamgGeom* bamggeom=NULL;
    2020        mxArray* bamgmesh_mat=NULL;
    2121        mxArray* bamggeom_mat=NULL;
     
    3131        /*checks on arguments on the matlab side: */
    3232        CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&BamgConvertMeshUsage);
     33
     34        /*Initialize variables*/
     35        bamggeom=new BamgGeom;
     36        bamgmesh=new BamgMesh;
    3337
    3438        /*Input datasets: */
     
    5761        /* Run core computations: */
    5862        if (verbose) printf("Call core\n");
    59         BamgConvertMeshx(&bamgmesh,&bamggeom,index,x,y,nods,nels);
     63        BamgConvertMeshx(bamgmesh,bamggeom,index,x,y,nods,nels);
    6064
    6165        /*Generate output Matlab Structures*/
    62         WriteData(&bamgmesh_mat,&bamgmesh);
    63         WriteData(&bamggeom_mat,&bamggeom);
     66        WriteData(&bamgmesh_mat,bamgmesh);
     67        WriteData(&bamggeom_mat,bamggeom);
    6468
    6569        /*assign output datasets: */
Note: See TracChangeset for help on using the changeset viewer.