Changeset 15372
- Timestamp:
- 06/30/13 17:32:20 (12 years ago)
- 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 77 77 ./classes/Elements/Elements.h\ 78 78 ./classes/Elements/Elements.cpp\ 79 ./classes/Elements/ElementHook.h\ 80 ./classes/Elements/ElementHook.cpp\ 79 81 ./classes/Elements/Tria.h\ 80 82 ./classes/Elements/Tria.cpp\ 81 ./classes/Elements/TriaHook.h\82 ./classes/Elements/TriaHook.cpp\83 83 ./classes/Elements/TriaRef.h\ 84 84 ./classes/Elements/TriaRef.cpp\ … … 537 537 ./classes/Elements/Penta.h\ 538 538 ./classes/Elements/Penta.cpp\ 539 ./classes/Elements/PentaHook.h\540 ./classes/Elements/PentaHook.cpp\541 539 ./classes/Elements/PentaRef.h\ 542 540 ./classes/Elements/PentaRef.cpp -
issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp
r15364 r15372 1 /*!\file PentaHook.c2 * \brief: implementation of the PentaHook object1 /*!\file ElementHook.c 2 * \brief: implementation of the ElementHook object 3 3 */ 4 4 … … 16 16 17 17 /*Object constructors and destructor*/ 18 /*FUNCTION PentaHook::PentaHook(){{{*/19 PentaHook::PentaHook(){18 /*FUNCTION ElementHook::ElementHook(){{{*/ 19 ElementHook::ElementHook(){ 20 20 numanalyses=UNDEF; 21 21 this->hnodes = NULL; … … 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION PentaHook::~PentaHook(){{{*/29 PentaHook::~PentaHook(){28 /*FUNCTION ElementHook::~ElementHook(){{{*/ 29 ElementHook::~ElementHook(){ 30 30 31 31 int i; … … 41 41 } 42 42 /*}}}*/ 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){{{*/ 44 ElementHook::ElementHook(int in_numanalyses,int element_id,int numvertices,IoModel* iomodel){ 45 45 46 46 /*intermediary: */ 47 47 int matpar_id; 48 48 int material_id; 49 int penta_vertex_ids[6];50 49 51 50 /*retrieve material_id: */ 52 51 iomodel->Constant(&matpar_id,MeshNumberofelementsEnum); matpar_id++; 53 52 54 /*retri ve material_id*/53 /*retrieve material_id*/ 55 54 material_id = element_id; 56 55 57 56 /*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]); 60 60 } 61 61 62 62 this->numanalyses = in_numanalyses; 63 63 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); 65 65 this->hmaterial = new Hook(&material_id,1); 66 66 this->hmatpar = new Hook(&matpar_id,1); 67 67 this->hneighbors = NULL; 68 68 69 / /Initialize hnodes as NULL69 /*Initialize hnodes as NULL*/ 70 70 for(int i=0;i<this->numanalyses;i++){ 71 71 this->hnodes[i]=NULL; 72 72 } 73 73 74 /*Clean up*/ 75 xDelete<int>(vertex_ids); 76 74 77 } 75 78 /*}}}*/ 76 79 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{{{*/ 81 void ElementHook::SetHookNodes(int* node_ids,int numnodes,int analysis_counter){ 82 this->hnodes[analysis_counter]= new Hook(node_ids,numnodes); 80 83 } 81 84 /*}}}*/ 82 /*FUNCTION PentaHook::InitHookNeighbors{{{*/83 void PentaHook::InitHookNeighbors(int* element_ids){85 /*FUNCTION ElementHook::InitHookNeighbors{{{*/ 86 void ElementHook::InitHookNeighbors(int* element_ids){ 84 87 this->hneighbors=new Hook(element_ids,2); 85 86 88 } 87 89 /*}}}*/ 88 /*FUNCTION PentaHook::SpawnTriaHook{{{*/89 void PentaHook::SpawnTriaHook(TriaHook* triahook,int* indices){90 /*FUNCTION ElementHook::SpawnTriaHook{{{*/ 91 void ElementHook::SpawnTriaHook(ElementHook* triahook,int* indices){ 90 92 91 93 int i; -
issm/trunk-jpl/src/c/classes/Elements/ElementHook.h
r15364 r15372 1 /*!\file: PentaHook.h2 * \brief prototypes for PentaHook.h1 /*!\file: ElementHook.h 2 * \brief prototypes for ElementHook.h 3 3 */ 4 4 5 #ifndef _ PENTAHOOK_H_6 #define _PENTAHOOK_H_5 #ifndef _ELEMENTHOOK_H_ 6 #define _ELEMENTHOOK_H_ 7 7 8 8 class Hook; 9 class TriaHook;10 9 class IoModel; 11 10 12 class PentaHook{11 class ElementHook{ 13 12 14 13 public: 15 14 int numanalyses; //number of analysis types 16 15 Hook **hnodes; // set of nodes for each analysis type 17 Hook *hvertices; // 6 vertices for each analysis type16 Hook *hvertices; // vertices 18 17 Hook *hmaterial; // 1 ice material 19 18 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 21 20 22 21 /*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(); 26 25 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 30 29 }; 31 30 32 #endif //ifndef _ PENTAHOOK_H_31 #endif //ifndef _ELEMENTHOOK_H_ -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15313 r15372 44 44 Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels) 45 45 :PentaRef(nummodels) 46 , PentaHook(nummodels,index+1,iomodel) //index+1: material id, iomodel->numberofelements+1: matpar id46 ,ElementHook(nummodels,index+1,6,iomodel) //index+1: material id, iomodel->numberofelements+1: matpar id 47 47 { //i is the element index 48 48 … … 99 99 for(i=0;i<this->numanalyses;i++) penta->element_type_list[i]=this->element_type_list[i]; 100 100 101 //deal with PentaHook mother class101 //deal with ElementHook 102 102 penta->numanalyses=this->numanalyses; 103 103 penta->hnodes=new Hook*[penta->numanalyses]; … … 2824 2824 tria->parameters=tria_parameters; 2825 2825 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]); 2827 2827 2828 2828 /*Spawn material*/ … … 3044 3044 3045 3045 /*hooks: */ 3046 this->SetHookNodes(penta_node_ids, analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type3046 this->SetHookNodes(penta_node_ids,6,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type 3047 3047 3048 3048 /*Fill with IoModel*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r15305 r15372 9 9 /*{{{*/ 10 10 #include "./Element.h" 11 #include "./ PentaHook.h"11 #include "./ElementHook.h" 12 12 #include "./PentaRef.h" 13 class 13 class Object; 14 14 class Parameters; 15 15 class Results; … … 28 28 /*}}}*/ 29 29 30 class Penta: public Element,public PentaHook,public PentaRef{30 class Penta: public Element,public ElementHook,public PentaRef{ 31 31 32 32 public: -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r15353 r15372 41 41 Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels) 42 42 :TriaRef(nummodels) 43 , TriaHook(nummodels,index+1,iomodel){43 ,ElementHook(nummodels,index+1,3,iomodel){ 44 44 45 45 /*id: */ … … 85 85 for(i=0;i<this->numanalyses;i++) tria->element_type_list[i]=this->element_type_list[i]; 86 86 87 //deal with TriaHook mother class87 //deal with ElementHook mother class 88 88 tria->numanalyses=this->numanalyses; 89 89 tria->hnodes=new Hook*[tria->numanalyses]; … … 2729 2729 2730 2730 /*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; 2735 2735 IssmDouble nodeinputs[3]; 2736 2736 IssmDouble yts; 2737 int progstabilization,balancestabilization;2738 bool dakota_analysis;2737 int progstabilization,balancestabilization; 2738 bool dakota_analysis; 2739 2739 2740 2740 /*Checks if debuging*/ … … 2780 2780 2781 2781 /*hooks: */ 2782 this->SetHookNodes(tria_node_ids, analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type2782 this->SetHookNodes(tria_node_ids,3,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type 2783 2783 2784 2784 /*Fill with IoModel*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r15353 r15372 9 9 /*{{{*/ 10 10 #include "./Element.h" 11 #include "./ TriaHook.h"11 #include "./ElementHook.h" 12 12 #include "./TriaRef.h" 13 13 class Parameters; … … 26 26 /*}}}*/ 27 27 28 class Tria: public Element,public TriaHook,public TriaRef{28 class Tria: public Element,public ElementHook,public TriaRef{ 29 29 30 30 public: -
issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp
r15104 r15372 33 33 /*}}}*/ 34 34 /*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel, int analysis_type) {{{*/ 35 Numericalflux::Numericalflux(int numericalflux_id,int i, 35 Numericalflux::Numericalflux(int numericalflux_id,int i,int i1,int i2,int e1,int e2,IoModel* iomodel, int in_analysis_type){ 36 36 37 37 /* Intermediary */ 38 int e1,e2;39 int i1,i2;40 38 int j; 41 39 int pos1,pos2,pos3,pos4; … … 59 57 60 58 /*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){ 62 60 /* 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; 67 62 numericalflux_type=BoundaryEnum; 68 63 numericalflux_elem_ids[0]=e1; … … 70 65 else{ 71 66 /* 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; 76 68 numericalflux_type=InternalEnum; 77 69 numericalflux_elem_ids[0]=e1; … … 80 72 81 73 /*1: Get vertices ids*/ 82 i1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+0]);83 i2=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+1]);84 74 numericalflux_vertex_ids[0]=i1; 85 75 numericalflux_vertex_ids[1]=i2; … … 93 83 pos1=pos2=pos3=pos4=UNDEF; 94 84 for(j=0;j<3;j++){ 95 if 96 if 97 if 98 if 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; 99 89 } 100 90 _assert_(pos1!=UNDEF && pos2!=UNDEF && pos3!=UNDEF && pos4!=UNDEF); … … 112 102 pos1=pos2=UNDEF; 113 103 for(j=0;j<3;j++){ 114 if 115 if 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; 116 106 } 117 107 _assert_(pos1!=UNDEF && pos2!=UNDEF); -
issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h
r14761 r15372 37 37 /*Numericalflux constructors,destructors {{{*/ 38 38 Numericalflux(); 39 Numericalflux(int numericalflux_id,int i, 39 Numericalflux(int numericalflux_id,int i,int i1,int i2,int e1,int e2,IoModel* iomodel,int analysis_type); 40 40 ~Numericalflux(); 41 41 /*}}}*/ -
issm/trunk-jpl/src/c/classes/classes.h
r15298 r15372 39 39 #include "./Elements/Element.h" 40 40 #include "./Elements/Penta.h" 41 #include "./Elements/PentaHook.h"42 41 #include "./Elements/PentaRef.h" 43 42 #include "./Elements/Tria.h" 44 #include "./Elements/TriaHook.h"45 43 #include "./Elements/TriaRef.h" 44 #include "./Elements/ElementHook.h" 46 45 47 46 /*Option parsing objects: */
Note:
See TracChangeset
for help on using the changeset viewer.