Changeset 15372


Ignore:
Timestamp:
06/30/13 17:32:20 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW:merged PentaHook and TriaHook into ElementHook

Location:
issm/trunk-jpl/src/c
Files:
2 deleted
8 edited
2 moved

Legend:

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

    r15298 r15372  
    7777                                        ./classes/Elements/Elements.h\
    7878                                        ./classes/Elements/Elements.cpp\
     79                                        ./classes/Elements/ElementHook.h\
     80                                        ./classes/Elements/ElementHook.cpp\
    7981                                        ./classes/Elements/Tria.h\
    8082                                        ./classes/Elements/Tria.cpp\
    81                                         ./classes/Elements/TriaHook.h\
    82                                         ./classes/Elements/TriaHook.cpp\
    8383                                        ./classes/Elements/TriaRef.h\
    8484                                        ./classes/Elements/TriaRef.cpp\
     
    537537                                     ./classes/Elements/Penta.h\
    538538                                     ./classes/Elements/Penta.cpp\
    539                                      ./classes/Elements/PentaHook.h\
    540                                      ./classes/Elements/PentaHook.cpp\
    541539                                     ./classes/Elements/PentaRef.h\
    542540                                     ./classes/Elements/PentaRef.cpp
  • issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp

    r15364 r15372  
    1 /*!\file PentaHook.c
    2  * \brief: implementation of the PentaHook object
     1/*!\file ElementHook.c
     2 * \brief: implementation of the ElementHook object
    33 */
    44
     
    1616
    1717/*Object constructors and destructor*/
    18 /*FUNCTION PentaHook::PentaHook(){{{*/
    19 PentaHook::PentaHook(){
     18/*FUNCTION ElementHook::ElementHook(){{{*/
     19ElementHook::ElementHook(){
    2020        numanalyses=UNDEF;
    2121        this->hnodes     = NULL;
     
    2626}
    2727/*}}}*/
    28 /*FUNCTION PentaHook::~PentaHook(){{{*/
    29 PentaHook::~PentaHook(){
     28/*FUNCTION ElementHook::~ElementHook(){{{*/
     29ElementHook::~ElementHook(){
    3030
    3131        int i;
     
    4141}
    4242/*}}}*/
    43 /*FUNCTION PentaHook::PentaHook(int in_numanalyses,int element_id, int matpar_id){{{*/
    44 PentaHook::PentaHook(int in_numanalyses,int element_id, IoModel* iomodel){
     43/*FUNCTION ElementHook::ElementHook(int in_numanalyses,int element_id, int numvertices,IoModel* iomodel){{{*/
     44ElementHook::ElementHook(int in_numanalyses,int element_id,int numvertices,IoModel* iomodel){
    4545
    4646        /*intermediary: */
    4747        int matpar_id;
    4848        int material_id;
    49         int penta_vertex_ids[6];
    5049
    5150        /*retrieve material_id: */
    5251        iomodel->Constant(&matpar_id,MeshNumberofelementsEnum); matpar_id++;
    5352
    54         /*retrive material_id*/
     53        /*retrieve material_id*/
    5554        material_id = element_id;
    5655
    5756        /*retrieve vertices ids*/
    58         for(int i=0;i<6;i++){
    59                 penta_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[6*(element_id-1)+i]);
     57        int* vertex_ids = xNew<int>(numvertices);
     58        for(int i=0;i<numvertices;i++){
     59                vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[(element_id-1)*numvertices+i]);
    6060        }
    6161
    6262        this->numanalyses = in_numanalyses;
    6363        this->hnodes      = new Hook*[in_numanalyses];
    64         this->hvertices   = new Hook(&penta_vertex_ids[0],6);
     64        this->hvertices   = new Hook(&vertex_ids[0],numvertices);
    6565        this->hmaterial   = new Hook(&material_id,1);
    6666        this->hmatpar     = new Hook(&matpar_id,1);
    6767        this->hneighbors  = NULL;
    6868
    69         //Initialize hnodes as NULL
     69        /*Initialize hnodes as NULL*/
    7070        for(int i=0;i<this->numanalyses;i++){
    7171                this->hnodes[i]=NULL;
    7272        }
    7373
     74        /*Clean up*/
     75        xDelete<int>(vertex_ids);
     76
    7477}
    7578/*}}}*/
    7679
    77 /*FUNCTION PentaHook::SetHookNodes{{{*/
    78 void PentaHook::SetHookNodes(int* node_ids,int analysis_counter){
    79         this->hnodes[analysis_counter]= new Hook(node_ids,6);
     80/*FUNCTION ElementHook::SetHookNodes{{{*/
     81void ElementHook::SetHookNodes(int* node_ids,int numnodes,int analysis_counter){
     82        this->hnodes[analysis_counter]= new Hook(node_ids,numnodes);
    8083}
    8184/*}}}*/
    82 /*FUNCTION PentaHook::InitHookNeighbors{{{*/
    83 void PentaHook::InitHookNeighbors(int* element_ids){
     85/*FUNCTION ElementHook::InitHookNeighbors{{{*/
     86void ElementHook::InitHookNeighbors(int* element_ids){
    8487        this->hneighbors=new Hook(element_ids,2);
    85 
    8688}
    8789/*}}}*/
    88 /*FUNCTION PentaHook::SpawnTriaHook{{{*/
    89 void PentaHook::SpawnTriaHook(TriaHook* triahook,int* indices){
     90/*FUNCTION ElementHook::SpawnTriaHook{{{*/
     91void ElementHook::SpawnTriaHook(ElementHook* triahook,int* indices){
    9092
    9193        int i;
  • issm/trunk-jpl/src/c/classes/Elements/ElementHook.h

    r15364 r15372  
    1 /*!\file: PentaHook.h
    2  * \brief prototypes for PentaHook.h
     1/*!\file: ElementHook.h
     2 * \brief prototypes for ElementHook.h
    33 */
    44
    5 #ifndef _PENTAHOOK_H_
    6 #define  _PENTAHOOK_H_
     5#ifndef _ELEMENTHOOK_H_
     6#define _ELEMENTHOOK_H_
    77
    88class Hook;
    9 class TriaHook;
    109class IoModel;
    1110
    12 class PentaHook{
     11class ElementHook{
    1312
    1413        public:
    1514                int    numanalyses;   //number of analysis types
    1615                Hook **hnodes;        // set of nodes for each analysis type
    17                 Hook  *hvertices;     // 6 vertices for each analysis type
     16                Hook  *hvertices;     // vertices
    1817                Hook  *hmaterial;     // 1 ice material
    1918                Hook  *hmatpar;       // 1 material parameter
    20                 Hook  *hneighbors;    // 2 elements, first down, second up
     19                Hook  *hneighbors;    // 2 elements, first down, second up in 3d only
    2120
    2221                /*constructors, destructors*/
    23                 PentaHook();
    24                 PentaHook(int in_numanalyses,int material_id, IoModel* iomodel);
    25                 ~PentaHook();
     22                ElementHook();
     23                ElementHook(int in_numanalyses,int material_id,int numvertices,IoModel* iomodel);
     24                ~ElementHook();
    2625
    27                 void SetHookNodes(int* node_ids,int analysis_counter);
    28                 void SpawnTriaHook(TriaHook* triahook,int* indices);
    29                 void InitHookNeighbors(int* element_ids);
     26                void SetHookNodes(int* node_ids,int numnodes,int analysis_counter);
     27                void SpawnTriaHook(ElementHook* triahook,int* indices);    //3d only
     28                void InitHookNeighbors(int* element_ids);               //3d only
    3029};
    3130
    32 #endif //ifndef _PENTAHOOK_H_
     31#endif //ifndef _ELEMENTHOOK_H_
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r15313 r15372  
    4444Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels)
    4545        :PentaRef(nummodels)
    46         ,PentaHook(nummodels,index+1,iomodel) //index+1: material id, iomodel->numberofelements+1: matpar id
     46        ,ElementHook(nummodels,index+1,6,iomodel) //index+1: material id, iomodel->numberofelements+1: matpar id
    4747                                                                      { //i is the element index
    4848
     
    9999        for(i=0;i<this->numanalyses;i++) penta->element_type_list[i]=this->element_type_list[i];
    100100
    101         //deal with PentaHook mother class
     101        //deal with ElementHook
    102102        penta->numanalyses=this->numanalyses;
    103103        penta->hnodes=new Hook*[penta->numanalyses];
     
    28242824        tria->parameters=tria_parameters;
    28252825        tria->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED)
    2826         this->SpawnTriaHook(dynamic_cast<TriaHook*>(tria),&indices[0]);
     2826        this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria),&indices[0]);
    28272827
    28282828        /*Spawn material*/
     
    30443044
    30453045        /*hooks: */
    3046         this->SetHookNodes(penta_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
     3046        this->SetHookNodes(penta_node_ids,6,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
    30473047
    30483048        /*Fill with IoModel*/
  • issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r15305 r15372  
    99/*{{{*/
    1010#include "./Element.h"
    11 #include "./PentaHook.h"
     11#include "./ElementHook.h"
    1212#include "./PentaRef.h"
    13 class  Object;
     13class Object;
    1414class Parameters;
    1515class Results;
     
    2828/*}}}*/
    2929
    30 class Penta: public Element,public PentaHook,public PentaRef{
     30class Penta: public Element,public ElementHook,public PentaRef{
    3131
    3232        public:
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r15353 r15372  
    4141Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels)
    4242        :TriaRef(nummodels)
    43         ,TriaHook(nummodels,index+1,iomodel){
     43        ,ElementHook(nummodels,index+1,3,iomodel){
    4444
    4545                /*id: */
     
    8585        for(i=0;i<this->numanalyses;i++) tria->element_type_list[i]=this->element_type_list[i];
    8686
    87         //deal with TriaHook mother class
     87        //deal with ElementHook mother class
    8888        tria->numanalyses=this->numanalyses;
    8989        tria->hnodes=new Hook*[tria->numanalyses];
     
    27292729
    27302730        /*Intermediaries*/
    2731         int    i,j;
    2732         int    tria_node_ids[3];
    2733         int    tria_vertex_ids[3];
    2734         int    tria_type;
     2731        int        i                   ,j;
     2732        int        tria_node_ids[3];
     2733        int        tria_vertex_ids[3];
     2734        int        tria_type;
    27352735        IssmDouble nodeinputs[3];
    27362736        IssmDouble yts;
    2737         int    progstabilization,balancestabilization;
    2738         bool   dakota_analysis;
     2737        int        progstabilization,balancestabilization;
     2738        bool       dakota_analysis;
    27392739
    27402740        /*Checks if debuging*/
     
    27802780
    27812781        /*hooks: */
    2782         this->SetHookNodes(tria_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
     2782        this->SetHookNodes(tria_node_ids,3,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
    27832783
    27842784        /*Fill with IoModel*/
  • issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r15353 r15372  
    99/*{{{*/
    1010#include "./Element.h"
    11 #include "./TriaHook.h"
     11#include "./ElementHook.h"
    1212#include "./TriaRef.h"
    1313class Parameters;
     
    2626/*}}}*/
    2727
    28 class Tria: public Element,public TriaHook,public TriaRef{
     28class Tria: public Element,public ElementHook,public TriaRef{
    2929
    3030        public:
  • issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp

    r15104 r15372  
    3333/*}}}*/
    3434/*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel, int analysis_type) {{{*/
    35 Numericalflux::Numericalflux(int numericalflux_id,int i, IoModel* iomodel, int in_analysis_type){
     35Numericalflux::Numericalflux(int numericalflux_id,int i,int i1,int i2,int e1,int e2,IoModel* iomodel, int in_analysis_type){
    3636
    3737        /* Intermediary */
    38         int  e1,e2;
    39         int  i1,i2;
    4038        int  j;
    4139        int  pos1,pos2,pos3,pos4;
     
    5957
    6058        /*First, see wether this is an internal or boundary edge (if e2=-1)*/
    61         if (iomodel->Data(MeshEdgesEnum)[4*i+3]==-1.){ //edges are [node1 node2 elem1 elem2]
     59        if(e2==-1){
    6260                /* Boundary edge, only one element */
    63                 e1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+2]);
    64                 e2=reCast<int>(UNDEF);
    65                 num_elems=1;
    66                 num_nodes=2;
     61                num_elems=1; num_nodes=2;
    6762                numericalflux_type=BoundaryEnum;
    6863                numericalflux_elem_ids[0]=e1;
     
    7065        else{
    7166                /* internal edge: connected to 2 elements */
    72                 e1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+2]);
    73                 e2=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+3]);
    74                 num_elems=2;
    75                 num_nodes=4;
     67                num_elems=2; num_nodes=4;
    7668                numericalflux_type=InternalEnum;
    7769                numericalflux_elem_ids[0]=e1;
     
    8072
    8173        /*1: Get vertices ids*/
    82         i1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+0]);
    83         i2=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+1]);
    8474        numericalflux_vertex_ids[0]=i1;
    8575        numericalflux_vertex_ids[1]=i2;
     
    9383                pos1=pos2=pos3=pos4=UNDEF;
    9484                for(j=0;j<3;j++){
    95                         if (iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
    96                         if (iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
    97                         if (iomodel->Data(MeshElementsEnum)[3*(e2-1)+j]==i1) pos3=j+1;
    98                         if (iomodel->Data(MeshElementsEnum)[3*(e2-1)+j]==i2) pos4=j+1;
     85                        if(iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
     86                        if(iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
     87                        if(iomodel->Data(MeshElementsEnum)[3*(e2-1)+j]==i1) pos3=j+1;
     88                        if(iomodel->Data(MeshElementsEnum)[3*(e2-1)+j]==i2) pos4=j+1;
    9989                }
    10090                _assert_(pos1!=UNDEF && pos2!=UNDEF && pos3!=UNDEF && pos4!=UNDEF);
     
    112102                pos1=pos2=UNDEF;
    113103                for(j=0;j<3;j++){
    114                         if (iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
    115                         if (iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
     104                        if(iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
     105                        if(iomodel->Data(MeshElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
    116106                }
    117107                _assert_(pos1!=UNDEF && pos2!=UNDEF);
  • issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h

    r14761 r15372  
    3737                /*Numericalflux constructors,destructors {{{*/
    3838                Numericalflux();
    39                 Numericalflux(int numericalflux_id,int i, IoModel* iomodel,int analysis_type);
     39                Numericalflux(int numericalflux_id,int i,int i1,int i2,int e1,int e2,IoModel* iomodel,int analysis_type);
    4040                ~Numericalflux();
    4141                /*}}}*/
  • issm/trunk-jpl/src/c/classes/classes.h

    r15298 r15372  
    3939#include "./Elements/Element.h"
    4040#include "./Elements/Penta.h"
    41 #include "./Elements/PentaHook.h"
    4241#include "./Elements/PentaRef.h"
    4342#include "./Elements/Tria.h"
    44 #include "./Elements/TriaHook.h"
    4543#include "./Elements/TriaRef.h"
     44#include "./Elements/ElementHook.h"
    4645
    4746/*Option parsing objects: */
Note: See TracChangeset for help on using the changeset viewer.