Changeset 4248
- Timestamp:
- 06/26/10 12:30:21 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 98 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Constraints/Rgb.cpp
r4236 r4248 18 18 #include "../objects.h" 19 19 20 /* Objectconstructors and destructor*/20 /*Rgb constructors and destructor*/ 21 21 /*FUNCTION Rgb::constructor {{{1*/ 22 22 Rgb::Rgb(){ … … 42 42 /*}}}1*/ 43 43 44 /*Object marshall*/ 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION Rgb::Echo {{{1*/ 46 void Rgb::Echo(void){ 47 48 printf("Rgb:\n"); 49 printf(" id: %i\n",id); 50 printf(" nodeid1: %i\n",nodeid1); 51 printf(" nodeid2: %i\n",nodeid2); 52 printf(" dof: %i\n",dof); 53 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 54 return; 55 } 56 /*}}}1*/ 57 /*FUNCTION Rgb::DeepEcho {{{1*/ 58 void Rgb::DeepEcho(void){ 59 60 printf("Rgb:\n"); 61 printf(" id: %i\n",id); 62 printf(" nodeid1: %i\n",nodeid1); 63 printf(" nodeid2: %i\n",nodeid2); 64 printf(" dof: %i\n",dof); 65 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 66 return; 67 } 68 /*}}}1*/ 69 /*FUNCTION Rgb::Id {{{1*/ 70 int Rgb::Id(void){ return id; } 71 /*}}}1*/ 72 /*FUNCTION Rgb::MyRank {{{1*/ 73 int Rgb::MyRank(void){ 74 extern int my_rank; 75 return my_rank; 76 } 77 /*}}}1*/ 45 78 /*FUNCTION Rgb::Marshall {{{1*/ 46 79 void Rgb::Marshall(char** pmarshalled_dataset){ … … 102 135 } 103 136 /*}}}1*/ 104 105 /*Object functions*/106 /*FUNCTION Rgb::copy {{{1*/107 Object* Rgb::copy() {108 return new Rgb(*this);109 }110 /*}}}1*/111 /*FUNCTION Rgb::DeepEcho {{{1*/112 void Rgb::DeepEcho(void){113 114 printf("Rgb:\n");115 printf(" id: %i\n",id);116 printf(" nodeid1: %i\n",nodeid1);117 printf(" nodeid2: %i\n",nodeid2);118 printf(" dof: %i\n",dof);119 printf(" analysis_type: %s\n",EnumAsString(analysis_type));120 return;121 }122 /*}}}1*/123 /*FUNCTION Rgb::Echo {{{1*/124 void Rgb::Echo(void){125 126 printf("Rgb:\n");127 printf(" id: %i\n",id);128 printf(" nodeid1: %i\n",nodeid1);129 printf(" nodeid2: %i\n",nodeid2);130 printf(" dof: %i\n",dof);131 printf(" analysis_type: %s\n",EnumAsString(analysis_type));132 return;133 }134 /*}}}1*/135 137 /*FUNCTION Rgb::Enum {{{1*/ 136 138 int Rgb::Enum(void){ … … 140 142 } 141 143 /*}}}1*/ 142 /*FUNCTION Rgb::Id {{{1*/ 143 int Rgb::Id(void){ return id; } 144 /*FUNCTION Rgb::copy {{{1*/ 145 Object* Rgb::copy() { 146 return new Rgb(*this); 147 } 144 148 /*}}}1*/ 149 150 /*Rgb functions*/ 145 151 /*FUNCTION Rgb::GetNodeId1{{{1*/ 146 152 int Rgb::GetNodeId1(){ … … 160 166 } 161 167 /*}}}1*/ 162 /*FUNCTION Rgb::MyRank {{{1*/163 int Rgb::MyRank(void){164 extern int my_rank;165 return my_rank;166 }167 /*}}}1*/168 168 /*FUNCTION Rgb::InAnalysis(int analysis_type){{{1*/ 169 169 bool Rgb::InAnalysis(int in_analysis_type){ -
issm/trunk/src/c/objects/Constraints/Rgb.h
r4244 r4248 23 23 public: 24 24 25 /*Rgb constructors, destructors:{{{1*/ 25 26 Rgb(); 26 27 Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof,int analysis_type); 27 28 ~Rgb(); 28 29 void Echo(); 30 void DeepEcho(); 31 void Marshall(char** pmarshalled_dataset); 32 int MarshallSize(); 33 void Demarshall(char** pmarshalled_dataset); 34 int Enum(); 35 int Id(); 36 int MyRank(); 37 /*non virtual: */ 29 /*}}}*/ 30 /*Object virtual functions definitions:{{{1 */ 31 void Echo(); 32 void DeepEcho(); 33 int Id(); 34 int MyRank(); 35 void Marshall(char** pmarshalled_dataset); 36 int MarshallSize(); 37 void Demarshall(char** pmarshalled_dataset); 38 int Enum(); 39 Object* copy(); 40 /*}}}*/ 41 /*Rgb management: {{{1*/ 38 42 int GetNodeId1(); 39 43 int GetNodeId2(); 40 44 int GetDof(); 41 Object* copy();42 bool InAnalysis(int analysis_type);45 bool InAnalysis(int analysis_type); 46 /*}}}*/ 43 47 44 48 -
issm/trunk/src/c/objects/Constraints/Spc.cpp
r4236 r4248 19 19 20 20 21 /* Objectconstructors and destructor*/21 /*Spc constructors and destructor*/ 22 22 /*FUNCTION Spc::constructor {{{1*/ 23 23 Spc::Spc(){ … … 43 43 /*}}}1*/ 44 44 45 /*Object marshall*/ 45 /*Object virtual functions definitions:*/ 46 /*FUNCTION Spc::Echo {{{1*/ 47 void Spc::Echo(void){ 48 49 printf("Spc:\n"); 50 printf(" sid: %i\n",sid); 51 printf(" nodeid: %i\n",nodeid); 52 printf(" dof: %i\n",dof); 53 printf(" value: %g\n",value); 54 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 55 return; 56 } 57 /*}}}1*/ 58 /*FUNCTION Spc::DeepEcho {{{1*/ 59 void Spc::DeepEcho(void){ 60 61 printf("Spc:\n"); 62 printf(" sid: %i\n",sid); 63 printf(" nodeid: %i\n",nodeid); 64 printf(" dof: %i\n",dof); 65 printf(" value: %g\n",value); 66 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 67 return; 68 } 69 /*}}}1*/ 70 /*FUNCTION Spc::Id {{{1*/ 71 int Spc::Id(void){ return sid; } 72 /*}}}1*/ 73 /*FUNCTION Spc::MyRank {{{1*/ 74 int Spc::MyRank(void){ 75 extern int my_rank; 76 return my_rank; 77 } 78 /*}}}1*/ 46 79 /*FUNCTION Spc::Marshall {{{1*/ 47 80 void Spc::Marshall(char** pmarshalled_dataset){ … … 103 136 } 104 137 /*}}}1*/ 105 106 /*Object functions*/107 /*FUNCTION Spc::copy {{{1*/108 Object* Spc::copy() {109 return new Spc(*this);110 }111 /*}}}1*/112 /*FUNCTION Spc::DeepEcho {{{1*/113 void Spc::DeepEcho(void){114 115 printf("Spc:\n");116 printf(" sid: %i\n",sid);117 printf(" nodeid: %i\n",nodeid);118 printf(" dof: %i\n",dof);119 printf(" value: %g\n",value);120 printf(" analysis_type: %s\n",EnumAsString(analysis_type));121 return;122 }123 /*}}}1*/124 /*FUNCTION Spc::Echo {{{1*/125 void Spc::Echo(void){126 127 printf("Spc:\n");128 printf(" sid: %i\n",sid);129 printf(" nodeid: %i\n",nodeid);130 printf(" dof: %i\n",dof);131 printf(" value: %g\n",value);132 printf(" analysis_type: %s\n",EnumAsString(analysis_type));133 return;134 }135 /*}}}1*/136 138 /*FUNCTION Spc::Enum {{{1*/ 137 139 int Spc::Enum(void){ … … 141 143 } 142 144 /*}}}1*/ 145 /*FUNCTION Spc::copy {{{1*/ 146 Object* Spc::copy() { 147 return new Spc(*this); 148 } 149 /*}}}1*/ 150 151 /*Spc functions*/ 143 152 /*FUNCTION Spc::GetDof {{{1*/ 144 153 int Spc::GetDof(){ 145 154 return dof; 146 155 } 147 /*}}}1*/148 /*FUNCTION Spc::Id {{{1*/149 int Spc::Id(void){ return sid; }150 156 /*}}}1*/ 151 157 /*FUNCTION Spc::GetNodeId {{{1*/ … … 160 166 } 161 167 /*}}}1*/ 162 /*FUNCTION Spc::MyRank {{{1*/163 int Spc::MyRank(void){164 extern int my_rank;165 return my_rank;166 }167 /*}}}1*/168 168 /*FUNCTION Spc::InAnalysis(int analysis_type){{{1*/ 169 169 bool Spc::InAnalysis(int in_analysis_type){ -
issm/trunk/src/c/objects/Constraints/Spc.h
r4244 r4248 23 23 public: 24 24 25 /*Spc constructors, destructors:{{{1*/ 25 26 Spc(); 26 27 Spc(int sid,int nodeid, int dof,double value,int analysis_type); 27 28 ~Spc(); 28 29 void Echo(); 30 void DeepEcho(); 31 void Marshall(char** pmarshalled_dataset); 32 int MarshallSize(); 33 void Demarshall(char** pmarshalled_dataset); 34 int Enum(); 35 int Id(); 36 int MyRank(); 29 /*}}}*/ 30 /*Object virtual functions definitions:{{{1 */ 31 void Echo(); 32 void DeepEcho(); 33 int Id(); 34 int MyRank(); 35 void Marshall(char** pmarshalled_dataset); 36 int MarshallSize(); 37 void Demarshall(char** pmarshalled_dataset); 38 int Enum(); 39 Object* copy(); 40 /*}}}*/ 41 /*Spc management:{{{1 */ 37 42 int GetNodeId(); 38 43 int GetDof(); 39 44 double GetValue(); 40 Object* copy();41 45 bool InAnalysis(int analysis_type); 42 43 46 /*}}}*/ 44 47 45 48 }; -
issm/trunk/src/c/objects/DofIndexing.cpp
r4236 r4248 17 17 #include "../include/include.h" 18 18 19 /* Objectconstructors and destructor*/19 /*DofIndexing constructors and destructor*/ 20 20 /*FUNCTION DofIndexing::DofIndexing(){{{1*/ 21 21 DofIndexing::DofIndexing(){ … … 60 60 } 61 61 /*}}}*/ 62 /*FUNCTION DofIndexing::Init{{{1*/ 63 void DofIndexing::Init(int in_numberofdofs){ 62 64 63 /*Object management: */ 65 int i; 66 this->numberofdofs=in_numberofdofs; 67 this->clone=0; 68 69 for (i=0;i<MAXDOFSPERNODE;i++){ 70 /*assume dof is free, no constraints, no rigid body constraint: */ 71 this->m_set[i]=0; 72 this->n_set[i]=1; 73 this->f_set[i]=1; 74 this->s_set[i]=0; 75 this->doflist[i]=UNDEF; 76 } 77 } 78 /*}}}*/ 79 80 /*Some of the Object functionality: */ 81 /*FUNCTION DofIndexing::Echo{{{1*/ 82 void DofIndexing::Echo(void){ 83 84 int i; 85 86 printf("DofIndexing:\n"); 87 printf(" numberofdofs: %i\n",numberofdofs); 88 printf(" clone: %i\n",clone); 89 } 90 /*}}}*/ 64 91 /*FUNCTION DofIndexing::DeepEcho{{{1*/ 65 92 void DofIndexing::DeepEcho(void){ … … 112 139 } 113 140 /*}}}*/ 114 /*FUNCTION DofIndexing::Echo{{{1*/115 void DofIndexing::Echo(void){116 117 int i;118 119 printf("DofIndexing:\n");120 printf(" numberofdofs: %i\n",numberofdofs);121 printf(" clone: %i\n",clone);122 }123 /*}}}*/124 /*FUNCTION DofIndexing::Init{{{1*/125 void DofIndexing::Init(int in_numberofdofs){126 127 int i;128 this->numberofdofs=in_numberofdofs;129 this->clone=0;130 131 for (i=0;i<MAXDOFSPERNODE;i++){132 /*assume dof is free, no constraints, no rigid body constraint: */133 this->m_set[i]=0;134 this->n_set[i]=1;135 this->f_set[i]=1;136 this->s_set[i]=0;137 this->doflist[i]=UNDEF;138 }139 }140 /*}}}*/141 141 /*FUNCTION DofIndexing::Marshall{{{1*/ 142 142 void DofIndexing::Marshall(char** pmarshalled_dataset){ -
issm/trunk/src/c/objects/DofIndexing.h
r3969 r4248 26 26 int doflist[MAXDOFSPERNODE]; //dof list on which we solve 27 27 28 /*DofIndexing constructors, destructors {{{1*/ 28 29 DofIndexing(); 29 30 DofIndexing(int numberofdofs); … … 31 32 DofIndexing(DofIndexing* properties); 32 33 ~DofIndexing(); 33 34 /*}}}*/ 35 /*Object like functionality: {{{1*/ 36 void Echo(void); 37 void DeepEcho(void); 34 38 void Marshall(char** pmarshalled_dataset); 35 39 int MarshallSize(); 36 40 void Demarshall(char** pmarshalled_dataset); 37 41 void copy(DofIndexing* properties); 38 void Echo(void);39 void DeepEcho(void);42 /*}}}*/ 43 /*DofIndexing management: {{{1*/ 40 44 DofIndexing* Spawn(int* indices, int numindices); 45 /*}}}*/ 41 46 42 47 }; -
issm/trunk/src/c/objects/ElementResults/BeamVertexElementResult.cpp
r4239 r4248 18 18 #include "../../include/include.h" 19 19 20 /* Object constructors and destructor*/20 /*BeamVertexElementResult constructors and destructor*/ 21 21 /*FUNCTION BeamVertexElementResult::BeamVertexElementResult(){{{1*/ 22 22 BeamVertexElementResult::BeamVertexElementResult(){ … … 40 40 /*}}}*/ 41 41 42 /*Object management*/ 43 /*FUNCTION BeamVertexElementResult::copy{{{1*/ 44 Object* BeamVertexElementResult::copy() { 45 46 return new BeamVertexElementResult(this->enum_type,this->values,this->step,this->time); 47 42 /*Object virtual functions definitions:*/ 43 /*FUNCTION BeamVertexElementResult::Echo {{{1*/ 44 void BeamVertexElementResult::Echo(void){ 45 this->DeepEcho(); 48 46 } 49 47 /*}}}*/ … … 59 57 } 60 58 /*}}}*/ 61 /*FUNCTION BeamVertexElementResult::Demarshall{{{1*/62 void BeamVertexElementResult::Demarshall(char** pmarshalled_dataset){63 64 char* marshalled_dataset=NULL;65 int i;66 67 /*recover marshalled_dataset: */68 marshalled_dataset=*pmarshalled_dataset;69 70 /*this time, no need to get enum type, the pointer directly points to the beginning of the71 *object data (thanks to DataSet::Demarshall):*/72 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);73 memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);74 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);75 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);76 77 /*return: */78 *pmarshalled_dataset=marshalled_dataset;79 return;80 }81 /*}}}*/82 /*FUNCTION BeamVertexElementResult::Echo {{{1*/83 void BeamVertexElementResult::Echo(void){84 this->DeepEcho();85 }86 /*}}}*/87 /*FUNCTION BeamVertexElementResult::Enum{{{1*/88 int BeamVertexElementResult::Enum(void){89 90 return BeamVertexElementResultEnum;91 92 }93 /*}}}*/94 /*FUNCTION BeamVertexElementResult::EnumType{{{1*/95 int BeamVertexElementResult::EnumType(void){96 97 return this->enum_type;98 99 }100 /*}}}*/101 59 /*FUNCTION BeamVertexElementResult::Id{{{1*/ 102 60 int BeamVertexElementResult::Id(void){ return -1; } 61 /*}}}*/ 62 /*FUNCTION BeamVertexElementResult::MyRank{{{1*/ 63 int BeamVertexElementResult::MyRank(void){ 64 extern int my_rank; 65 return my_rank; 66 } 103 67 /*}}}*/ 104 68 /*FUNCTION BeamVertexElementResult::Marshall{{{1*/ … … 136 100 } 137 101 /*}}}*/ 138 /*FUNCTION BeamVertexElementResult::MyRank{{{1*/ 139 int BeamVertexElementResult::MyRank(void){ 140 extern int my_rank; 141 return my_rank; 102 /*FUNCTION BeamVertexElementResult::Demarshall{{{1*/ 103 void BeamVertexElementResult::Demarshall(char** pmarshalled_dataset){ 104 105 char* marshalled_dataset=NULL; 106 int i; 107 108 /*recover marshalled_dataset: */ 109 marshalled_dataset=*pmarshalled_dataset; 110 111 /*this time, no need to get enum type, the pointer directly points to the beginning of the 112 *object data (thanks to DataSet::Demarshall):*/ 113 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 114 memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values); 115 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time); 116 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step); 117 118 /*return: */ 119 *pmarshalled_dataset=marshalled_dataset; 120 return; 121 } 122 /*}}}*/ 123 /*FUNCTION BeamVertexElementResult::Enum{{{1*/ 124 int BeamVertexElementResult::Enum(void){ 125 126 return BeamVertexElementResultEnum; 127 128 } 129 /*}}}*/ 130 /*FUNCTION BeamVertexElementResult::copy{{{1*/ 131 Object* BeamVertexElementResult::copy() { 132 133 return new BeamVertexElementResult(this->enum_type,this->values,this->step,this->time); 134 142 135 } 143 136 /*}}}*/ 144 137 145 /*ElementResult functions*/ 138 139 /*ElementResult management*/ 140 /*FUNCTION BeamVertexElementResult::EnumType{{{1*/ 141 int BeamVertexElementResult::EnumType(void){ 142 143 return this->enum_type; 144 145 } 146 /*}}}*/ 146 147 /*FUNCTION BeamVertexElementResult::ProcessUnits(Parameters* parameters){{{1*/ 147 148 void BeamVertexElementResult::ProcessUnits(Parameters* parameters){ -
issm/trunk/src/c/objects/ElementResults/BeamVertexElementResult.h
r4244 r4248 23 23 public: 24 24 25 /* constructors, destructors: {{{1*/25 /*BeamVertexElementResult constructors, destructors: {{{1*/ 26 26 BeamVertexElementResult(); 27 27 BeamVertexElementResult(int enum_type,double* values,int step,double time); 28 28 ~BeamVertexElementResult(); 29 29 /*}}}*/ 30 /*object management: {{{1*/ 30 /*Object virtual functions definitions:{{{1 */ 31 void Echo(); 31 32 void DeepEcho(); 32 void Echo();33 33 int Id(); 34 int MyRank(); 34 35 void Marshall(char** pmarshalled_dataset); 35 36 int MarshallSize(); 36 37 void Demarshall(char** pmarshalled_dataset); 37 38 int Enum(); 38 int MyRank();39 39 Object* copy(); 40 int EnumType();41 40 /*}}}*/ 42 /* result virtual functions: {{{1*/41 /*ElementResult virtual functions definitions: {{{1*/ 43 42 ElementResult* SpawnSingElementResult(int index){ISSMERROR("Not implemented yet!");} 44 43 ElementResult* SpawnBeamElementResult(int* indices){ISSMERROR("Not implemented yet!");} … … 48 47 void PatchFill(int row, Patch* patch); 49 48 /*}}}*/ 49 /*BeamVertexElementResult management: {{{1*/ 50 int EnumType(); 51 /*}}}*/ 50 52 51 53 }; -
issm/trunk/src/c/objects/ElementResults/DoubleElementResult.cpp
r4239 r4248 18 18 #include "../../include/include.h" 19 19 20 /* Object constructors and destructor*/20 /*DoubleElementResult constructors and destructor*/ 21 21 /*FUNCTION DoubleElementResult::DoubleElementResult(){{{1*/ 22 22 DoubleElementResult::DoubleElementResult(){ … … 39 39 /*}}}*/ 40 40 41 /*Object management*/ 42 /*FUNCTION DoubleElementResult::copy{{{1*/ 43 Object* DoubleElementResult::copy() { 44 45 return new DoubleElementResult(this->enum_type,this->value,this->step,this->time); 46 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION DoubleElementResult::Echo {{{1*/ 43 void DoubleElementResult::Echo(void){ 44 this->DeepEcho(); 47 45 } 48 46 /*}}}*/ … … 55 53 printf(" step: %i\n",this->step); 56 54 printf(" time: %g\n",this->time); 55 } 56 /*}}}*/ 57 /*FUNCTION DoubleElementResult::Id{{{1*/ 58 int DoubleElementResult::Id(void){ return -1; } 59 /*}}}*/ 60 /*FUNCTION DoubleElementResult::MyRank{{{1*/ 61 int DoubleElementResult::MyRank(void){ 62 extern int my_rank; 63 return my_rank; 64 } 65 /*}}}*/ 66 /*FUNCTION DoubleElementResult::Marshall{{{1*/ 67 void DoubleElementResult::Marshall(char** pmarshalled_dataset){ 68 69 char* marshalled_dataset=NULL; 70 int enum_value=0; 71 72 /*recover marshalled_dataset: */ 73 marshalled_dataset=*pmarshalled_dataset; 74 75 /*get enum value of DoubleElementResult: */ 76 enum_value=DoubleElementResultEnum; 77 78 /*marshall enum: */ 79 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 80 81 /*marshall DoubleElementResult data: */ 82 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 83 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 84 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 85 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 86 87 *pmarshalled_dataset=marshalled_dataset; 57 88 } 58 89 /*}}}*/ … … 78 109 } 79 110 /*}}}*/ 80 /*FUNCTION DoubleElementResult::Echo {{{1*/81 void DoubleElementResult::Echo(void){82 this->DeepEcho();83 }84 /*}}}*/85 111 /*FUNCTION DoubleElementResult::Enum{{{1*/ 86 112 int DoubleElementResult::Enum(void){ … … 90 116 } 91 117 /*}}}*/ 92 /*FUNCTION DoubleElementResult::EnumType{{{1*/ 93 int DoubleElementResult::EnumType(void){ 94 95 return this->enum_type; 96 97 } 98 /*}}}*/ 99 /*FUNCTION DoubleElementResult::Id{{{1*/ 100 int DoubleElementResult::Id(void){ return -1; } 101 /*}}}*/ 102 /*FUNCTION DoubleElementResult::Marshall{{{1*/ 103 void DoubleElementResult::Marshall(char** pmarshalled_dataset){ 104 105 char* marshalled_dataset=NULL; 106 int enum_value=0; 107 108 /*recover marshalled_dataset: */ 109 marshalled_dataset=*pmarshalled_dataset; 110 111 /*get enum value of DoubleElementResult: */ 112 enum_value=DoubleElementResultEnum; 113 114 /*marshall enum: */ 115 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 116 117 /*marshall DoubleElementResult data: */ 118 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 119 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 120 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 121 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 122 123 *pmarshalled_dataset=marshalled_dataset; 124 } 125 /*}}}*/ 118 /*FUNCTION DoubleElementResult::copy{{{1*/ 119 Object* DoubleElementResult::copy() { 120 121 return new DoubleElementResult(this->enum_type,this->value,this->step,this->time); 122 123 } 124 /*}}}*/ 125 126 /*ElementResult management*/ 126 127 /*FUNCTION DoubleElementResult::MarshallSize{{{1*/ 127 128 int DoubleElementResult::MarshallSize(){ … … 134 135 } 135 136 /*}}}*/ 136 /*FUNCTION DoubleElementResult::MyRank{{{1*/ 137 int DoubleElementResult::MyRank(void){ 138 extern int my_rank; 139 return my_rank; 140 } 141 /*}}}*/ 142 143 /*ElementResult functions*/ 137 /*FUNCTION DoubleElementResult::EnumType{{{1*/ 138 int DoubleElementResult::EnumType(void){ 139 140 return this->enum_type; 141 142 } 143 /*}}}*/ 144 144 /*FUNCTION DoubleElementResult::SpawnSingElementResult{{{1*/ 145 145 ElementResult* DoubleElementResult::SpawnSingElementResult(int index){ -
issm/trunk/src/c/objects/ElementResults/DoubleElementResult.h
r4244 r4248 25 25 public: 26 26 27 /* constructors, destructors: {{{1*/27 /*DoubleElementResult constructors, destructors: {{{1*/ 28 28 DoubleElementResult(); 29 29 DoubleElementResult(int enum_type,double value,int step,double time); 30 30 ~DoubleElementResult(); 31 31 /*}}}*/ 32 /*object management: {{{1*/ 32 /*Object virtual functions definitions:{{{1 */ 33 void Echo(); 33 34 void DeepEcho(); 34 void Echo();35 35 int Id(); 36 int MyRank(); 36 37 void Marshall(char** pmarshalled_dataset); 37 38 int MarshallSize(); 38 39 void Demarshall(char** pmarshalled_dataset); 39 40 int Enum(); 40 int MyRank();41 41 Object* copy(); 42 int EnumType();43 42 /*}}}*/ 44 /* result virtual functions: {{{1*/43 /*ElementResult virtual functions definitions: {{{1*/ 45 44 ElementResult* SpawnSingElementResult(int index); 46 45 ElementResult* SpawnBeamElementResult(int* indices); … … 50 49 void PatchFill(int row, Patch* patch); 51 50 /*}}}*/ 52 51 /*DoubleElementResult management: {{{1*/ 52 int EnumType(); 53 /*}}}*/ 53 54 }; 54 55 #endif /* _DOUBLEELEMENTRESULT_H */ -
issm/trunk/src/c/objects/ElementResults/ElementResult.h
r4239 r4248 18 18 virtual ~ElementResult(){}; 19 19 20 virtual void Echo(void)=0; 21 22 virtual ElementResult* SpawnSingElementResult(int index)=0; 23 virtual ElementResult* SpawnBeamElementResult(int* indices)=0; 24 virtual ElementResult* SpawnTriaElementResult(int* indices)=0; 20 virtual ElementResult* SpawnSingElementResult(int index)=0; 21 virtual ElementResult* SpawnBeamElementResult(int* indices)=0; 22 virtual ElementResult* SpawnTriaElementResult(int* indices)=0; 25 23 virtual void ProcessUnits(Parameters* parameters)=0; 26 24 virtual int NumberOfNodalValues(void)=0; -
issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.cpp
r4239 r4248 18 18 #include "../../include/include.h" 19 19 20 /* Object constructors and destructor*/20 /*PentaVertexElementResult constructors and destructor*/ 21 21 /*FUNCTION PentaVertexElementResult::PentaVertexElementResult(){{{1*/ 22 22 PentaVertexElementResult::PentaVertexElementResult(){ … … 41 41 /*}}}*/ 42 42 43 /*Object management*/ 44 /*FUNCTION PentaVertexElementResult::copy{{{1*/ 45 Object* PentaVertexElementResult::copy() { 46 47 return new PentaVertexElementResult(this->enum_type,this->values,this->step,this->time); 48 43 /*Object virtual functions definitions:*/ 44 /*FUNCTION PentaVertexElementResult::Echo {{{1*/ 45 void PentaVertexElementResult::Echo(void){ 46 this->DeepEcho(); 49 47 } 50 48 /*}}}*/ … … 58 56 printf(" time: %g\n",this->time); 59 57 58 } 59 /*}}}*/ 60 /*FUNCTION PentaVertexElementResult::Id{{{1*/ 61 int PentaVertexElementResult::Id(void){ return -1; } 62 /*}}}*/ 63 /*FUNCTION PentaVertexElementResult::MyRank{{{1*/ 64 int PentaVertexElementResult::MyRank(void){ 65 extern int my_rank; 66 return my_rank; 67 } 68 /*}}}*/ 69 /*FUNCTION PentaVertexElementResult::Marshall{{{1*/ 70 void PentaVertexElementResult::Marshall(char** pmarshalled_dataset){ 71 72 char* marshalled_dataset=NULL; 73 int enum_value=0; 74 75 /*recover marshalled_dataset: */ 76 marshalled_dataset=*pmarshalled_dataset; 77 78 /*get enum value of PentaVertexElementResult: */ 79 enum_value=PentaVertexElementResultEnum; 80 81 /*marshall enum: */ 82 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 83 84 /*marshall PentaVertexElementResult data: */ 85 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 86 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values); 87 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 88 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 89 90 *pmarshalled_dataset=marshalled_dataset; 91 } 92 /*}}}*/ 93 /*FUNCTION PentaVertexElementResult::MarshallSize{{{1*/ 94 int PentaVertexElementResult::MarshallSize(){ 95 96 return sizeof(values)+ 97 +sizeof(enum_type) 98 +sizeof(time) 99 +sizeof(step) 100 +sizeof(int); //sizeof(int) for enum value 60 101 } 61 102 /*}}}*/ … … 81 122 } 82 123 /*}}}*/ 83 /*FUNCTION PentaVertexElementResult::Echo {{{1*/84 void PentaVertexElementResult::Echo(void){85 this->DeepEcho();86 }87 /*}}}*/88 124 /*FUNCTION PentaVertexElementResult::Enum{{{1*/ 89 125 int PentaVertexElementResult::Enum(void){ … … 93 129 } 94 130 /*}}}*/ 131 /*FUNCTION PentaVertexElementResult::copy{{{1*/ 132 Object* PentaVertexElementResult::copy() { 133 134 return new PentaVertexElementResult(this->enum_type,this->values,this->step,this->time); 135 136 } 137 /*}}}*/ 138 139 140 /*ElementResult management*/ 95 141 /*FUNCTION PentaVertexElementResult::EnumType{{{1*/ 96 142 int PentaVertexElementResult::EnumType(void){ … … 100 146 } 101 147 /*}}}*/ 102 /*FUNCTION PentaVertexElementResult::Id{{{1*/103 int PentaVertexElementResult::Id(void){ return -1; }104 /*}}}*/105 /*FUNCTION PentaVertexElementResult::Marshall{{{1*/106 void PentaVertexElementResult::Marshall(char** pmarshalled_dataset){107 108 char* marshalled_dataset=NULL;109 int enum_value=0;110 111 /*recover marshalled_dataset: */112 marshalled_dataset=*pmarshalled_dataset;113 114 /*get enum value of PentaVertexElementResult: */115 enum_value=PentaVertexElementResultEnum;116 117 /*marshall enum: */118 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);119 120 /*marshall PentaVertexElementResult data: */121 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);122 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);123 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);124 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);125 126 *pmarshalled_dataset=marshalled_dataset;127 }128 /*}}}*/129 /*FUNCTION PentaVertexElementResult::MarshallSize{{{1*/130 int PentaVertexElementResult::MarshallSize(){131 132 return sizeof(values)+133 +sizeof(enum_type)134 +sizeof(time)135 +sizeof(step)136 +sizeof(int); //sizeof(int) for enum value137 }138 /*}}}*/139 /*FUNCTION PentaVertexElementResult::MyRank{{{1*/140 int PentaVertexElementResult::MyRank(void){141 extern int my_rank;142 return my_rank;143 }144 /*}}}*/145 146 /*ElementResult functions*/147 148 /*FUNCTION PentaVertexElementResult::SpawnSingElementResult{{{1*/ 148 149 ElementResult* PentaVertexElementResult::SpawnSingElementResult(int index){ -
issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.h
r4244 r4248 24 24 public: 25 25 26 /* constructors, destructors: {{{1*/26 /*PentaVertexElementResult constructors, destructors: {{{1*/ 27 27 PentaVertexElementResult(); 28 28 PentaVertexElementResult(int enum_type,double* values,int step, double time); 29 29 ~PentaVertexElementResult(); 30 30 /*}}}*/ 31 /*object management: {{{1*/ 31 /*Object virtual functions definitions:{{{1 */ 32 void Echo(); 32 33 void DeepEcho(); 33 void Echo();34 34 int Id(); 35 int MyRank(); 35 36 void Marshall(char** pmarshalled_dataset); 36 37 int MarshallSize(); 37 38 void Demarshall(char** pmarshalled_dataset); 38 39 int Enum(); 39 int MyRank();40 40 Object* copy(); 41 int EnumType();42 41 /*}}}*/ 43 /* result virtual functions: {{{1*/42 /*ElementResult virtual functions definitions: {{{1*/ 44 43 ElementResult* SpawnSingElementResult(int index); 45 44 ElementResult* SpawnBeamElementResult(int* indices); … … 49 48 void PatchFill(int row, Patch* patch); 50 49 /*}}}*/ 50 /*PentaVertexElementResult management: {{{1*/ 51 int EnumType(); 52 /*}}}*/ 51 53 52 54 }; -
issm/trunk/src/c/objects/ElementResults/SingVertexElementResult.cpp
r4239 r4248 18 18 #include "../../include/include.h" 19 19 20 /* Object constructors and destructor*/20 /*SingVertexElementResult constructors and destructor*/ 21 21 /*FUNCTION SingVertexElementResult::SingVertexElementResult(){{{1*/ 22 22 SingVertexElementResult::SingVertexElementResult(){ … … 39 39 /*}}}*/ 40 40 41 /*Object management*/ 42 /*FUNCTION SingVertexElementResult::copy{{{1*/ 43 Object* SingVertexElementResult::copy() { 44 45 return new SingVertexElementResult(this->enum_type,this->value,this->step,this->time); 46 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION SingVertexElementResult::Echo {{{1*/ 43 void SingVertexElementResult::Echo(void){ 44 this->DeepEcho(); 47 45 } 48 46 /*}}}*/ … … 58 56 } 59 57 /*}}}*/ 60 /*FUNCTION SingVertexElementResult::Demarshall{{{1*/61 void SingVertexElementResult::Demarshall(char** pmarshalled_dataset){62 63 char* marshalled_dataset=NULL;64 int i;65 66 /*recover marshalled_dataset: */67 marshalled_dataset=*pmarshalled_dataset;68 69 /*this time, no need to get enum type, the pointer directly points to the beginning of the70 *object data (thanks to DataSet::Demarshall):*/71 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);72 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);73 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);74 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);75 76 /*return: */77 *pmarshalled_dataset=marshalled_dataset;78 return;79 }80 /*}}}*/81 /*FUNCTION SingVertexElementResult::Echo {{{1*/82 void SingVertexElementResult::Echo(void){83 this->DeepEcho();84 }85 /*}}}*/86 /*FUNCTION SingVertexElementResult::Enum{{{1*/87 int SingVertexElementResult::Enum(void){88 89 return SingVertexElementResultEnum;90 91 }92 /*}}}*/93 /*FUNCTION SingVertexElementResult::EnumType{{{1*/94 int SingVertexElementResult::EnumType(void){95 96 return this->enum_type;97 98 }99 /*}}}*/100 58 /*FUNCTION SingVertexElementResult::Id{{{1*/ 101 59 int SingVertexElementResult::Id(void){ return -1; } 60 /*}}}*/ 61 /*FUNCTION SingVertexElementResult::MyRank{{{1*/ 62 int SingVertexElementResult::MyRank(void){ 63 extern int my_rank; 64 return my_rank; 65 } 102 66 /*}}}*/ 103 67 /*FUNCTION SingVertexElementResult::Marshall{{{1*/ … … 135 99 } 136 100 /*}}}*/ 137 /*FUNCTION SingVertexElementResult::MyRank{{{1*/ 138 int SingVertexElementResult::MyRank(void){ 139 extern int my_rank; 140 return my_rank; 101 /*FUNCTION SingVertexElementResult::Demarshall{{{1*/ 102 void SingVertexElementResult::Demarshall(char** pmarshalled_dataset){ 103 104 char* marshalled_dataset=NULL; 105 int i; 106 107 /*recover marshalled_dataset: */ 108 marshalled_dataset=*pmarshalled_dataset; 109 110 /*this time, no need to get enum type, the pointer directly points to the beginning of the 111 *object data (thanks to DataSet::Demarshall):*/ 112 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 113 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value); 114 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time); 115 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step); 116 117 /*return: */ 118 *pmarshalled_dataset=marshalled_dataset; 119 return; 120 } 121 /*}}}*/ 122 /*FUNCTION SingVertexElementResult::Enum{{{1*/ 123 int SingVertexElementResult::Enum(void){ 124 125 return SingVertexElementResultEnum; 126 127 } 128 /*}}}*/ 129 /*FUNCTION SingVertexElementResult::copy{{{1*/ 130 Object* SingVertexElementResult::copy() { 131 132 return new SingVertexElementResult(this->enum_type,this->value,this->step,this->time); 133 141 134 } 142 135 /*}}}*/ 143 136 144 /*ElementResult functions*/137 /*ElementResult virtual functions definitions*/ 145 138 /*FUNCTION SingVertexElementResult::ProcessUnits(Parameters* parameters){{{1*/ 146 139 void SingVertexElementResult::ProcessUnits(Parameters* parameters){ … … 165 158 } 166 159 /*}}}*/ 160 161 /*SingVertexElementResult management:*/ 162 /*FUNCTION SingVertexElementResult::EnumType{{{1*/ 163 int SingVertexElementResult::EnumType(void){ 164 165 return this->enum_type; 166 167 } 168 /*}}}*/ -
issm/trunk/src/c/objects/ElementResults/SingVertexElementResult.h
r4244 r4248 23 23 public: 24 24 25 /* constructors, destructors: {{{1*/25 /*SingVertexElementResult constructors, destructors: {{{1*/ 26 26 SingVertexElementResult(); 27 27 SingVertexElementResult(int enum_type,double value,int step,double time); 28 28 ~SingVertexElementResult(); 29 29 /*}}}*/ 30 /*object management: {{{1*/ 30 /*Object virtual functions definitions:{{{1 */ 31 void Echo(); 31 32 void DeepEcho(); 32 void Echo();33 33 int Id(); 34 int MyRank(); 34 35 void Marshall(char** pmarshalled_dataset); 35 36 int MarshallSize(); 36 37 void Demarshall(char** pmarshalled_dataset); 37 38 int Enum(); 38 int MyRank();39 39 Object* copy(); 40 int EnumType();41 40 /*}}}*/ 42 /* result virtual functions: {{{1*/41 /*ElementResult virtual functions definitions: {{{1*/ 43 42 ElementResult* SpawnSingElementResult(int index){ISSMERROR("Not implemented yet!");} 44 43 ElementResult* SpawnBeamElementResult(int* indices){ISSMERROR("Not implemented yet!");} … … 48 47 void PatchFill(int row, Patch* patch); 49 48 /*}}}*/ 49 /*SingVertexElementResult management: {{{1*/ 50 int EnumType(); 51 /*}}}*/ 50 52 51 53 }; -
issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.cpp
r4239 r4248 18 18 #include "../../include/include.h" 19 19 20 /* Object constructors and destructor*/20 /*TriaVertexElementResult constructors and destructor*/ 21 21 /*FUNCTION TriaVertexElementResult::TriaVertexElementResult(){{{1*/ 22 22 TriaVertexElementResult::TriaVertexElementResult(){ … … 41 41 /*}}}*/ 42 42 43 /*Object management*/ 44 /*FUNCTION TriaVertexElementResult::copy{{{1*/ 45 Object* TriaVertexElementResult::copy() { 46 47 return new TriaVertexElementResult(this->enum_type,this->values,this->step,this->time); 48 43 /*Object virtual functions definitions:*/ 44 /*FUNCTION TriaVertexElementResult::Echo {{{1*/ 45 void TriaVertexElementResult::Echo(void){ 46 this->DeepEcho(); 49 47 } 50 48 /*}}}*/ … … 59 57 } 60 58 /*}}}*/ 59 /*FUNCTION TriaVertexElementResult::Id{{{1*/ 60 int TriaVertexElementResult::Id(void){ return -1; } 61 /*}}}*/ 62 /*FUNCTION TriaVertexElementResult::MyRank{{{1*/ 63 int TriaVertexElementResult::MyRank(void){ 64 extern int my_rank; 65 return my_rank; 66 } 67 /*}}}*/ 68 /*FUNCTION TriaVertexElementResult::Marshall{{{1*/ 69 void TriaVertexElementResult::Marshall(char** pmarshalled_dataset){ 70 71 char* marshalled_dataset=NULL; 72 int enum_value=0; 73 74 75 /*recover marshalled_dataset: */ 76 marshalled_dataset=*pmarshalled_dataset; 77 78 /*get enum value of TriaVertexElementResult: */ 79 enum_value=TriaVertexElementResultEnum; 80 81 /*marshall enum: */ 82 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 83 84 /*marshall TriaVertexElementResult data: */ 85 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 86 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values); 87 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 88 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 89 90 *pmarshalled_dataset=marshalled_dataset; 91 } 92 /*}}}*/ 93 /*FUNCTION TriaVertexElementResult::MarshallSize{{{1*/ 94 int TriaVertexElementResult::MarshallSize(){ 95 96 return sizeof(values) 97 +sizeof(enum_type) 98 +sizeof(time) 99 +sizeof(step) 100 +sizeof(int); //sizeof(int) for enum value 101 } 102 /*}}}*/ 61 103 /*FUNCTION TriaVertexElementResult::Demarshall{{{1*/ 62 104 void TriaVertexElementResult::Demarshall(char** pmarshalled_dataset){ … … 80 122 } 81 123 /*}}}*/ 82 /*FUNCTION TriaVertexElementResult::Echo {{{1*/83 void TriaVertexElementResult::Echo(void){84 this->DeepEcho();85 }86 /*}}}*/87 124 /*FUNCTION TriaVertexElementResult::Enum{{{1*/ 88 125 int TriaVertexElementResult::Enum(void){ … … 92 129 } 93 130 /*}}}*/ 131 /*FUNCTION TriaVertexElementResult::copy{{{1*/ 132 Object* TriaVertexElementResult::copy() { 133 134 return new TriaVertexElementResult(this->enum_type,this->values,this->step,this->time); 135 136 } 137 /*}}}*/ 138 139 140 /*ElementResult management*/ 94 141 /*FUNCTION TriaVertexElementResult::EnumType{{{1*/ 95 142 int TriaVertexElementResult::EnumType(void){ … … 99 146 } 100 147 /*}}}*/ 101 /*FUNCTION TriaVertexElementResult::Id{{{1*/102 int TriaVertexElementResult::Id(void){ return -1; }103 /*}}}*/104 /*FUNCTION TriaVertexElementResult::Marshall{{{1*/105 void TriaVertexElementResult::Marshall(char** pmarshalled_dataset){106 107 char* marshalled_dataset=NULL;108 int enum_value=0;109 110 111 /*recover marshalled_dataset: */112 marshalled_dataset=*pmarshalled_dataset;113 114 /*get enum value of TriaVertexElementResult: */115 enum_value=TriaVertexElementResultEnum;116 117 /*marshall enum: */118 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);119 120 /*marshall TriaVertexElementResult data: */121 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);122 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);123 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);124 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);125 126 *pmarshalled_dataset=marshalled_dataset;127 }128 /*}}}*/129 /*FUNCTION TriaVertexElementResult::MarshallSize{{{1*/130 int TriaVertexElementResult::MarshallSize(){131 132 return sizeof(values)133 +sizeof(enum_type)134 +sizeof(time)135 +sizeof(step)136 +sizeof(int); //sizeof(int) for enum value137 }138 /*}}}*/139 /*FUNCTION TriaVertexElementResult::MyRank{{{1*/140 int TriaVertexElementResult::MyRank(void){141 extern int my_rank;142 return my_rank;143 }144 /*}}}*/145 146 /*ElementResult functions*/147 148 /*FUNCTION TriaVertexElementResult::SpawnSingElementResult{{{1*/ 148 149 ElementResult* TriaVertexElementResult::SpawnSingElementResult(int index){ -
issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.h
r4244 r4248 23 23 public: 24 24 25 /* constructors, destructors: {{{1*/25 /*TriaVertexElementResult constructors, destructors: {{{1*/ 26 26 TriaVertexElementResult(); 27 27 TriaVertexElementResult(int enum_type,double* values,int step,double time); 28 28 ~TriaVertexElementResult(); 29 29 /*}}}*/ 30 /*object management: {{{1*/ 30 /*Object virtual functions definitions:{{{1 */ 31 void Echo(); 31 32 void DeepEcho(); 32 void Echo();33 33 int Id(); 34 int MyRank(); 34 35 void Marshall(char** pmarshalled_dataset); 35 36 int MarshallSize(); 36 37 void Demarshall(char** pmarshalled_dataset); 37 38 int Enum(); 38 int MyRank();39 39 Object* copy(); 40 int EnumType();41 40 /*}}}*/ 42 /* result virtual functions: {{{1*/41 /*ElementResult virtual functions definitions: {{{1*/ 43 42 ElementResult* SpawnSingElementResult(int index); 44 43 ElementResult* SpawnBeamElementResult(int* indices); … … 48 47 void PatchFill(int row, Patch* patch); 49 48 /*}}}*/ 49 /*TriaVertexElementResult management: {{{1*/ 50 int EnumType(); 51 /*}}}*/ 50 52 51 53 }; -
issm/trunk/src/c/objects/Elements/Beam.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Objectconstructors and destructor*/19 /*Beam constructors and destructor*/ 20 20 /*FUNCTION Beam::Beam(){{{1*/ 21 21 Beam::Beam(){ … … 37 37 /*}}}*/ 38 38 39 /*Object management*/ 40 /*FUNCTION Beam::copy{{{1*/ 41 Object* Beam::copy() { 42 43 int i; 44 Beam* beam=NULL; 45 46 beam=new Beam(); 47 48 /*copy fields: */ 49 beam->id=this->id; 50 if(this->inputs){ 51 beam->inputs=(Inputs*)this->inputs->Copy(); 52 } 53 else{ 54 beam->inputs=new Inputs(); 55 } 56 /*point parameters: */ 57 beam->parameters=this->parameters; 58 59 /*pointers: */ 60 beam->nodes=(Node**)xmalloc(2*sizeof(Node*)); 61 for(i=0;i<2;i++)beam->nodes[i]=this->nodes[i]; 62 beam->matice=this->matice; 63 beam->matpar=this->matpar; 64 65 return beam; 66 } 67 /*}}}*/ 68 /*FUNCTION Beam::Configure {{{1*/ 69 void Beam::Configure(Elements* elementsin,Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 70 71 ISSMERROR(" not supported yet!"); 72 73 } 74 /*}}}*/ 39 /*Object virtual functions definitions: */ 75 40 /*FUNCTION Beam::DeepEcho{{{1*/ 76 41 void Beam::DeepEcho(void){ … … 93 58 } 94 59 /*}}}*/ 60 /*FUNCTION Beam::Id{{{1*/ 61 int Beam::Id(void){ return id; } 62 /*}}}*/ 63 /*FUNCTION Beam::MyRank{{{1*/ 64 int Beam::MyRank(void){ 65 extern int my_rank; 66 return my_rank; 67 } 68 /*}}}*/ 69 /*FUNCTION Beam::Marshall{{{1*/ 70 void Beam::Marshall(char** pmarshalled_dataset){ 71 ISSMERROR("not supported yet!"); 72 } 73 /*}}}*/ 74 /*FUNCTION Beam::MarshallSize{{{1*/ 75 int Beam::MarshallSize(){ 76 ISSMERROR("not supported yet!"); 77 } 78 /*}}}*/ 95 79 /*FUNCTION Beam::Demarshall{{{1*/ 96 80 void Beam::Demarshall(char** pmarshalled_dataset){ 97 81 ISSMERROR("not supported yet!"); 82 } 83 /*}}}*/ 84 /*FUNCTION Beam::Enum{{{1*/ 85 int Beam::Enum(void){ 86 87 return BeamEnum; 88 89 } 90 /*}}}*/ 91 /*FUNCTION Beam::copy{{{1*/ 92 Object* Beam::copy() { 93 94 int i; 95 Beam* beam=NULL; 96 97 beam=new Beam(); 98 99 /*copy fields: */ 100 beam->id=this->id; 101 if(this->inputs){ 102 beam->inputs=(Inputs*)this->inputs->Copy(); 103 } 104 else{ 105 beam->inputs=new Inputs(); 106 } 107 /*point parameters: */ 108 beam->parameters=this->parameters; 109 110 /*pointers: */ 111 beam->nodes=(Node**)xmalloc(2*sizeof(Node*)); 112 for(i=0;i<2;i++)beam->nodes[i]=this->nodes[i]; 113 beam->matice=this->matice; 114 beam->matpar=this->matpar; 115 116 return beam; 117 } 118 /*}}}*/ 119 120 /*Beam management*/ 121 /*FUNCTION Beam::Configure {{{1*/ 122 void Beam::Configure(Elements* elementsin,Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 123 124 ISSMERROR(" not supported yet!"); 125 98 126 } 99 127 /*}}}*/ … … 125 153 } 126 154 else return false; 127 }128 /*}}}*/129 /*FUNCTION Beam::Marshall{{{1*/130 void Beam::Marshall(char** pmarshalled_dataset){131 ISSMERROR("not supported yet!");132 }133 /*}}}*/134 /*FUNCTION Beam::MarshallSize{{{1*/135 int Beam::MarshallSize(){136 ISSMERROR("not supported yet!");137 155 } 138 156 /*}}}*/ … … 442 460 } 443 461 /*}}}*/ 444 /*FUNCTION Beam::Enum{{{1*/445 int Beam::Enum(void){446 447 return BeamEnum;448 449 }450 /*}}}*/451 462 /*FUNCTION Beam::GetBedList{{{1*/ 452 463 void Beam::GetBedList(double*){ … … 483 494 } 484 495 /*}}}*/ 485 /*FUNCTION Beam::Id{{{1*/486 int Beam::Id(void){ return id; }487 /*}}}*/488 496 /*FUNCTION Beam::GetJacobianDeterminant{{{1*/ 489 497 void Beam::GetJacobianDeterminant(double* pJdet,double* z_list, double gauss_coord){ … … 580 588 double Beam::Misfit(void){ 581 589 ISSMERROR(" not supported yet!"); 582 }583 /*}}}*/584 /*FUNCTION Beam::MyRank{{{1*/585 int Beam::MyRank(void){586 extern int my_rank;587 return my_rank;588 590 } 589 591 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Beam.h
r4244 r4248 37 37 38 38 39 /* constructors, destructors: {{{1*/39 /*Beam constructors and destructor: {{{1*/ 40 40 Beam(); 41 41 ~Beam(); … … 43 43 void UpdateGeometry(void){ISSMERROR("not implemented yet");}; 44 44 /*}}}*/ 45 /*Object virtual functions resolution: {{{1*/ 46 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters); 45 /*Object virtual functions definitions: {{{1*/ 47 46 void Echo(); 48 47 void DeepEcho(); 48 int Id(); 49 int MyRank(); 49 50 void Marshall(char** pmarshalled_dataset); 50 51 int MarshallSize(); 51 52 void Demarshall(char** pmarshalled_dataset); 52 53 int Enum(); 53 int Id(); 54 Object* copy(); 55 /*}}}*/ 56 /*Beam management: {{{1*/ 57 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters); 54 58 bool IsInput(int name); 55 int MyRank();56 Object* copy();57 59 void SetClone(int* minranks); 58 60 void InputDepthAverageAtBase(int enum_type,int average_enum_type){ISSMERROR("not implemented yet");}; -
issm/trunk/src/c/objects/Elements/Element.h
r4244 r4248 25 25 26 26 virtual ~Element(){}; 27 27 28 virtual void Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0; 28 29 29 virtual void CreateKMatrix(Mat Kgg)=0; 30 30 virtual void CreatePVector(Vec pg)=0; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*Penta constructors and destructor*/ 23 23 /*FUNCTION Penta::Penta(){{{1*/ 24 24 Penta::Penta(){ … … 229 229 } 230 230 /*}}}*/ 231 /*FUNCTION Penta::copy {{{1*/ 232 Object* Penta::copy() { 233 234 int i; 235 236 Penta* penta=NULL; 237 238 penta=new Penta(); 239 240 /*copy fields: */ 241 penta->id=this->id; 242 if(this->inputs){ 243 penta->inputs=(Inputs*)this->inputs->Copy(); 244 } 245 else{ 246 penta->inputs=new Inputs(); 247 } 248 if(this->results){ 249 penta->results=(Results*)this->results->Copy(); 250 } 251 else{ 252 penta->results=new Results(); 253 } 254 /*point parameters: */ 255 penta->parameters=this->parameters; 256 257 /*now deal with hooks and objects: */ 258 penta->InitHookNodes(this->numanalyses); 259 for(i=0;i<this->numanalyses;i++)penta->hnodes[i].copy(&this->hnodes[i]); 260 penta->hmatice.copy(&this->hmatice); 261 penta->hmatpar.copy(&this->hmatpar); 262 penta->hneighbors.copy(&this->hneighbors); 263 264 /*recover objects: */ 265 penta->nodes=(Node**)xmalloc(6*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 266 for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i]; 267 penta->matice=(Matice*)penta->hmatice.delivers(); 268 penta->matpar=(Matpar*)penta->hmatpar.delivers(); 269 penta->neighbors=(Penta**)penta->hneighbors.deliverp(); 270 271 return penta; 272 } 273 /*}}}*/ 274 275 /*Object management: */ 276 /*FUNCTION Penta::Configure {{{1*/ 277 void Penta::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 278 279 int analysis_counter; 280 281 /*go into parameters and get the analysis_counter: */ 282 parametersin->FindParam(&analysis_counter,AnalysisCounterEnum); 283 284 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 285 * datasets, using internal ids and offsets hidden in hooks: */ 286 this->hnodes[analysis_counter].configure(nodesin); 287 this->hmatice.configure(materialsin); 288 this->hmatpar.configure(materialsin); 289 this->hneighbors.configure(elementsin); 290 291 /*Now, go pick up the objects inside the hooks: */ 292 this->nodes=(Node**)this->hnodes[analysis_counter].deliverp(); 293 this->matice=(Matice*)this->hmatice.delivers(); 294 this->matpar=(Matpar*)this->hmatpar.delivers(); 295 this->neighbors=(Penta**)this->hneighbors.deliverp(); 296 297 /*point parameters to real dataset: */ 298 this->parameters=parametersin; 299 } 300 /*}}}*/ 301 /*FUNCTION Penta::Demarshall {{{1*/ 302 void Penta::Demarshall(char** pmarshalled_dataset){ 303 304 char* marshalled_dataset=NULL; 305 int i; 306 307 /*recover marshalled_dataset: */ 308 marshalled_dataset=*pmarshalled_dataset; 309 310 /*this time, no need to get enum type, the pointer directly points to the beginning of the 311 *object data (thanks to DataSet::Demarshall):*/ 312 313 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 314 memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 315 316 /*allocate dynamic memory: */ 317 collapse=(bool*)xmalloc(numanalyses*sizeof(bool)); 318 InitHookNodes(numanalyses); 319 320 /*demarshall hooks: */ 321 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 322 hmatice.Demarshall(&marshalled_dataset); 323 hmatpar.Demarshall(&marshalled_dataset); 324 hneighbors.Demarshall(&marshalled_dataset); 325 326 /*pointers are garbage, until configuration is carried out: */ 327 nodes=NULL; 328 matice=NULL; 329 matpar=NULL; 330 neighbors=NULL; 331 332 /*demarshall inputs and results: */ 333 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 334 results=(Results*)DataSetDemarshallRaw(&marshalled_dataset); 335 336 /*demarshall internal parameters: */ 337 memcpy(collapse,marshalled_dataset,numanalyses*sizeof(bool));marshalled_dataset+=numanalyses*sizeof(bool); 338 339 /*parameters: may not exist even yet, so let Configure handle it: */ 340 this->parameters=NULL; 341 342 /*return: */ 343 *pmarshalled_dataset=marshalled_dataset; 344 return; 231 232 /*Object virtual functions definitions: */ 233 /*FUNCTION Penta::Echo{{{1*/ 234 235 void Penta::Echo(void){ 236 this->DeepEcho(); 345 237 } 346 238 /*}}}*/ … … 372 264 } 373 265 /*}}}*/ 374 /*FUNCTION Penta::Echo{{{1*/ 375 376 void Penta::Echo(void){ 377 this->DeepEcho(); 378 } 379 /*}}}*/ 380 /*FUNCTION Penta::Enum {{{1*/ 381 int Penta::Enum(void){ 382 383 return PentaEnum; 384 266 /*FUNCTION Penta::Id {{{1*/ 267 int Penta::Id(void){ 268 return id; 269 } 270 /*}}}*/ 271 /*FUNCTION Penta::MyRank {{{1*/ 272 int Penta::MyRank(void){ 273 extern int my_rank; 274 return my_rank; 385 275 } 386 276 /*}}}*/ … … 455 345 +numanalyses*sizeof(bool) 456 346 +sizeof(int); //sizeof(int) for enum type 347 } 348 /*}}}*/ 349 /*FUNCTION Penta::Demarshall {{{1*/ 350 void Penta::Demarshall(char** pmarshalled_dataset){ 351 352 char* marshalled_dataset=NULL; 353 int i; 354 355 /*recover marshalled_dataset: */ 356 marshalled_dataset=*pmarshalled_dataset; 357 358 /*this time, no need to get enum type, the pointer directly points to the beginning of the 359 *object data (thanks to DataSet::Demarshall):*/ 360 361 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 362 memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 363 364 /*allocate dynamic memory: */ 365 collapse=(bool*)xmalloc(numanalyses*sizeof(bool)); 366 InitHookNodes(numanalyses); 367 368 /*demarshall hooks: */ 369 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 370 hmatice.Demarshall(&marshalled_dataset); 371 hmatpar.Demarshall(&marshalled_dataset); 372 hneighbors.Demarshall(&marshalled_dataset); 373 374 /*pointers are garbage, until configuration is carried out: */ 375 nodes=NULL; 376 matice=NULL; 377 matpar=NULL; 378 neighbors=NULL; 379 380 /*demarshall inputs and results: */ 381 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 382 results=(Results*)DataSetDemarshallRaw(&marshalled_dataset); 383 384 /*demarshall internal parameters: */ 385 memcpy(collapse,marshalled_dataset,numanalyses*sizeof(bool));marshalled_dataset+=numanalyses*sizeof(bool); 386 387 /*parameters: may not exist even yet, so let Configure handle it: */ 388 this->parameters=NULL; 389 390 /*return: */ 391 *pmarshalled_dataset=marshalled_dataset; 392 return; 393 } 394 /*}}}*/ 395 /*FUNCTION Penta::Enum {{{1*/ 396 int Penta::Enum(void){ 397 398 return PentaEnum; 399 400 } 401 /*}}}*/ 402 /*FUNCTION Penta::copy {{{1*/ 403 Object* Penta::copy() { 404 405 int i; 406 407 Penta* penta=NULL; 408 409 penta=new Penta(); 410 411 /*copy fields: */ 412 penta->id=this->id; 413 if(this->inputs){ 414 penta->inputs=(Inputs*)this->inputs->Copy(); 415 } 416 else{ 417 penta->inputs=new Inputs(); 418 } 419 if(this->results){ 420 penta->results=(Results*)this->results->Copy(); 421 } 422 else{ 423 penta->results=new Results(); 424 } 425 /*point parameters: */ 426 penta->parameters=this->parameters; 427 428 /*now deal with hooks and objects: */ 429 penta->InitHookNodes(this->numanalyses); 430 for(i=0;i<this->numanalyses;i++)penta->hnodes[i].copy(&this->hnodes[i]); 431 penta->hmatice.copy(&this->hmatice); 432 penta->hmatpar.copy(&this->hmatpar); 433 penta->hneighbors.copy(&this->hneighbors); 434 435 /*recover objects: */ 436 penta->nodes=(Node**)xmalloc(6*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 437 for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i]; 438 penta->matice=(Matice*)penta->hmatice.delivers(); 439 penta->matpar=(Matpar*)penta->hmatpar.delivers(); 440 penta->neighbors=(Penta**)penta->hneighbors.deliverp(); 441 442 return penta; 443 } 444 /*}}}*/ 445 446 447 /*Penta functionality: */ 448 /*FUNCTION Penta::Configure {{{1*/ 449 void Penta::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 450 451 int analysis_counter; 452 453 /*go into parameters and get the analysis_counter: */ 454 parametersin->FindParam(&analysis_counter,AnalysisCounterEnum); 455 456 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 457 * datasets, using internal ids and offsets hidden in hooks: */ 458 this->hnodes[analysis_counter].configure(nodesin); 459 this->hmatice.configure(materialsin); 460 this->hmatpar.configure(materialsin); 461 this->hneighbors.configure(elementsin); 462 463 /*Now, go pick up the objects inside the hooks: */ 464 this->nodes=(Node**)this->hnodes[analysis_counter].deliverp(); 465 this->matice=(Matice*)this->hmatice.delivers(); 466 this->matpar=(Matpar*)this->hmatpar.delivers(); 467 this->neighbors=(Penta**)this->hneighbors.deliverp(); 468 469 /*point parameters to real dataset: */ 470 this->parameters=parametersin; 457 471 } 458 472 /*}}}*/ … … 3820 3834 } 3821 3835 3822 }3823 /*}}}*/3824 /*FUNCTION Penta::Id {{{1*/3825 int Penta::Id(void){3826 return id;3827 3836 } 3828 3837 /*}}}*/ … … 4643 4652 } 4644 4653 /*}}}*/ 4645 /*FUNCTION Penta::MyRank {{{1*/4646 int Penta::MyRank(void){4647 extern int my_rank;4648 return my_rank;4649 }4650 /*}}}*/4651 4654 /*FUNCTION Penta::ReduceMatrixStokes {{{1*/ 4652 4655 void Penta::ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp){ -
issm/trunk/src/c/objects/Elements/Penta.h
r4244 r4248 41 41 bool *collapse; //collapse elements, depending on analysis_type 42 42 43 /* FUNCTION constructors, destructors{{{1*/43 /*Penta constructors and destructor: {{{1*/ 44 44 Penta(); 45 45 Penta(int penta_id,int i, IoModel* iomodel,int nummodels); … … 48 48 ~Penta(); 49 49 /*}}}*/ 50 /*Object virtual functions resolution: {{{1*/ 50 /*Object virtual functions definitions: {{{1*/ 51 void Echo(); 52 void DeepEcho(); 53 int Id(); 54 int MyRank(); 55 void Marshall(char** pmarshalled_dataset); 56 int MarshallSize(); 57 void Demarshall(char** pmarshalled_dataset); 58 int Enum(); 59 Object* copy(); 60 /*}}}*/ 61 /*Penta management: {{{1*/ 51 62 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters); 52 Object* copy();53 void DeepEcho();54 void Demarshall(char** pmarshalled_dataset);55 void Echo();56 int Enum();57 int Id();58 63 bool IsInput(int name); 59 64 bool IsOnSurface(void); 60 65 Penta* GetUpperElement(void); 61 void Marshall(char** pmarshalled_dataset);62 int MarshallSize();63 int MyRank();64 66 void* SpawnSing(int g0); 65 67 void* SpawnBeam(int g0, int g1); -
issm/trunk/src/c/objects/Elements/Sing.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Objectconstructors and destructor*/19 /*Sing constructors and destructor*/ 20 20 /*FUNCTION Sing::Sing(){{{1*/ 21 21 Sing::Sing(){ … … 37 37 /*}}}*/ 38 38 39 /*Object management*/ 40 /*FUNCTION Sing::Configure {{{1*/ 41 void Sing::Configure(Elements* elementsin,Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 42 43 ISSMERROR(" not supported yet!"); 44 45 } 46 /*}}}*/ 47 /*FUNCTION Sing::copy {{{1*/ 48 Object* Sing::copy() { 49 50 int i; 51 Sing* sing=NULL; 52 53 sing=new Sing(); 54 55 /*copy fields: */ 56 sing->id=this->id; 57 if(this->inputs){ 58 sing->inputs=(Inputs*)this->inputs->Copy(); 59 } 60 else{ 61 sing->inputs=new Inputs(); 62 } 63 /*point parameters: */ 64 sing->parameters=this->parameters; 65 66 /*pointers: */ 67 sing->node=this->node; 68 sing->matice=this->matice; 69 sing->matpar=this->matpar; 70 71 return sing; 39 /*Object virtual functions definitions: */ 40 /*FUNCTION Sing::Echo{{{1*/ 41 42 void Sing::Echo(void){ 43 44 printf("Sing:\n"); 45 printf(" id: %i\n",id); 46 node->Echo(); 47 matice->Echo(); 48 matpar->Echo(); 49 printf(" parameters\n"); 50 parameters->Echo(); 51 printf(" inputs\n"); 52 inputs->Echo(); 72 53 } 73 54 /*}}}*/ … … 88 69 } 89 70 /*}}}*/ 71 /*FUNCTION Sing::Id {{{1*/ 72 int Sing::Id(void){ return id; } 73 /*}}}*/ 74 /*FUNCTION Sing::MyRank {{{1*/ 75 int Sing::MyRank(void){ 76 extern int my_rank; 77 return my_rank; 78 } 79 /*}}}*/ 80 /*FUNCTION Sing::Marshall {{{1*/ 81 void Sing::Marshall(char** pmarshalled_dataset){ 82 ISSMERROR(" not supported yet!"); 83 } 84 /*}}}*/ 85 /*FUNCTION Sing::MashallSize {{{1*/ 86 int Sing::MarshallSize(){ 87 ISSMERROR(" not supported yet!"); 88 } 89 /*}}}*/ 90 90 /*FUNCTION Sing::Demarshall {{{1*/ 91 91 void Sing::Demarshall(char** pmarshalled_dataset){ … … 93 93 } 94 94 /*}}}*/ 95 /*FUNCTION Sing::Echo{{{1*/ 96 97 void Sing::Echo(void){ 98 99 printf("Sing:\n"); 100 printf(" id: %i\n",id); 101 node->Echo(); 102 matice->Echo(); 103 matpar->Echo(); 104 printf(" parameters\n"); 105 parameters->Echo(); 106 printf(" inputs\n"); 107 inputs->Echo(); 95 /*FUNCTION Sing::Enum {{{1*/ 96 int Sing::Enum(void){ 97 98 return SingEnum; 99 100 } 101 /*}}}*/ 102 /*FUNCTION Sing::copy {{{1*/ 103 Object* Sing::copy() { 104 105 int i; 106 Sing* sing=NULL; 107 108 sing=new Sing(); 109 110 /*copy fields: */ 111 sing->id=this->id; 112 if(this->inputs){ 113 sing->inputs=(Inputs*)this->inputs->Copy(); 114 } 115 else{ 116 sing->inputs=new Inputs(); 117 } 118 /*point parameters: */ 119 sing->parameters=this->parameters; 120 121 /*pointers: */ 122 sing->node=this->node; 123 sing->matice=this->matice; 124 sing->matpar=this->matpar; 125 126 return sing; 127 } 128 /*}}}*/ 129 130 /*Sing management*/ 131 /*FUNCTION Sing::Configure {{{1*/ 132 void Sing::Configure(Elements* elementsin,Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 133 134 ISSMERROR(" not supported yet!"); 135 108 136 } 109 137 /*}}}*/ … … 117 145 } 118 146 /*}}}*/ 119 /*FUNCTION Sing::Marshall {{{1*/120 void Sing::Marshall(char** pmarshalled_dataset){121 ISSMERROR(" not supported yet!");122 }123 /*}}}*/124 /*FUNCTION Sing::MashallSize {{{1*/125 int Sing::MarshallSize(){126 ISSMERROR(" not supported yet!");127 }128 /*}}}*/129 147 /*FUNCTION Sing::InputUpdateFromSolution {{{1*/ 130 148 void Sing::InputUpdateFromSolution(double* solution){ … … 148 166 /*}}}*/ 149 167 150 /* Objectfunctions*/168 /*Sing functions*/ 151 169 /*FUNCTION Sing::ComputeBasalStress {{{1*/ 152 170 void Sing::ComputeBasalStress(Vec p_g){ … … 304 322 } 305 323 /*}}}*/ 306 /*FUNCTION Sing::Enum {{{1*/307 int Sing::Enum(void){308 309 return SingEnum;310 311 }312 /*}}}*/313 324 /*FUNCTION Sing::GetBedList {{{1*/ 314 325 void Sing::GetBedList(double*){ … … 341 352 } 342 353 /*}}}*/ 343 /*FUNCTION Sing::Id {{{1*/344 int Sing::Id(void){ return id; }345 /*}}}*/346 354 /*FUNCTION Sing::GetMatPar {{{1*/ 347 355 void* Sing::GetMatPar(){ … … 399 407 double Sing::Misfit(void){ 400 408 ISSMERROR(" not supported yet!"); 401 }402 /*}}}*/403 /*FUNCTION Sing::MyRank {{{1*/404 int Sing::MyRank(void){405 extern int my_rank;406 return my_rank;407 409 } 408 410 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Sing.h
r4244 r4248 37 37 38 38 39 /* constructors, destructors: {{{1*/39 /*Sing constructors, destructors: {{{1*/ 40 40 Sing(); 41 41 ~Sing(); … … 43 43 void UpdateGeometry(void){ISSMERROR("not implemented yet");}; 44 44 /*}}}*/ 45 /*Object virtual functions resolution: {{{1*/ 46 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters); 47 Object* copy(); 45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 48 47 void DeepEcho(); 49 void Demarshall(char** pmarshalled_dataset);50 void Echo();51 int Enum();52 48 int Id(); 53 bool IsInput(int name);49 int MyRank(); 54 50 void Marshall(char** pmarshalled_dataset); 55 51 int MarshallSize(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 55 /*}}}*/ 56 /*Sing managemnet: {{{1*/ 57 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters); 58 bool IsInput(int name); 56 59 void SetClone(int* minranks); 57 int MyRank();58 60 void InputDepthAverageAtBase(int enum_type,int average_enum_type){ISSMERROR("not implemented yet");}; 59 61 void InputToResult(int enum_type,int step,double time); … … 69 71 void InputUpdateFromSolution(double* solutiong); 70 72 /*}}}*/ 71 72 73 /*numerics: {{{1*/ 73 74 void CreateKMatrix(Mat Kggg); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*Tria constructors and destructor*/ 23 23 /*FUNCTION Tria::Tria(){{{1*/ 24 24 Tria::Tria(){ … … 212 212 } 213 213 /*}}}*/ 214 /*FUNCTION Tria::copy {{{1*/ 215 Object* Tria::copy() { 216 217 int i; 218 Tria* tria=NULL; 219 220 tria=new Tria(); 221 222 /*copy fields: */ 223 tria->id=this->id; 224 tria->interpolation_type=this->interpolation_type; 225 if(this->inputs){ 226 tria->inputs=(Inputs*)this->inputs->Copy(); 227 } 228 else{ 229 tria->inputs=new Inputs(); 230 } 231 if(this->results){ 232 tria->results=(Results*)this->results->Copy(); 233 } 234 else{ 235 tria->results=new Results(); 236 } 237 /*point parameters: */ 238 tria->parameters=this->parameters; 239 240 /*now deal with hooks and objects: */ 241 tria->InitHookNodes(this->numanalyses); 242 for(i=0;i<this->numanalyses;i++)tria->hnodes[i].copy(&this->hnodes[i]); 243 tria->hmatice.copy(&this->hmatice); 244 tria->hmatpar.copy(&this->hmatpar); 245 246 /*recover objects: */ 247 tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 248 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i]; 249 tria->matice=(Matice*)tria->hmatice.delivers(); 250 tria->matpar=(Matpar*)tria->hmatpar.delivers(); 251 252 return tria; 253 } 254 /*}}}*/ 255 256 /*Object management: */ 257 /*FUNCTION Tria::Configure {{{1*/ 258 void Tria::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 259 260 int analysis_counter; 261 262 /*go into parameters and get the analysis_counter: */ 263 parametersin->FindParam(&analysis_counter,AnalysisCounterEnum); 264 265 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 266 * datasets, using internal ids and offsets hidden in hooks: */ 267 this->hnodes[analysis_counter].configure(nodesin); 268 this->hmatice.configure(materialsin); 269 this->hmatpar.configure(materialsin); 270 271 /*Now, go pick up the objects inside the hooks: */ 272 this->nodes=(Node**)this->hnodes[analysis_counter].deliverp(); 273 this->matice=(Matice*)this->hmatice.delivers(); 274 this->matpar=(Matpar*)this->hmatpar.delivers(); 275 276 /*point parameters to real dataset: */ 277 this->parameters=parametersin; 278 279 } 280 /*}}}*/ 281 /*FUNCTION Tria::Demarshall {{{1*/ 282 void Tria::Demarshall(char** pmarshalled_dataset){ 283 284 char* marshalled_dataset=NULL; 285 int i; 286 287 /*recover marshalled_dataset: */ 288 marshalled_dataset=*pmarshalled_dataset; 289 290 /*this time, no need to get enum type, the pointer directly points to the beginning of the 291 *object data (thanks to DataSet::Demarshall):*/ 292 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 293 memcpy(&interpolation_type,marshalled_dataset,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type); 294 memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 295 296 /*allocate dynamic memory: */ 297 InitHookNodes(numanalyses); 298 299 /*demarshall hooks: */ 300 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 301 hmatice.Demarshall(&marshalled_dataset); 302 hmatpar.Demarshall(&marshalled_dataset); 303 304 /*pointers are garbabe, until configuration is carried out: */ 305 nodes=NULL; 306 matice=NULL; 307 matpar=NULL; 308 309 /*demarshall inputs: */ 310 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 311 results=(Results*)DataSetDemarshallRaw(&marshalled_dataset); 312 313 /*parameters: may not exist even yet, so let Configure handle it: */ 314 this->parameters=NULL; 315 316 /*return: */ 317 *pmarshalled_dataset=marshalled_dataset; 318 return; 319 } 320 /*}}}*/ 321 /*FUNCTION Tria::DeepEcho{{{1*/ 322 void Tria::DeepEcho(void){ 323 324 printf("Tria:\n"); 325 printf(" id: %i\n",id); 326 if(nodes){ 327 nodes[0]->DeepEcho(); 328 nodes[1]->DeepEcho(); 329 nodes[2]->DeepEcho(); 330 } 331 else printf("nodes = NULL\n"); 332 333 if (matice) matice->DeepEcho(); 334 else printf("matice = NULL\n"); 335 336 if (matpar) matpar->DeepEcho(); 337 else printf("matpar = NULL\n"); 338 339 printf(" parameters\n"); 340 if (parameters) parameters->DeepEcho(); 341 else printf("parameters = NULL\n"); 342 343 printf(" inputs\n"); 344 if (inputs) inputs->DeepEcho(); 345 else printf("inputs=NULL\n"); 346 347 if (results) results->DeepEcho(); 348 else printf("results=NULL\n"); 349 350 return; 351 } 352 /*}}}*/ 214 215 /*Object virtual functions definitions:*/ 353 216 /*FUNCTION Tria::Echo{{{1*/ 354 217 void Tria::Echo(void){ … … 378 241 if (results) results->Echo(); 379 242 else printf("results=NULL\n"); 243 } 244 /*}}}*/ 245 /*FUNCTION Tria::DeepEcho{{{1*/ 246 void Tria::DeepEcho(void){ 247 248 printf("Tria:\n"); 249 printf(" id: %i\n",id); 250 if(nodes){ 251 nodes[0]->DeepEcho(); 252 nodes[1]->DeepEcho(); 253 nodes[2]->DeepEcho(); 254 } 255 else printf("nodes = NULL\n"); 256 257 if (matice) matice->DeepEcho(); 258 else printf("matice = NULL\n"); 259 260 if (matpar) matpar->DeepEcho(); 261 else printf("matpar = NULL\n"); 262 263 printf(" parameters\n"); 264 if (parameters) parameters->DeepEcho(); 265 else printf("parameters = NULL\n"); 266 267 printf(" inputs\n"); 268 if (inputs) inputs->DeepEcho(); 269 else printf("inputs=NULL\n"); 270 271 if (results) results->DeepEcho(); 272 else printf("results=NULL\n"); 273 274 return; 275 } 276 /*}}}*/ 277 /*FUNCTION Tria::Id {{{1*/ 278 int Tria::Id(){ return id; } 279 /*}}}*/ 280 /*FUNCTION Tria::MyRank {{{1*/ 281 int Tria::MyRank(void){ 282 extern int my_rank; 283 return my_rank; 380 284 } 381 285 /*}}}*/ … … 448 352 +results->MarshallSize() 449 353 +sizeof(int); //sizeof(int) for enum type 354 } 355 /*}}}*/ 356 /*FUNCTION Tria::Demarshall {{{1*/ 357 void Tria::Demarshall(char** pmarshalled_dataset){ 358 359 char* marshalled_dataset=NULL; 360 int i; 361 362 /*recover marshalled_dataset: */ 363 marshalled_dataset=*pmarshalled_dataset; 364 365 /*this time, no need to get enum type, the pointer directly points to the beginning of the 366 *object data (thanks to DataSet::Demarshall):*/ 367 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 368 memcpy(&interpolation_type,marshalled_dataset,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type); 369 memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 370 371 /*allocate dynamic memory: */ 372 InitHookNodes(numanalyses); 373 374 /*demarshall hooks: */ 375 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 376 hmatice.Demarshall(&marshalled_dataset); 377 hmatpar.Demarshall(&marshalled_dataset); 378 379 /*pointers are garbabe, until configuration is carried out: */ 380 nodes=NULL; 381 matice=NULL; 382 matpar=NULL; 383 384 /*demarshall inputs: */ 385 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 386 results=(Results*)DataSetDemarshallRaw(&marshalled_dataset); 387 388 /*parameters: may not exist even yet, so let Configure handle it: */ 389 this->parameters=NULL; 390 391 /*return: */ 392 *pmarshalled_dataset=marshalled_dataset; 393 return; 394 } 395 /*}}}*/ 396 /*FUNCTION Tria::Enum {{{1*/ 397 int Tria::Enum(void){ 398 399 return TriaEnum; 400 401 } 402 /*}}}*/ 403 /*FUNCTION Tria::copy {{{1*/ 404 Object* Tria::copy() { 405 406 int i; 407 Tria* tria=NULL; 408 409 tria=new Tria(); 410 411 /*copy fields: */ 412 tria->id=this->id; 413 tria->interpolation_type=this->interpolation_type; 414 if(this->inputs){ 415 tria->inputs=(Inputs*)this->inputs->Copy(); 416 } 417 else{ 418 tria->inputs=new Inputs(); 419 } 420 if(this->results){ 421 tria->results=(Results*)this->results->Copy(); 422 } 423 else{ 424 tria->results=new Results(); 425 } 426 /*point parameters: */ 427 tria->parameters=this->parameters; 428 429 /*now deal with hooks and objects: */ 430 tria->InitHookNodes(this->numanalyses); 431 for(i=0;i<this->numanalyses;i++)tria->hnodes[i].copy(&this->hnodes[i]); 432 tria->hmatice.copy(&this->hmatice); 433 tria->hmatpar.copy(&this->hmatpar); 434 435 /*recover objects: */ 436 tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 437 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i]; 438 tria->matice=(Matice*)tria->hmatice.delivers(); 439 tria->matpar=(Matpar*)tria->hmatpar.delivers(); 440 441 return tria; 442 } 443 /*}}}*/ 444 445 /*Tria management: */ 446 /*FUNCTION Tria::Configure {{{1*/ 447 void Tria::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 448 449 int analysis_counter; 450 451 /*go into parameters and get the analysis_counter: */ 452 parametersin->FindParam(&analysis_counter,AnalysisCounterEnum); 453 454 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 455 * datasets, using internal ids and offsets hidden in hooks: */ 456 this->hnodes[analysis_counter].configure(nodesin); 457 this->hmatice.configure(materialsin); 458 this->hmatpar.configure(materialsin); 459 460 /*Now, go pick up the objects inside the hooks: */ 461 this->nodes=(Node**)this->hnodes[analysis_counter].deliverp(); 462 this->matice=(Matice*)this->hmatice.delivers(); 463 this->matpar=(Matpar*)this->hmatpar.delivers(); 464 465 /*point parameters to real dataset: */ 466 this->parameters=parametersin; 467 450 468 } 451 469 /*}}}*/ … … 3625 3643 } 3626 3644 /*}}}*/ 3627 /*FUNCTION Tria::Enum {{{1*/3628 int Tria::Enum(void){3629 3630 return TriaEnum;3631 3632 }3633 /*}}}*/3634 3645 /*FUNCTION Tria::GetArea {{{1*/ 3635 3646 double Tria::GetArea(void){ … … 3861 3872 3862 3873 } 3863 /*}}}*/3864 /*FUNCTION Tria::Id {{{1*/3865 int Tria::Id(){ return id; }3866 3874 /*}}}*/ 3867 3875 /*FUNCTION Tria::GetJacobian {{{1*/ … … 4921 4929 } 4922 4930 /*}}}*/ 4923 /*FUNCTION Tria::MyRank {{{1*/4924 int Tria::MyRank(void){4925 extern int my_rank;4926 return my_rank;4927 }4928 /*}}}*/4929 4931 /*FUNCTION Tria::Tria::SetClone {{{1*/ 4930 4932 void Tria::SetClone(int* minranks){ -
issm/trunk/src/c/objects/Elements/Tria.h
r4244 r4248 36 36 Results* results; 37 37 38 /* FUNCTIONconstructors, destructors {{{1*/38 /*Tria constructors, destructors {{{1*/ 39 39 Tria(); 40 40 Tria(int tria_id,int i, IoModel* iomodel,int nummodels); … … 43 43 ~Tria(); 44 44 /*}}}*/ 45 /*Object virtual functions resolution: {{{1*/ 45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 47 void DeepEcho(); 48 int Id(); 49 int MyRank(); 50 void Marshall(char** pmarshalled_dataset); 51 int MarshallSize(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 55 /*}}}*/ 56 /*Tria management:{{{1*/ 46 57 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters); 47 Object* copy();48 void DeepEcho(void);49 void Demarshall(char** pmarshalled_dataset);50 void Echo(void);51 int Enum(void);52 int Id(void);53 58 bool IsInput(int name); 54 void Marshall(char** pmarshalled_dataset);55 int MarshallSize(void);56 int MyRank(void);57 59 void SetClone(int* minranks); 58 60 void InputDepthAverageAtBase(int enum_type,int average_enum_type); -
issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*BoolExternalResult constructors and destructor*/ 23 23 /*FUNCTION BoolExternalResult::BoolExternalResult(){{{1*/ 24 24 BoolExternalResult::BoolExternalResult(){ … … 42 42 /*}}}*/ 43 43 44 /*Object methods*/ 45 /*FUNCTION BoolExternalResult::copy{{{1*/ 46 Object* BoolExternalResult::copy() { 47 48 return new BoolExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 49 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION BoolExternalResult::Echo {{{1*/ 46 void BoolExternalResult::Echo(void){ 47 this->DeepEcho(); 50 48 } 51 49 /*}}}*/ … … 59 57 printf(" step: %i\n",this->step); 60 58 printf(" time: %g\n",this->time); 59 } 60 /*}}}*/ 61 /*FUNCTION BoolExternalResult::Id{{{1*/ 62 int BoolExternalResult::Id(void){ return -1; } 63 /*}}}*/ 64 /*FUNCTION BoolExternalResult::MyRank{{{1*/ 65 int BoolExternalResult::MyRank(void){ 66 extern int my_rank; 67 return my_rank; 68 } 69 /*}}}*/ 70 /*FUNCTION BoolExternalResult::Marshall{{{1*/ 71 void BoolExternalResult::Marshall(char** pmarshalled_dataset){ 72 73 char* marshalled_dataset=NULL; 74 int enum_value=0; 75 76 /*recover marshalled_dataset: */ 77 marshalled_dataset=*pmarshalled_dataset; 78 79 /*get enum value of BoolExternalResult: */ 80 enum_value=BoolExternalResultEnum; 81 82 /*marshall enum: */ 83 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 84 85 /*marshall BoolExternalResult data: */ 86 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 87 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 88 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 89 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 90 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 91 92 *pmarshalled_dataset=marshalled_dataset; 93 } 94 /*}}}*/ 95 /*FUNCTION BoolExternalResult::MarshallSize{{{1*/ 96 int BoolExternalResult::MarshallSize(){ 97 98 return sizeof(value)+ 99 +sizeof(id) 100 +sizeof(enum_type) 101 +sizeof(step) 102 +sizeof(time) 103 +sizeof(int); //sizeof(int) for enum value 61 104 } 62 105 /*}}}*/ … … 83 126 } 84 127 /*}}}*/ 85 /*FUNCTION BoolExternalResult::Echo {{{1*/86 void BoolExternalResult::Echo(void){87 this->DeepEcho();88 }89 /*}}}*/90 128 /*FUNCTION BoolExternalResult::Enum{{{1*/ 91 129 int BoolExternalResult::Enum(void){ … … 95 133 } 96 134 /*}}}*/ 97 /*FUNCTION BoolExternalResult::Id{{{1*/ 98 int BoolExternalResult::Id(void){ return -1; } 99 /*}}}*/ 100 /*FUNCTION BoolExternalResult::Marshall{{{1*/ 101 void BoolExternalResult::Marshall(char** pmarshalled_dataset){ 102 103 char* marshalled_dataset=NULL; 104 int enum_value=0; 105 106 /*recover marshalled_dataset: */ 107 marshalled_dataset=*pmarshalled_dataset; 108 109 /*get enum value of BoolExternalResult: */ 110 enum_value=BoolExternalResultEnum; 111 112 /*marshall enum: */ 113 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 114 115 /*marshall BoolExternalResult data: */ 116 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 117 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 118 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 119 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 120 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 121 122 *pmarshalled_dataset=marshalled_dataset; 123 } 124 /*}}}*/ 125 /*FUNCTION BoolExternalResult::MarshallSize{{{1*/ 126 int BoolExternalResult::MarshallSize(){ 127 128 return sizeof(value)+ 129 +sizeof(id) 130 +sizeof(enum_type) 131 +sizeof(step) 132 +sizeof(time) 133 +sizeof(int); //sizeof(int) for enum value 134 } 135 /*}}}*/ 136 /*FUNCTION BoolExternalResult::MyRank{{{1*/ 137 int BoolExternalResult::MyRank(void){ 138 extern int my_rank; 139 return my_rank; 140 } 141 /*}}}*/ 142 143 /*Numerics: */ 135 /*FUNCTION BoolExternalResult::copy{{{1*/ 136 Object* BoolExternalResult::copy() { 137 138 return new BoolExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 139 140 } 141 /*}}}*/ 142 143 /*BoolExternalResult management: */ 144 144 /*FUNCTION BoolExternalResult::WriteData(FILE* fid) {{{1*/ 145 145 void BoolExternalResult::WriteData(FILE* fid){ -
issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.h
r4244 r4248 37 37 double time; 38 38 39 40 /*constructors, destructors: {{{1*/ 39 /*BoolExternalResult constructors, destructors: {{{1*/ 41 40 BoolExternalResult(); 42 41 BoolExternalResult(int id, int enum_type,bool value,int step,double time); 43 42 ~BoolExternalResult(); 44 45 43 /*}}}*/ 46 /*Object methods: {{{1*/47 Object* copy();44 /*Object virtual functions definitions:{{{1 */ 45 void Echo(); 48 46 void DeepEcho(); 49 void Demarshall(char** pmarshalled_dataset); 50 void Echo(); 51 int Enum(); 52 int Id(); 47 int Id(); 48 int MyRank(); 53 49 void Marshall(char** pmarshalled_dataset); 54 50 int MarshallSize(); 55 int MyRank(); 51 void Demarshall(char** pmarshalled_dataset); 52 int Enum(); 53 Object* copy(); 56 54 /*}}}*/ 57 /*ExternalResult m ethods: {{{1*/55 /*ExternalResult management: {{{1*/ 58 56 int EnumType(){return enum_type;} 59 57 void WriteData(FILE* fid); -
issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*DoubleExternalResult constructors and destructor*/ 23 23 /*FUNCTION DoubleExternalResult::DoubleExternalResult(){{{1*/ 24 24 DoubleExternalResult::DoubleExternalResult(){ … … 42 42 /*}}}*/ 43 43 44 /*Object methods*/ 45 /*FUNCTION DoubleExternalResult::copy{{{1*/ 46 Object* DoubleExternalResult::copy() { 47 48 return new DoubleExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 49 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION DoubleExternalResult::Echo {{{1*/ 46 void DoubleExternalResult::Echo(void){ 47 this->DeepEcho(); 50 48 } 51 49 /*}}}*/ … … 61 59 } 62 60 /*}}}*/ 63 /*FUNCTION DoubleExternalResult::Demarshall{{{1*/64 void DoubleExternalResult::Demarshall(char** pmarshalled_dataset){65 66 char* marshalled_dataset=NULL;67 int i;68 69 /*recover marshalled_dataset: */70 marshalled_dataset=*pmarshalled_dataset;71 72 /*this time, no need to get enum type, the pointer directly points to the beginning of the73 *object data (thanks to DataSet::Demarshall):*/74 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);75 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);76 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);77 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);78 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);79 80 /*return: */81 *pmarshalled_dataset=marshalled_dataset;82 return;83 }84 /*}}}*/85 /*FUNCTION DoubleExternalResult::Echo {{{1*/86 void DoubleExternalResult::Echo(void){87 this->DeepEcho();88 }89 /*}}}*/90 /*FUNCTION DoubleExternalResult::Enum{{{1*/91 int DoubleExternalResult::Enum(void){92 93 return DoubleExternalResultEnum;94 95 }96 /*}}}*/97 61 /*FUNCTION DoubleExternalResult::Id{{{1*/ 98 62 int DoubleExternalResult::Id(void){ return -1; } 63 /*}}}*/ 64 /*FUNCTION DoubleExternalResult::MyRank{{{1*/ 65 int DoubleExternalResult::MyRank(void){ 66 extern int my_rank; 67 return my_rank; 68 } 99 69 /*}}}*/ 100 70 /*FUNCTION DoubleExternalResult::Marshall{{{1*/ … … 134 104 } 135 105 /*}}}*/ 136 /*FUNCTION DoubleExternalResult::MyRank{{{1*/ 137 int DoubleExternalResult::MyRank(void){ 138 extern int my_rank; 139 return my_rank; 106 /*FUNCTION DoubleExternalResult::Demarshall{{{1*/ 107 void DoubleExternalResult::Demarshall(char** pmarshalled_dataset){ 108 109 char* marshalled_dataset=NULL; 110 int i; 111 112 /*recover marshalled_dataset: */ 113 marshalled_dataset=*pmarshalled_dataset; 114 115 /*this time, no need to get enum type, the pointer directly points to the beginning of the 116 *object data (thanks to DataSet::Demarshall):*/ 117 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 118 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 119 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value); 120 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step); 121 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time); 122 123 /*return: */ 124 *pmarshalled_dataset=marshalled_dataset; 125 return; 126 } 127 /*}}}*/ 128 /*FUNCTION DoubleExternalResult::Enum{{{1*/ 129 int DoubleExternalResult::Enum(void){ 130 131 return DoubleExternalResultEnum; 132 133 } 134 /*}}}*/ 135 /*FUNCTION DoubleExternalResult::copy{{{1*/ 136 Object* DoubleExternalResult::copy() { 137 138 return new DoubleExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 139 140 140 } 141 141 /*}}}*/ 142 142 143 /* Numerics: */143 /*DoubleExternalResult management: */ 144 144 /*FUNCTION DoubleExternalResult::WriteData(FILE* fid) {{{1*/ 145 145 void DoubleExternalResult::WriteData(FILE* fid){ -
issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.h
r4244 r4248 38 38 39 39 40 /* constructors, destructors: {{{1*/40 /*DoubleExternalResult constructors, destructors: {{{1*/ 41 41 DoubleExternalResult(); 42 42 DoubleExternalResult(int id,int enum_type,double value,int step,double time); 43 43 ~DoubleExternalResult(); 44 45 44 /*}}}*/ 46 /*Object methods: {{{1*/47 Object* copy();45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 48 47 void DeepEcho(); 49 void Demarshall(char** pmarshalled_dataset); 50 void Echo(); 51 int Enum(); 52 int Id(); 48 int Id(); 49 int MyRank(); 53 50 void Marshall(char** pmarshalled_dataset); 54 51 int MarshallSize(); 55 int MyRank(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 56 55 /*}}}*/ 57 /*ExternalResult m ethods: {{{1*/56 /*ExternalResult management: {{{1*/ 58 57 int EnumType(){return enum_type;} 59 58 void WriteData(FILE* fid); -
issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*DoubleMatExternalResult constructors and destructor*/ 23 23 /*FUNCTION DoubleMatExternalResult::DoubleMatExternalResult(){{{1*/ 24 24 DoubleMatExternalResult::DoubleMatExternalResult(){ … … 53 53 /*}}}*/ 54 54 55 /*Object methods*/ 56 /*FUNCTION DoubleMatExternalResult::copy{{{1*/ 57 Object* DoubleMatExternalResult::copy() { 58 59 return new DoubleMatExternalResult(this->id,this->enum_type,this->values,this->M,this->N,this->step,this->time); 55 /*Object virtual functions definitions:*/ 56 void Echo(); 57 void DeepEcho(); 58 int Id(); 59 int MyRank(); 60 void Marshall(char** pmarshalled_dataset); 61 int MarshallSize(); 62 void Demarshall(char** pmarshalled_dataset); 63 int Enum(); 64 Object* copy(); 65 /*FUNCTION DoubleMatExternalResult::Echo {{{1*/ 66 void DoubleMatExternalResult::Echo(void){ 67 68 printf("DoubleMatExternalResult:\n"); 69 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 70 printf(" step: %i\n",this->step); 71 printf(" time: %g\n",this->time); 72 printf(" matrix size: %i-%i\n",this->M,this->N); 60 73 61 74 } … … 83 96 } 84 97 /*}}}*/ 85 /*FUNCTION DoubleMatExternalResult::Demarshall{{{1*/86 void DoubleMatExternalResult::Demarshall(char** pmarshalled_dataset){87 88 char* marshalled_dataset=NULL;89 int i;90 91 /*recover marshalled_dataset: */92 marshalled_dataset=*pmarshalled_dataset;93 94 /*this time, no need to get enum type, the pointer directly points to the beginning of the95 *object data (thanks to DataSet::Demarshall):*/96 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);97 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);98 99 /*data: */100 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);101 memcpy(&N,marshalled_dataset,sizeof(N));marshalled_dataset+=sizeof(N);102 values=(double*)xmalloc(M*N*sizeof(double));103 memcpy(values,marshalled_dataset,M*N*sizeof(double));marshalled_dataset+=M*N*sizeof(double);104 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);105 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);106 107 /*return: */108 *pmarshalled_dataset=marshalled_dataset;109 return;110 }111 /*}}}*/112 /*FUNCTION DoubleMatExternalResult::Echo {{{1*/113 void DoubleMatExternalResult::Echo(void){114 115 printf("DoubleMatExternalResult:\n");116 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));117 printf(" step: %i\n",this->step);118 printf(" time: %g\n",this->time);119 printf(" matrix size: %i-%i\n",this->M,this->N);120 121 }122 /*}}}*/123 /*FUNCTION DoubleMatExternalResult::Enum{{{1*/124 int DoubleMatExternalResult::Enum(void){125 126 return DoubleMatExternalResultEnum;127 128 }129 /*}}}*/130 98 /*FUNCTION DoubleMatExternalResult::Id{{{1*/ 131 99 int DoubleMatExternalResult::Id(void){ return -1; } 100 /*}}}*/ 101 /*FUNCTION DoubleMatExternalResult::MyRank{{{1*/ 102 int DoubleMatExternalResult::MyRank(void){ 103 extern int my_rank; 104 return my_rank; 105 } 132 106 /*}}}*/ 133 107 /*FUNCTION DoubleMatExternalResult::Marshall{{{1*/ … … 171 145 } 172 146 /*}}}*/ 173 /*FUNCTION DoubleMatExternalResult::MyRank{{{1*/ 174 int DoubleMatExternalResult::MyRank(void){ 175 extern int my_rank; 176 return my_rank; 177 } 178 /*}}}*/ 179 180 /*Numerics: */ 147 /*FUNCTION DoubleMatExternalResult::Demarshall{{{1*/ 148 void DoubleMatExternalResult::Demarshall(char** pmarshalled_dataset){ 149 150 char* marshalled_dataset=NULL; 151 int i; 152 153 /*recover marshalled_dataset: */ 154 marshalled_dataset=*pmarshalled_dataset; 155 156 /*this time, no need to get enum type, the pointer directly points to the beginning of the 157 *object data (thanks to DataSet::Demarshall):*/ 158 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 159 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 160 161 /*data: */ 162 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M); 163 memcpy(&N,marshalled_dataset,sizeof(N));marshalled_dataset+=sizeof(N); 164 values=(double*)xmalloc(M*N*sizeof(double)); 165 memcpy(values,marshalled_dataset,M*N*sizeof(double));marshalled_dataset+=M*N*sizeof(double); 166 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step); 167 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time); 168 169 /*return: */ 170 *pmarshalled_dataset=marshalled_dataset; 171 return; 172 } 173 /*}}}*/ 174 /*FUNCTION DoubleMatExternalResult::Enum{{{1*/ 175 int DoubleMatExternalResult::Enum(void){ 176 177 return DoubleMatExternalResultEnum; 178 179 } 180 /*}}}*/ 181 /*FUNCTION DoubleMatExternalResult::copy{{{1*/ 182 Object* DoubleMatExternalResult::copy() { 183 184 return new DoubleMatExternalResult(this->id,this->enum_type,this->values,this->M,this->N,this->step,this->time); 185 186 } 187 /*}}}*/ 188 189 /*DoubleMatExternalResult management: */ 181 190 /*FUNCTION DoubleMatExternalResult::WriteData(FILE* fid) {{{1*/ 182 191 void DoubleMatExternalResult::WriteData(FILE* fid){ -
issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.h
r4244 r4248 39 39 40 40 public: 41 /* constructors, destructors: {{{1*/41 /*DoubleMatExternalResult constructors, destructors: {{{1*/ 42 42 DoubleMatExternalResult(); 43 43 DoubleMatExternalResult(int id,int enum_type,double* values,int M,int N,int step, double time); 44 44 ~DoubleMatExternalResult(); 45 45 /*}}}*/ 46 /*Object methods: {{{1*/47 Object* copy();46 /*Object virtual functions definitions:{{{1 */ 47 void Echo(); 48 48 void DeepEcho(); 49 void Demarshall(char** pmarshalled_dataset); 50 void Echo(); 51 int Enum(); 52 int Id(); 49 int Id(); 50 int MyRank(); 53 51 void Marshall(char** pmarshalled_dataset); 54 52 int MarshallSize(); 55 int MyRank(); 53 void Demarshall(char** pmarshalled_dataset); 54 int Enum(); 55 Object* copy(); 56 56 /*}}}*/ 57 /*ExternalResult m ethods: {{{1*/57 /*ExternalResult managemnet: {{{1*/ 58 58 int EnumType(){return enum_type;} 59 59 void WriteData(FILE* fid); -
issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*DoubleVecExternalResult constructors and destructor*/ 23 23 /*FUNCTION DoubleVecExternalResult::DoubleVecExternalResult(){{{1*/ 24 24 DoubleVecExternalResult::DoubleVecExternalResult(){ … … 50 50 /*}}}*/ 51 51 52 /*Object methods*/ 53 /*FUNCTION DoubleVecExternalResult::copy{{{1*/ 54 Object* DoubleVecExternalResult::copy() { 55 56 return new DoubleVecExternalResult(this->id,this->enum_type,this->values,this->M,this->step,this->time); 52 /*Object virtual functions definitions:*/ 53 /*FUNCTION DoubleVecExternalResult::Echo {{{1*/ 54 void DoubleVecExternalResult::Echo(void){ 55 56 printf("DoubleVecExternalResult:\n"); 57 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 58 printf(" vector size: %i\n",this->M); 59 printf(" step: %i\n",this->step); 60 printf(" time: %g\n",this->time); 57 61 58 62 } … … 74 78 } 75 79 /*}}}*/ 76 /*FUNCTION DoubleVecExternalResult::Demarshall{{{1*/77 void DoubleVecExternalResult::Demarshall(char** pmarshalled_dataset){78 79 char* marshalled_dataset=NULL;80 int i;81 82 /*recover marshalled_dataset: */83 marshalled_dataset=*pmarshalled_dataset;84 85 /*this time, no need to get enum type, the pointer directly points to the beginning of the86 *object data (thanks to DataSet::Demarshall):*/87 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);88 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);89 90 /*data: */91 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);92 values=(double*)xmalloc(M*sizeof(double));93 memcpy(values,marshalled_dataset,M*sizeof(double));marshalled_dataset+=M*sizeof(double);94 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);95 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);96 97 /*return: */98 *pmarshalled_dataset=marshalled_dataset;99 return;100 }101 /*}}}*/102 /*FUNCTION DoubleVecExternalResult::Echo {{{1*/103 void DoubleVecExternalResult::Echo(void){104 105 printf("DoubleVecExternalResult:\n");106 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));107 printf(" vector size: %i\n",this->M);108 printf(" step: %i\n",this->step);109 printf(" time: %g\n",this->time);110 111 }112 /*}}}*/113 /*FUNCTION DoubleVecExternalResult::Enum{{{1*/114 int DoubleVecExternalResult::Enum(void){115 116 return DoubleVecExternalResultEnum;117 118 }119 /*}}}*/120 80 /*FUNCTION DoubleVecExternalResult::Id{{{1*/ 121 81 int DoubleVecExternalResult::Id(void){ return -1; } 82 /*}}}*/ 83 /*FUNCTION DoubleVecExternalResult::MyRank{{{1*/ 84 int DoubleVecExternalResult::MyRank(void){ 85 extern int my_rank; 86 return my_rank; 87 } 122 88 /*}}}*/ 123 89 /*FUNCTION DoubleVecExternalResult::Marshall{{{1*/ … … 159 125 } 160 126 /*}}}*/ 161 /*FUNCTION DoubleVecExternalResult::MyRank{{{1*/ 162 int DoubleVecExternalResult::MyRank(void){ 163 extern int my_rank; 164 return my_rank; 165 } 166 /*}}}*/ 167 168 /*Numerics: */ 127 /*FUNCTION DoubleVecExternalResult::Demarshall{{{1*/ 128 void DoubleVecExternalResult::Demarshall(char** pmarshalled_dataset){ 129 130 char* marshalled_dataset=NULL; 131 int i; 132 133 /*recover marshalled_dataset: */ 134 marshalled_dataset=*pmarshalled_dataset; 135 136 /*this time, no need to get enum type, the pointer directly points to the beginning of the 137 *object data (thanks to DataSet::Demarshall):*/ 138 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 139 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 140 141 /*data: */ 142 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M); 143 values=(double*)xmalloc(M*sizeof(double)); 144 memcpy(values,marshalled_dataset,M*sizeof(double));marshalled_dataset+=M*sizeof(double); 145 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step); 146 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time); 147 148 /*return: */ 149 *pmarshalled_dataset=marshalled_dataset; 150 return; 151 } 152 /*}}}*/ 153 /*FUNCTION DoubleVecExternalResult::Enum{{{1*/ 154 int DoubleVecExternalResult::Enum(void){ 155 156 return DoubleVecExternalResultEnum; 157 158 } 159 /*}}}*/ 160 /*FUNCTION DoubleVecExternalResult::copy{{{1*/ 161 Object* DoubleVecExternalResult::copy() { 162 163 return new DoubleVecExternalResult(this->id,this->enum_type,this->values,this->M,this->step,this->time); 164 165 } 166 /*}}}*/ 167 168 /*DoubleVecExternalResult management: */ 169 169 /*FUNCTION DoubleVecExternalResult::WriteData(FILE* fid) {{{1*/ 170 170 void DoubleVecExternalResult::WriteData(FILE* fid){ -
issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.h
r4244 r4248 38 38 39 39 public: 40 /* constructors, destructors: {{{1*/40 /*DoubleVecExternalResult constructors, destructors: {{{1*/ 41 41 DoubleVecExternalResult(); 42 42 DoubleVecExternalResult(int id,int enum_type,double* values,int M,int step, double time); 43 43 ~DoubleVecExternalResult(); 44 44 /*}}}*/ 45 /*Object methods: {{{1*/46 Object* copy();45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 47 47 void DeepEcho(); 48 void Demarshall(char** pmarshalled_dataset); 49 void Echo(); 50 int Enum(); 51 int Id(); 48 int Id(); 49 int MyRank(); 52 50 void Marshall(char** pmarshalled_dataset); 53 51 int MarshallSize(); 54 int MyRank(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 55 55 /*}}}*/ 56 /*ExternalResult m ethods: {{{1*/56 /*ExternalResult management: {{{1*/ 57 57 int EnumType(){return enum_type;} 58 58 void WriteData(FILE* fid); -
issm/trunk/src/c/objects/ExternalResults/ExternalResult.h
r4182 r4248 29 29 30 30 virtual ~ExternalResult(){}; 31 32 /*methods:{{{1*/ 31 /*Virtual functions:{{{1*/ 33 32 virtual int EnumType()=0; 34 33 virtual void WriteData(FILE* fid)=0; -
issm/trunk/src/c/objects/ExternalResults/IntExternalResult.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*IntExternalResult constructors and destructor*/ 23 23 /*FUNCTION IntExternalResult::IntExternalResult(){{{1*/ 24 24 IntExternalResult::IntExternalResult(){ … … 42 42 /*}}}*/ 43 43 44 /*Object methods*/ 45 /*FUNCTION IntExternalResult::copy{{{1*/ 46 Object* IntExternalResult::copy() { 47 48 return new IntExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 49 44 /*Object virtual functions definitions:*/ 45 void Echo(); 46 void DeepEcho(); 47 int Id(); 48 int MyRank(); 49 void Marshall(char** pmarshalled_dataset); 50 int MarshallSize(); 51 void Demarshall(char** pmarshalled_dataset); 52 int Enum(); 53 Object* copy(); 54 /*FUNCTION IntExternalResult::Echo {{{1*/ 55 void IntExternalResult::Echo(void){ 56 this->DeepEcho(); 50 57 } 51 58 /*}}}*/ … … 59 66 printf(" step: %i\n",this->step); 60 67 printf(" time: %g\n",this->time); 68 } 69 /*}}}*/ 70 /*FUNCTION IntExternalResult::Id{{{1*/ 71 int IntExternalResult::Id(void){ return -1; } 72 /*}}}*/ 73 /*FUNCTION IntExternalResult::MyRank{{{1*/ 74 int IntExternalResult::MyRank(void){ 75 extern int my_rank; 76 return my_rank; 77 } 78 /*}}}*/ 79 /*FUNCTION IntExternalResult::Marshall{{{1*/ 80 void IntExternalResult::Marshall(char** pmarshalled_dataset){ 81 82 char* marshalled_dataset=NULL; 83 int enum_value=0; 84 85 /*recover marshalled_dataset: */ 86 marshalled_dataset=*pmarshalled_dataset; 87 88 /*get enum value of IntExternalResult: */ 89 enum_value=IntExternalResultEnum; 90 91 /*marshall enum: */ 92 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 93 94 /*marshall IntExternalResult data: */ 95 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 96 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 97 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 98 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 99 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 100 101 *pmarshalled_dataset=marshalled_dataset; 102 } 103 /*}}}*/ 104 /*FUNCTION IntExternalResult::MarshallSize{{{1*/ 105 int IntExternalResult::MarshallSize(){ 106 107 return sizeof(value)+ 108 +sizeof(id) 109 +sizeof(enum_type) 110 +sizeof(step) 111 +sizeof(time) 112 +sizeof(int); //sizeof(int) for enum value 61 113 } 62 114 /*}}}*/ … … 83 135 } 84 136 /*}}}*/ 85 /*FUNCTION IntExternalResult::Echo {{{1*/86 void IntExternalResult::Echo(void){87 this->DeepEcho();88 }89 /*}}}*/90 137 /*FUNCTION IntExternalResult::Enum{{{1*/ 91 138 int IntExternalResult::Enum(void){ … … 95 142 } 96 143 /*}}}*/ 97 /*FUNCTION IntExternalResult::Id{{{1*/ 98 int IntExternalResult::Id(void){ return -1; } 99 /*}}}*/ 100 /*FUNCTION IntExternalResult::Marshall{{{1*/ 101 void IntExternalResult::Marshall(char** pmarshalled_dataset){ 102 103 char* marshalled_dataset=NULL; 104 int enum_value=0; 105 106 /*recover marshalled_dataset: */ 107 marshalled_dataset=*pmarshalled_dataset; 108 109 /*get enum value of IntExternalResult: */ 110 enum_value=IntExternalResultEnum; 111 112 /*marshall enum: */ 113 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 114 115 /*marshall IntExternalResult data: */ 116 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 117 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 118 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 119 memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step); 120 memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time); 121 122 *pmarshalled_dataset=marshalled_dataset; 123 } 124 /*}}}*/ 125 /*FUNCTION IntExternalResult::MarshallSize{{{1*/ 126 int IntExternalResult::MarshallSize(){ 127 128 return sizeof(value)+ 129 +sizeof(id) 130 +sizeof(enum_type) 131 +sizeof(step) 132 +sizeof(time) 133 +sizeof(int); //sizeof(int) for enum value 134 } 135 /*}}}*/ 136 /*FUNCTION IntExternalResult::MyRank{{{1*/ 137 int IntExternalResult::MyRank(void){ 138 extern int my_rank; 139 return my_rank; 140 } 141 /*}}}*/ 142 143 /*Numerics: */ 144 /*FUNCTION IntExternalResult::copy{{{1*/ 145 Object* IntExternalResult::copy() { 146 147 return new IntExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 148 149 } 150 /*}}}*/ 151 152 /*IntExternalResult management: */ 144 153 /*FUNCTION IntExternalResult::WriteData(FILE* fid) {{{1*/ 145 154 void IntExternalResult::WriteData(FILE* fid){ -
issm/trunk/src/c/objects/ExternalResults/IntExternalResult.h
r4244 r4248 38 38 39 39 40 /* constructors, destructors: {{{1*/40 /*IntExternalResult constructors, destructors: {{{1*/ 41 41 IntExternalResult(); 42 42 IntExternalResult(int id,int enum_type,int value,int step,double time); … … 44 44 45 45 /*}}}*/ 46 /*Object methods: {{{1*/47 Object* copy();46 /*Object virtual functions definitions:{{{1 */ 47 void Echo(); 48 48 void DeepEcho(); 49 void Demarshall(char** pmarshalled_dataset); 50 void Echo(); 51 int Enum(); 52 int Id(); 49 int Id(); 50 int MyRank(); 53 51 void Marshall(char** pmarshalled_dataset); 54 52 int MarshallSize(); 55 int MyRank(); 53 void Demarshall(char** pmarshalled_dataset); 54 int Enum(); 55 Object* copy(); 56 56 /*}}}*/ 57 /*ExternalResult m ethods: {{{1*/57 /*ExternalResult managemnet: {{{1*/ 58 58 int EnumType(){return enum_type;} 59 59 void WriteData(FILE* fid); -
issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*PetscVecExternalResult constructors and destructor*/ 23 23 /*FUNCTION PetscVecExternalResult::PetscVecExternalResult(){{{1*/ 24 24 PetscVecExternalResult::PetscVecExternalResult(){ … … 50 50 /*}}}*/ 51 51 52 /*Object methods*/ 53 /*FUNCTION PetscVecExternalResult::copy{{{1*/ 54 Object* PetscVecExternalResult::copy() { 55 56 return new PetscVecExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 52 /*Object virtual functions definitions:*/ 53 /*FUNCTION PetscVecExternalResult::Echo {{{1*/ 54 void PetscVecExternalResult::Echo(void){ 55 56 printf("PetscVecExternalResult:\n"); 57 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 57 58 58 59 } … … 70 71 } 71 72 /*}}}*/ 72 /*FUNCTION PetscVecExternalResult::Demarshall{{{1*/73 void PetscVecExternalResult::Demarshall(char** pmarshalled_dataset){74 75 char* marshalled_dataset=NULL;76 int i;77 int M;78 double* serial_vec=NULL;79 int* idxm=NULL;80 81 /*recover marshalled_dataset: */82 marshalled_dataset=*pmarshalled_dataset;83 84 /*this time, no need to get enum type, the pointer directly points to the beginning of the85 *object data (thanks to DataSet::Demarshall):*/86 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);87 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);88 89 /*data: */90 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);91 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);92 93 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);94 if(M){95 serial_vec=(double*)xmalloc(M*sizeof(double));96 memcpy(serial_vec,marshalled_dataset,M*sizeof(double));marshalled_dataset+=(M*sizeof(double));97 98 value=NewVec(M);99 idxm=(int*)xmalloc(M*sizeof(int));100 for(i=0;i<M;i++)idxm[i]=i;101 VecSetValues(value,M,idxm,serial_vec,INSERT_VALUES);102 103 VecAssemblyBegin(value);104 VecAssemblyEnd(value);105 106 107 }108 else{109 value=NULL;110 }111 112 /*Free ressources:*/113 xfree((void**)&serial_vec);114 xfree((void**)&idxm);115 116 /*return: */117 *pmarshalled_dataset=marshalled_dataset;118 }119 /*}}}*/120 /*FUNCTION PetscVecExternalResult::Echo {{{1*/121 void PetscVecExternalResult::Echo(void){122 123 printf("PetscVecExternalResult:\n");124 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));125 126 }127 /*}}}*/128 /*FUNCTION PetscVecExternalResult::Enum{{{1*/129 int PetscVecExternalResult::Enum(void){130 131 return PetscVecExternalResultEnum;132 133 }134 /*}}}*/135 73 /*FUNCTION PetscVecExternalResult::Id{{{1*/ 136 74 int PetscVecExternalResult::Id(void){ return -1; } 75 /*}}}*/ 76 /*FUNCTION PetscVecExternalResult::MyRank{{{1*/ 77 int PetscVecExternalResult::MyRank(void){ 78 extern int my_rank; 79 return my_rank; 80 } 137 81 /*}}}*/ 138 82 /*FUNCTION PetscVecExternalResult::Marshall{{{1*/ … … 190 134 } 191 135 /*}}}*/ 192 /*FUNCTION PetscVecExternalResult::MyRank{{{1*/ 193 int PetscVecExternalResult::MyRank(void){ 194 extern int my_rank; 195 return my_rank; 196 } 197 /*}}}*/ 198 199 /*Numerics: */ 136 /*FUNCTION PetscVecExternalResult::Demarshall{{{1*/ 137 void PetscVecExternalResult::Demarshall(char** pmarshalled_dataset){ 138 139 char* marshalled_dataset=NULL; 140 int i; 141 int M; 142 double* serial_vec=NULL; 143 int* idxm=NULL; 144 145 /*recover marshalled_dataset: */ 146 marshalled_dataset=*pmarshalled_dataset; 147 148 /*this time, no need to get enum type, the pointer directly points to the beginning of the 149 *object data (thanks to DataSet::Demarshall):*/ 150 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 151 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 152 153 /*data: */ 154 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step); 155 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time); 156 157 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M); 158 if(M){ 159 serial_vec=(double*)xmalloc(M*sizeof(double)); 160 memcpy(serial_vec,marshalled_dataset,M*sizeof(double));marshalled_dataset+=(M*sizeof(double)); 161 162 value=NewVec(M); 163 idxm=(int*)xmalloc(M*sizeof(int)); 164 for(i=0;i<M;i++)idxm[i]=i; 165 VecSetValues(value,M,idxm,serial_vec,INSERT_VALUES); 166 167 VecAssemblyBegin(value); 168 VecAssemblyEnd(value); 169 170 171 } 172 else{ 173 value=NULL; 174 } 175 176 /*Free ressources:*/ 177 xfree((void**)&serial_vec); 178 xfree((void**)&idxm); 179 180 /*return: */ 181 *pmarshalled_dataset=marshalled_dataset; 182 } 183 /*}}}*/ 184 /*FUNCTION PetscVecExternalResult::Enum{{{1*/ 185 int PetscVecExternalResult::Enum(void){ 186 187 return PetscVecExternalResultEnum; 188 189 } 190 /*}}}*/ 191 /*FUNCTION PetscVecExternalResult::copy{{{1*/ 192 Object* PetscVecExternalResult::copy() { 193 194 return new PetscVecExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 195 196 } 197 /*}}}*/ 198 199 /*PetscVecExternalResult management: */ 200 200 /*FUNCTION PetscVecExternalResult::WriteData(FILE* fid) {{{1*/ 201 201 void PetscVecExternalResult::WriteData(FILE* fid){ -
issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.h
r4244 r4248 38 38 39 39 public: 40 /* constructors, destructors: {{{1*/40 /*PetscVecExternalResult constructors, destructors: {{{1*/ 41 41 PetscVecExternalResult(); 42 42 PetscVecExternalResult(int id,int enum_type,Vec value, int step, double time); 43 43 ~PetscVecExternalResult(); 44 44 /*}}}*/ 45 /*Object methods: {{{1*/46 Object* copy();45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 47 47 void DeepEcho(); 48 void Demarshall(char** pmarshalled_dataset); 49 void Echo(); 50 int Enum(); 51 int Id(); 48 int Id(); 49 int MyRank(); 52 50 void Marshall(char** pmarshalled_dataset); 53 51 int MarshallSize(); 54 int MyRank(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 55 55 /*}}}*/ 56 /*ExternalResult m ethods: {{{1*/56 /*ExternalResult management: {{{1*/ 57 57 int EnumType(){return enum_type;} 58 58 void WriteData(FILE* fid); -
issm/trunk/src/c/objects/ExternalResults/StringExternalResult.cpp
r4236 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*StringExternalResult constructors and destructor*/ 23 23 /*FUNCTION StringExternalResult::StringExternalResult(){{{1*/ 24 24 StringExternalResult::StringExternalResult(){ … … 44 44 /*}}}*/ 45 45 46 /*Object methods*/ 47 /*FUNCTION StringExternalResult::copy{{{1*/ 48 Object* StringExternalResult::copy() { 49 50 return new StringExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 51 46 /*Object virtual functions definitions:*/ 47 /*FUNCTION StringExternalResult::Echo {{{1*/ 48 void StringExternalResult::Echo(void){ 49 this->DeepEcho(); 52 50 } 53 51 /*}}}*/ … … 63 61 } 64 62 /*}}}*/ 65 /*FUNCTION StringExternalResult::Demarshall{{{1*/66 void StringExternalResult::Demarshall(char** pmarshalled_dataset){67 68 char* marshalled_dataset=NULL;69 int i;70 int stringsize;71 72 /*recover marshalled_dataset: */73 marshalled_dataset=*pmarshalled_dataset;74 75 /*this time, no need to get enum type, the pointer directly points to the beginning of the76 *object data (thanks to DataSet::Demarshall):*/77 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);78 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);79 80 memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);81 82 this->value=(char*)xmalloc(stringsize*sizeof(char));83 memcpy(value,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);84 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);85 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);86 87 /*return: */88 *pmarshalled_dataset=marshalled_dataset;89 return;90 }91 /*}}}*/92 /*FUNCTION StringExternalResult::Echo {{{1*/93 void StringExternalResult::Echo(void){94 this->DeepEcho();95 }96 /*}}}*/97 /*FUNCTION StringExternalResult::Enum{{{1*/98 int StringExternalResult::Enum(void){99 100 return StringExternalResultEnum;101 102 }103 /*}}}*/104 63 /*FUNCTION StringExternalResult::Id{{{1*/ 105 64 int StringExternalResult::Id(void){ return -1; } 65 /*}}}*/ 66 /*FUNCTION StringExternalResult::MyRank{{{1*/ 67 int StringExternalResult::MyRank(void){ 68 extern int my_rank; 69 return my_rank; 70 } 106 71 /*}}}*/ 107 72 /*FUNCTION StringExternalResult::Marshall{{{1*/ … … 149 114 } 150 115 /*}}}*/ 151 /*FUNCTION StringExternalResult::MyRank{{{1*/ 152 int StringExternalResult::MyRank(void){ 153 extern int my_rank; 154 return my_rank; 155 } 156 /*}}}*/ 157 158 /*Numerics: */ 116 /*FUNCTION StringExternalResult::Demarshall{{{1*/ 117 void StringExternalResult::Demarshall(char** pmarshalled_dataset){ 118 119 char* marshalled_dataset=NULL; 120 int i; 121 int stringsize; 122 123 /*recover marshalled_dataset: */ 124 marshalled_dataset=*pmarshalled_dataset; 125 126 /*this time, no need to get enum type, the pointer directly points to the beginning of the 127 *object data (thanks to DataSet::Demarshall):*/ 128 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 129 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 130 131 memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int); 132 133 this->value=(char*)xmalloc(stringsize*sizeof(char)); 134 memcpy(value,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char); 135 memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step); 136 memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time); 137 138 /*return: */ 139 *pmarshalled_dataset=marshalled_dataset; 140 return; 141 } 142 /*}}}*/ 143 /*FUNCTION StringExternalResult::Enum{{{1*/ 144 int StringExternalResult::Enum(void){ 145 146 return StringExternalResultEnum; 147 148 } 149 /*}}}*/ 150 /*FUNCTION StringExternalResult::copy{{{1*/ 151 Object* StringExternalResult::copy() { 152 153 return new StringExternalResult(this->id,this->enum_type,this->value,this->step,this->time); 154 155 } 156 /*}}}*/ 157 158 /*StringExternalResult management: */ 159 159 /*FUNCTION StringExternalResult::WriteData(FILE* fid) {{{1*/ 160 160 void StringExternalResult::WriteData(FILE* fid){ -
issm/trunk/src/c/objects/ExternalResults/StringExternalResult.h
r4244 r4248 38 38 39 39 public: 40 /* constructors, destructors: {{{1*/40 /*StringExternalResult constructors, destructors: {{{1*/ 41 41 StringExternalResult(); 42 42 StringExternalResult(int id,int enum_type,char* value,int step, double time); 43 43 ~StringExternalResult(); 44 44 /*}}}*/ 45 /*Object methods: {{{1*/46 Object* copy();45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 47 47 void DeepEcho(); 48 void Demarshall(char** pmarshalled_dataset); 49 void Echo(); 50 int Enum(); 51 int Id(); 48 int Id(); 49 int MyRank(); 52 50 void Marshall(char** pmarshalled_dataset); 53 51 int MarshallSize(); 54 int MyRank(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 55 55 /*}}}*/ 56 /*ExternalResult m ethods: {{{1*/56 /*ExternalResult management: {{{1*/ 57 57 int EnumType(){return enum_type;} 58 58 void WriteData(FILE* fid); -
issm/trunk/src/c/objects/Hook.cpp
r4236 r4248 104 104 } 105 105 /*}}}*/ 106 /*FUNCTION Hook::copy(Hook* input) {{{1*/107 void Hook::copy(Hook* input){108 109 int i;110 Object** input_objects=NULL;111 int* input_ids=NULL;112 int* input_offsets=NULL;113 114 /*get internals of input: */115 this->num=input->GetNum();116 input_objects=input->GetObjects();117 input_ids=input->Ids();118 input_offsets=input->GetOffsets();119 120 if(this->num){121 this->objects=(Object**)xmalloc(this->num*sizeof(Object*));122 this->ids=(int*)xmalloc(this->num*sizeof(int));123 this->offsets=(int*)xmalloc(this->num*sizeof(int));124 }125 126 127 for(i=0;i<this->num;i++){128 this->objects[i]=input_objects[i];129 this->offsets[i]=input_offsets[i];130 this->ids[i]=input_ids[i];131 }132 }133 /*}}}*/134 106 /*FUNCTION Hook::~Hook(){{{1*/ 135 107 Hook::~Hook(){ … … 142 114 /*}}}*/ 143 115 144 /*Object marshalling*/ 116 /*Some of the Object functionality: */ 117 /*FUNCTION Hook::Echo{{{1*/ 118 void Hook::Echo(void){ 119 120 int i; 121 if (num){ 122 printf(" Hook: \n"); 123 printf(" num=%i\n",this->num); 124 printf(" ids: "); 125 for (i=0;i<this->num;i++){ 126 printf("%i ",this->ids[i]); 127 } 128 printf("\n"); 129 printf(" offsets: "); 130 for (i=0;i<this->num;i++){ 131 printf("%i ",this->offsets[i]); 132 } 133 printf("\n"); 134 } 135 else{ 136 printf(" Hook: num=0 \n"); 137 } 138 } 139 /*}}}*/ 140 /*FUNCTION Hook::DeepEcho{{{1*/ 141 void Hook::DeepEcho(void){ 142 143 int i; 144 if (num){ 145 printf(" Hook: \n"); 146 printf(" num=%i\n",this->num); 147 printf(" ids: "); 148 for (i=0;i<this->num;i++){ 149 printf("%i ",this->ids[i]); 150 } 151 printf("\n"); 152 printf(" offsets: "); 153 for (i=0;i<this->num;i++){ 154 printf("%i ",this->offsets[i]); 155 } 156 printf("\n"); 157 if (!objects) printf(" warning: object not hooked yet\n"); 158 else{ 159 printf(" objects:\n "); 160 for (i=0;i<this->num;i++){ 161 printf(" object %i\n",i); 162 objects[i]->DeepEcho(); 163 } 164 } 165 } 166 else{ 167 printf(" Hook: num=0 \n"); 168 } 169 } 170 /*}}}*/ 145 171 /*FUNCTION Hook::Marshall{{{1*/ 146 172 void Hook::Marshall(char** pmarshalled_dataset){ … … 226 252 } 227 253 /*}}}*/ 228 229 /*Object processing: */ 254 /*FUNCTION Hook::copy(Hook* input) {{{1*/ 255 void Hook::copy(Hook* input){ 256 257 int i; 258 Object** input_objects=NULL; 259 int* input_ids=NULL; 260 int* input_offsets=NULL; 261 262 /*get internals of input: */ 263 this->num=input->GetNum(); 264 input_objects=input->GetObjects(); 265 input_ids=input->Ids(); 266 input_offsets=input->GetOffsets(); 267 268 if(this->num){ 269 this->objects=(Object**)xmalloc(this->num*sizeof(Object*)); 270 this->ids=(int*)xmalloc(this->num*sizeof(int)); 271 this->offsets=(int*)xmalloc(this->num*sizeof(int)); 272 } 273 274 275 for(i=0;i<this->num;i++){ 276 this->objects[i]=input_objects[i]; 277 this->offsets[i]=input_offsets[i]; 278 this->ids[i]=input_ids[i]; 279 } 280 } 281 /*}}}*/ 282 283 /*Hook management: */ 230 284 /*FUNCTION Hook::configure{{{1*/ 231 285 void Hook::configure(DataSet* dataset){ … … 270 324 } 271 325 /*}}}*/ 272 /*FUNCTION Hook::Echo{{{1*/273 void Hook::Echo(void){274 275 int i;276 if (num){277 printf(" Hook: \n");278 printf(" num=%i\n",this->num);279 printf(" ids: ");280 for (i=0;i<this->num;i++){281 printf("%i ",this->ids[i]);282 }283 printf("\n");284 printf(" offsets: ");285 for (i=0;i<this->num;i++){286 printf("%i ",this->offsets[i]);287 }288 printf("\n");289 }290 else{291 printf(" Hook: num=0 \n");292 }293 }294 /*}}}*/295 /*FUNCTION Hook::DeepEcho{{{1*/296 void Hook::DeepEcho(void){297 298 int i;299 if (num){300 printf(" Hook: \n");301 printf(" num=%i\n",this->num);302 printf(" ids: ");303 for (i=0;i<this->num;i++){304 printf("%i ",this->ids[i]);305 }306 printf("\n");307 printf(" offsets: ");308 for (i=0;i<this->num;i++){309 printf("%i ",this->offsets[i]);310 }311 printf("\n");312 if (!objects) printf(" warning: object not hooked yet\n");313 else{314 printf(" objects:\n ");315 for (i=0;i<this->num;i++){316 printf(" object %i\n",i);317 objects[i]->DeepEcho();318 }319 }320 }321 else{322 printf(" Hook: num=0 \n");323 }324 }325 /*}}}*/326 327 /*Object functions*/328 326 /*FUNCTION Hook::delivers{{{1*/ 329 327 Object* Hook::delivers(void){ -
issm/trunk/src/c/objects/Hook.h
r3791 r4248 26 26 public: 27 27 28 /*Hook constructors, destructors: {{{*/ 28 29 Hook(); 29 30 Hook(int* ids, int num); … … 31 32 Hook(Object** objects, int* ids, int* offsets,int num); 32 33 Hook(Hook* hook); 33 void copy(Hook* hook);34 34 ~Hook(); 35 /*}}}*/ 36 /*Object like functionality:{{{1*/ 37 void Echo(void); 38 void DeepEcho(void); 35 39 void Marshall(char** pmarshalled_dataset); 36 40 int MarshallSize(); 37 41 void Demarshall(char** pmarshalled_dataset); 42 void copy(Hook* hook); 43 /*}}}*/ 44 /*Hook management: {{{1*/ 38 45 Object* delivers(void); //single object deliver 39 46 Object** deliverp(void); //deliver all objects 40 47 void configure(DataSet* dataset); 41 void Echo(void);42 void DeepEcho(void);43 48 Hook* Spawn(int* indices, int numindices); 44 49 Object** GetObjects(void); … … 46 51 int* GetOffsets(void); 47 52 int GetNum(void); 48 49 53 /*}}}*/ 50 54 }; 51 55 -
issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Object constructors and destructor*/19 /*BeamVertexInput constructors and destructor*/ 20 20 /*FUNCTION BeamVertexInput::BeamVertexInput(){{{1*/ 21 21 BeamVertexInput::BeamVertexInput(){ … … 37 37 /*}}}*/ 38 38 39 /*Object management*/ 40 /*FUNCTION BeamVertexInput::copy{{{1*/ 41 Object* BeamVertexInput::copy() { 42 43 return new BeamVertexInput(this->enum_type,this->values); 44 39 /*Object virtual functions definitions:*/ 40 /*FUNCTION BeamVertexInput::Echo {{{1*/ 41 void BeamVertexInput::Echo(void){ 42 this->DeepEcho(); 45 43 } 46 44 /*}}}*/ … … 51 49 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 52 50 printf(" values: [%g %g]\n",this->values[0],this->values[1]); 51 } 52 /*}}}*/ 53 /*FUNCTION BeamVertexInput::Id{{{1*/ 54 int BeamVertexInput::Id(void){ return -1; } 55 /*}}}*/ 56 /*FUNCTION BeamVertexInput::MyRank{{{1*/ 57 int BeamVertexInput::MyRank(void){ 58 extern int my_rank; 59 return my_rank; 60 } 61 /*}}}*/ 62 /*FUNCTION BeamVertexInput::Marshall{{{1*/ 63 void BeamVertexInput::Marshall(char** pmarshalled_dataset){ 64 65 char* marshalled_dataset=NULL; 66 int enum_value=0; 67 68 /*recover marshalled_dataset: */ 69 marshalled_dataset=*pmarshalled_dataset; 70 71 /*get enum value of BeamVertexInput: */ 72 enum_value=BeamVertexInputEnum; 73 74 /*marshall enum: */ 75 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 76 77 /*marshall BeamVertexInput data: */ 78 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 79 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values); 80 81 *pmarshalled_dataset=marshalled_dataset; 82 } 83 /*}}}*/ 84 /*FUNCTION BeamVertexInput::MarshallSize{{{1*/ 85 int BeamVertexInput::MarshallSize(){ 86 87 return sizeof(values)+ 88 +sizeof(enum_type)+ 89 +sizeof(int); //sizeof(int) for enum_value 53 90 } 54 91 /*}}}*/ … … 72 109 } 73 110 /*}}}*/ 74 /*FUNCTION BeamVertexInput::Echo {{{1*/75 void BeamVertexInput::Echo(void){76 this->DeepEcho();77 }78 /*}}}*/79 111 /*FUNCTION BeamVertexInput::Enum{{{1*/ 80 112 int BeamVertexInput::Enum(void){ … … 84 116 } 85 117 /*}}}*/ 118 /*FUNCTION BeamVertexInput::copy{{{1*/ 119 Object* BeamVertexInput::copy() { 120 121 return new BeamVertexInput(this->enum_type,this->values); 122 123 } 124 /*}}}*/ 125 126 /*BeamVertexInput management*/ 86 127 /*FUNCTION BeamVertexInput::EnumType{{{1*/ 87 128 int BeamVertexInput::EnumType(void){ … … 89 130 return this->enum_type; 90 131 91 }92 /*}}}*/93 /*FUNCTION BeamVertexInput::Id{{{1*/94 int BeamVertexInput::Id(void){ return -1; }95 /*}}}*/96 /*FUNCTION BeamVertexInput::Marshall{{{1*/97 void BeamVertexInput::Marshall(char** pmarshalled_dataset){98 99 char* marshalled_dataset=NULL;100 int enum_value=0;101 102 /*recover marshalled_dataset: */103 marshalled_dataset=*pmarshalled_dataset;104 105 /*get enum value of BeamVertexInput: */106 enum_value=BeamVertexInputEnum;107 108 /*marshall enum: */109 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);110 111 /*marshall BeamVertexInput data: */112 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);113 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);114 115 *pmarshalled_dataset=marshalled_dataset;116 }117 /*}}}*/118 /*FUNCTION BeamVertexInput::MarshallSize{{{1*/119 int BeamVertexInput::MarshallSize(){120 121 return sizeof(values)+122 +sizeof(enum_type)+123 +sizeof(int); //sizeof(int) for enum_value124 }125 /*}}}*/126 /*FUNCTION BeamVertexInput::MyRank{{{1*/127 int BeamVertexInput::MyRank(void){128 extern int my_rank;129 return my_rank;130 132 } 131 133 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/BeamVertexInput.h
r4244 r4248 20 20 double values[2]; 21 21 22 /* constructors, destructors: {{{1*/22 /*BeamVertexInput constructors, destructors: {{{1*/ 23 23 BeamVertexInput(); 24 24 BeamVertexInput(int enum_type,double* values); 25 25 ~BeamVertexInput(); 26 26 /*}}}*/ 27 /*object management: {{{1*/ 27 /*Object virtual functions definitions:{{{1 */ 28 void Echo(); 28 29 void DeepEcho(); 29 void Echo();30 30 int Id(); 31 int MyRank(); 31 32 void Marshall(char** pmarshalled_dataset); 32 33 int MarshallSize(); 33 34 void Demarshall(char** pmarshalled_dataset); 34 35 int Enum(); 35 int MyRank();36 36 Object* copy(); 37 /*}}}*/ 38 /*BeamVertexInput management: {{{1*/ 37 39 int EnumType(); 38 39 40 Input* SpawnSingInput(int index); 40 41 Input* SpawnBeamInput(int* indices); 41 42 Input* SpawnTriaInput(int* indices); 42 43 ElementResult* SpawnResult(int step, double time); 43 44 44 /*}}}*/ 45 45 /*numerics: {{{1*/ -
issm/trunk/src/c/objects/Inputs/BoolInput.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Object constructors and destructor*/19 /*BoolInput constructors and destructor*/ 20 20 /*FUNCTION BoolInput::BoolInput(){{{1*/ 21 21 BoolInput::BoolInput(){ … … 36 36 /*}}}*/ 37 37 38 /*Object management*/ 39 /*FUNCTION BoolInput::copy{{{1*/ 40 Object* BoolInput::copy() { 41 42 return new BoolInput(this->enum_type,this->value); 43 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION BoolInput::Echo {{{1*/ 40 void BoolInput::Echo(void){ 41 this->DeepEcho(); 44 42 } 45 43 /*}}}*/ … … 50 48 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 51 49 printf(" value: %s\n",value?"true":"false"); 50 } 51 /*}}}*/ 52 /*FUNCTION BoolInput::Id{{{1*/ 53 int BoolInput::Id(void){ return -1; } 54 /*}}}*/ 55 /*FUNCTION BoolInput::MyRank{{{1*/ 56 int BoolInput::MyRank(void){ 57 extern int my_rank; 58 return my_rank; 59 } 60 /*}}}*/ 61 /*FUNCTION BoolInput::Marshall{{{1*/ 62 void BoolInput::Marshall(char** pmarshalled_dataset){ 63 64 char* marshalled_dataset=NULL; 65 int enum_value=0; 66 67 /*recover marshalled_dataset: */ 68 marshalled_dataset=*pmarshalled_dataset; 69 70 /*get enum value of BoolInput: */ 71 enum_value=BoolInputEnum; 72 73 /*marshall enum: */ 74 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 75 76 /*marshall BoolInput data: */ 77 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 78 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 79 80 *pmarshalled_dataset=marshalled_dataset; 81 } 82 /*}}}*/ 83 /*FUNCTION BoolInput::MarshallSize{{{1*/ 84 int BoolInput::MarshallSize(){ 85 86 return sizeof(value)+ 87 +sizeof(enum_type)+ 88 +sizeof(int); //sizeof(int) for enum value 52 89 } 53 90 /*}}}*/ … … 71 108 } 72 109 /*}}}*/ 73 /*FUNCTION BoolInput::Echo {{{1*/74 void BoolInput::Echo(void){75 this->DeepEcho();76 }77 /*}}}*/78 110 /*FUNCTION BoolInput::Enum{{{1*/ 79 111 int BoolInput::Enum(void){ … … 83 115 } 84 116 /*}}}*/ 117 /*FUNCTION BoolInput::copy{{{1*/ 118 Object* BoolInput::copy() { 119 120 return new BoolInput(this->enum_type,this->value); 121 122 } 123 /*}}}*/ 124 125 /*BoolInput management*/ 85 126 /*FUNCTION BoolInput::EnumType{{{1*/ 86 127 int BoolInput::EnumType(void){ … … 88 129 return this->enum_type; 89 130 90 }91 /*}}}*/92 /*FUNCTION BoolInput::Id{{{1*/93 int BoolInput::Id(void){ return -1; }94 /*}}}*/95 /*FUNCTION BoolInput::Marshall{{{1*/96 void BoolInput::Marshall(char** pmarshalled_dataset){97 98 char* marshalled_dataset=NULL;99 int enum_value=0;100 101 /*recover marshalled_dataset: */102 marshalled_dataset=*pmarshalled_dataset;103 104 /*get enum value of BoolInput: */105 enum_value=BoolInputEnum;106 107 /*marshall enum: */108 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);109 110 /*marshall BoolInput data: */111 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);112 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);113 114 *pmarshalled_dataset=marshalled_dataset;115 }116 /*}}}*/117 /*FUNCTION BoolInput::MarshallSize{{{1*/118 int BoolInput::MarshallSize(){119 120 return sizeof(value)+121 +sizeof(enum_type)+122 +sizeof(int); //sizeof(int) for enum value123 }124 /*}}}*/125 /*FUNCTION BoolInput::MyRank{{{1*/126 int BoolInput::MyRank(void){127 extern int my_rank;128 return my_rank;129 131 } 130 132 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/BoolInput.h
r4244 r4248 20 20 IssmBool value; 21 21 22 /* constructors, destructors: {{{1*/22 /*BoolInput constructors, destructors: {{{1*/ 23 23 BoolInput(); 24 24 BoolInput(int enum_type,IssmBool value); 25 25 ~BoolInput(); 26 26 /*}}}*/ 27 /*object management: {{{1*/ 27 /*Object virtual functions definitions:{{{1 */ 28 void Echo(); 28 29 void DeepEcho(); 29 void Echo();30 30 int Id(); 31 int MyRank(); 31 32 void Marshall(char** pmarshalled_dataset); 32 33 int MarshallSize(); 33 34 void Demarshall(char** pmarshalled_dataset); 34 35 int Enum(); 35 int MyRank();36 36 Object* copy(); 37 /*}}}*/ 38 /*BoolInput management: {{{1*/ 37 39 int EnumType(); 38 39 40 Input* SpawnSingInput(int index); 40 41 Input* SpawnBeamInput(int* indices); 41 42 Input* SpawnTriaInput(int* indices); 42 43 ElementResult* SpawnResult(int step, double time); 43 44 44 /*}}}*/ 45 45 /*numerics: {{{1*/ -
issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Object constructors and destructor*/19 /*DoubleInput constructors and destructor*/ 20 20 /*FUNCTION DoubleInput::DoubleInput(){{{1*/ 21 21 DoubleInput::DoubleInput(){ … … 36 36 /*}}}*/ 37 37 38 /*Object management*/ 39 /*FUNCTION DoubleInput::copy{{{1*/ 40 Object* DoubleInput::copy() { 41 42 return new DoubleInput(this->enum_type,this->value); 43 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION DoubleInput::Echo {{{1*/ 40 void DoubleInput::Echo(void){ 41 this->DeepEcho(); 44 42 } 45 43 /*}}}*/ … … 50 48 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 51 49 printf(" value: %g\n",this->value); 50 } 51 /*}}}*/ 52 /*FUNCTION DoubleInput::Id{{{1*/ 53 int DoubleInput::Id(void){ return -1; } 54 /*}}}*/ 55 /*FUNCTION DoubleInput::MyRank{{{1*/ 56 int DoubleInput::MyRank(void){ 57 extern int my_rank; 58 return my_rank; 59 } 60 /*}}}*/ 61 /*FUNCTION DoubleInput::Marshall{{{1*/ 62 void DoubleInput::Marshall(char** pmarshalled_dataset){ 63 64 char* marshalled_dataset=NULL; 65 int enum_value=0; 66 67 /*recover marshalled_dataset: */ 68 marshalled_dataset=*pmarshalled_dataset; 69 70 /*get enum value of DoubleInput: */ 71 enum_value=DoubleInputEnum; 72 73 /*marshall enum: */ 74 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 75 76 /*marshall DoubleInput data: */ 77 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 78 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 79 80 *pmarshalled_dataset=marshalled_dataset; 81 } 82 /*}}}*/ 83 /*FUNCTION DoubleInput::MarshallSize{{{1*/ 84 int DoubleInput::MarshallSize(){ 85 86 return sizeof(value)+ 87 +sizeof(enum_type)+ 88 +sizeof(int); //sizeof(int) for enum value 52 89 } 53 90 /*}}}*/ … … 71 108 } 72 109 /*}}}*/ 73 /*FUNCTION DoubleInput::Echo {{{1*/74 void DoubleInput::Echo(void){75 this->DeepEcho();76 }77 /*}}}*/78 110 /*FUNCTION DoubleInput::Enum{{{1*/ 79 111 int DoubleInput::Enum(void){ … … 83 115 } 84 116 /*}}}*/ 117 /*FUNCTION DoubleInput::copy{{{1*/ 118 Object* DoubleInput::copy() { 119 120 return new DoubleInput(this->enum_type,this->value); 121 122 } 123 /*}}}*/ 124 125 /*DoubleInput management*/ 85 126 /*FUNCTION DoubleInput::EnumType{{{1*/ 86 127 int DoubleInput::EnumType(void){ … … 88 129 return this->enum_type; 89 130 90 }91 /*}}}*/92 /*FUNCTION DoubleInput::Id{{{1*/93 int DoubleInput::Id(void){ return -1; }94 /*}}}*/95 /*FUNCTION DoubleInput::Marshall{{{1*/96 void DoubleInput::Marshall(char** pmarshalled_dataset){97 98 char* marshalled_dataset=NULL;99 int enum_value=0;100 101 /*recover marshalled_dataset: */102 marshalled_dataset=*pmarshalled_dataset;103 104 /*get enum value of DoubleInput: */105 enum_value=DoubleInputEnum;106 107 /*marshall enum: */108 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);109 110 /*marshall DoubleInput data: */111 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);112 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);113 114 *pmarshalled_dataset=marshalled_dataset;115 }116 /*}}}*/117 /*FUNCTION DoubleInput::MarshallSize{{{1*/118 int DoubleInput::MarshallSize(){119 120 return sizeof(value)+121 +sizeof(enum_type)+122 +sizeof(int); //sizeof(int) for enum value123 }124 /*}}}*/125 /*FUNCTION DoubleInput::MyRank{{{1*/126 int DoubleInput::MyRank(void){127 extern int my_rank;128 return my_rank;129 131 } 130 132 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/DoubleInput.h
r4244 r4248 19 19 double value; 20 20 21 /* constructors, destructors: {{{1*/21 /*DoubleInput constructors, destructors: {{{1*/ 22 22 DoubleInput(); 23 23 DoubleInput(int enum_type,IssmDouble value); 24 24 ~DoubleInput(); 25 25 /*}}}*/ 26 /*object management: {{{1*/ 26 /*Object virtual functions definitions:{{{1 */ 27 void Echo(); 27 28 void DeepEcho(); 28 void Echo();29 29 int Id(); 30 int MyRank(); 30 31 void Marshall(char** pmarshalled_dataset); 31 32 int MarshallSize(); 32 33 void Demarshall(char** pmarshalled_dataset); 33 34 int Enum(); 34 int MyRank();35 35 Object* copy(); 36 /*}}}*/ 37 /*DoubleInput management: {{{1*/ 36 38 int EnumType(); 37 38 39 Input* SpawnSingInput(int index); 39 40 Input* SpawnBeamInput(int* indices); 40 41 Input* SpawnTriaInput(int* indices); 41 42 ElementResult* SpawnResult(int step, double time); 42 43 43 /*}}}*/ 44 44 /*numerics: {{{1*/ -
issm/trunk/src/c/objects/Inputs/Input.h
r4057 r4248 20 20 21 21 virtual ~Input(){}; 22 virtual int Enum()=0; //object Enum 23 virtual int EnumType()=0; //type of input (vx,vy?) 24 25 /*methods:{{{1*/ 22 /*Virtual functions:{{{1*/ 23 virtual int EnumType()=0; 26 24 virtual void GetParameterValue(bool* pvalue)=0; 27 25 virtual void GetParameterValue(int* pvalue)=0; -
issm/trunk/src/c/objects/Inputs/IntInput.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Object constructors and destructor*/19 /*IntInput constructors and destructor*/ 20 20 /*FUNCTION IntInput::IntInput(){{{1*/ 21 21 IntInput::IntInput(){ … … 36 36 /*}}}*/ 37 37 38 /*Object management*/ 39 /*FUNCTION IntInput::copy{{{1*/ 40 Object* IntInput::copy() { 41 42 return new IntInput(this->enum_type,this->value); 43 44 } 45 /*}}}*/ 38 /*Object virtual functions definitions:*/ 46 39 /*FUNCTION IntInput::DeepEcho{{{1*/ 47 40 void IntInput::DeepEcho(void){ … … 50 43 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 51 44 printf(" value: %i\n",this->value); 45 } 46 /*}}}*/ 47 /*FUNCTION IntInput::Id{{{1*/ 48 int IntInput::Id(void){ return -1; } 49 /*}}}*/ 50 /*FUNCTION IntInput::MyRank{{{1*/ 51 int IntInput::MyRank(void){ 52 extern int my_rank; 53 return my_rank; 54 } 55 /*}}}*/ 56 /*FUNCTION IntInput::Marshall{{{1*/ 57 void IntInput::Marshall(char** pmarshalled_dataset){ 58 59 char* marshalled_dataset=NULL; 60 int enum_value=0; 61 62 /*recover marshalled_dataset: */ 63 marshalled_dataset=*pmarshalled_dataset; 64 65 /*get enum value of IntInput: */ 66 enum_value=IntInputEnum; 67 68 /*marshall enum: */ 69 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 70 71 /*marshall IntInput data: */ 72 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 73 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 74 75 *pmarshalled_dataset=marshalled_dataset; 76 } 77 /*}}}*/ 78 /*FUNCTION IntInput::MarshallSize{{{1*/ 79 int IntInput::MarshallSize(){ 80 81 return sizeof(value)+ 82 +sizeof(enum_type)+ 83 +sizeof(int); //sizeof(int) for enum value 52 84 } 53 85 /*}}}*/ … … 71 103 } 72 104 /*}}}*/ 105 /*FUNCTION IntInput::Enum{{{1*/ 106 int IntInput::Enum(void){ 107 108 return IntInputEnum; 109 110 } 111 /*}}}*/ 112 /*FUNCTION IntInput::copy{{{1*/ 113 Object* IntInput::copy() { 114 115 return new IntInput(this->enum_type,this->value); 116 117 } 118 /*}}}*/ 119 120 /*IntInput management*/ 73 121 /*FUNCTION IntInput::Echo {{{1*/ 74 122 void IntInput::Echo(void){ … … 76 124 } 77 125 /*}}}*/ 78 /*FUNCTION IntInput::Enum{{{1*/79 int IntInput::Enum(void){80 81 return IntInputEnum;82 83 }84 /*}}}*/85 126 /*FUNCTION IntInput::EnumType{{{1*/ 86 127 int IntInput::EnumType(void){ … … 88 129 return this->enum_type; 89 130 90 }91 /*}}}*/92 /*FUNCTION IntInput::Id{{{1*/93 int IntInput::Id(void){ return -1; }94 /*}}}*/95 /*FUNCTION IntInput::Marshall{{{1*/96 void IntInput::Marshall(char** pmarshalled_dataset){97 98 char* marshalled_dataset=NULL;99 int enum_value=0;100 101 /*recover marshalled_dataset: */102 marshalled_dataset=*pmarshalled_dataset;103 104 /*get enum value of IntInput: */105 enum_value=IntInputEnum;106 107 /*marshall enum: */108 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);109 110 /*marshall IntInput data: */111 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);112 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);113 114 *pmarshalled_dataset=marshalled_dataset;115 }116 /*}}}*/117 /*FUNCTION IntInput::MarshallSize{{{1*/118 int IntInput::MarshallSize(){119 120 return sizeof(value)+121 +sizeof(enum_type)+122 +sizeof(int); //sizeof(int) for enum value123 }124 /*}}}*/125 /*FUNCTION IntInput::MyRank{{{1*/126 int IntInput::MyRank(void){127 extern int my_rank;128 return my_rank;129 131 } 130 132 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/IntInput.h
r4244 r4248 20 20 IssmInt value; 21 21 22 /* constructors, destructors: {{{1*/22 /*IntInput constructors, destructors: {{{1*/ 23 23 IntInput(); 24 24 IntInput(int enum_type,IssmInt value); 25 25 ~IntInput(); 26 26 /*}}}*/ 27 /*object management: {{{1*/ 27 /*Object virtual functions definitions:{{{1 */ 28 void Echo(); 28 29 void DeepEcho(); 29 void Echo();30 30 int Id(); 31 int MyRank(); 31 32 void Marshall(char** pmarshalled_dataset); 32 33 int MarshallSize(); 33 34 void Demarshall(char** pmarshalled_dataset); 34 35 int Enum(); 35 int MyRank();36 36 Object* copy(); 37 /*}}}*/ 38 /*IntInput management: {{{1*/ 37 39 int EnumType(); 38 39 40 Input* SpawnSingInput(int index); 40 41 Input* SpawnBeamInput(int* indices); 41 42 Input* SpawnTriaInput(int* indices); 42 43 ElementResult* SpawnResult(int step, double time); 43 44 44 /*}}}*/ 45 45 /*numerics: {{{1*/ -
issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Object constructors and destructor*/19 /*PentaVertexInput constructors and destructor*/ 20 20 /*FUNCTION PentaVertexInput::PentaVertexInput(){{{1*/ 21 21 PentaVertexInput::PentaVertexInput(){ … … 41 41 /*}}}*/ 42 42 43 /*Object management*/ 44 /*FUNCTION PentaVertexInput::copy{{{1*/ 45 Object* PentaVertexInput::copy() { 46 47 return new PentaVertexInput(this->enum_type,this->values); 48 43 /*Object virtual functions definitions:*/ 44 /*FUNCTION PentaVertexInput::Echo {{{1*/ 45 void PentaVertexInput::Echo(void){ 46 this->DeepEcho(); 49 47 } 50 48 /*}}}*/ … … 57 55 } 58 56 /*}}}*/ 59 /*FUNCTION PentaVertexInput::Demarshall{{{1*/60 void PentaVertexInput::Demarshall(char** pmarshalled_dataset){61 62 char* marshalled_dataset=NULL;63 int i;64 65 /*recover marshalled_dataset: */66 marshalled_dataset=*pmarshalled_dataset;67 68 /*this time, no need to get enum type, the pointer directly points to the beginning of the69 *object data (thanks to DataSet::Demarshall):*/70 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);71 memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);72 73 /*return: */74 *pmarshalled_dataset=marshalled_dataset;75 return;76 }77 /*}}}*/78 /*FUNCTION PentaVertexInput::Echo {{{1*/79 void PentaVertexInput::Echo(void){80 this->DeepEcho();81 }82 /*}}}*/83 /*FUNCTION PentaVertexInput::Enum{{{1*/84 int PentaVertexInput::Enum(void){85 86 return PentaVertexInputEnum;87 88 }89 /*}}}*/90 /*FUNCTION PentaVertexInput::EnumType{{{1*/91 int PentaVertexInput::EnumType(void){92 93 return this->enum_type;94 95 }96 /*}}}*/97 57 /*FUNCTION PentaVertexInput::Id{{{1*/ 98 58 int PentaVertexInput::Id(void){ return -1; } 59 /*}}}*/ 60 /*FUNCTION PentaVertexInput::MyRank{{{1*/ 61 int PentaVertexInput::MyRank(void){ 62 extern int my_rank; 63 return my_rank; 64 } 99 65 /*}}}*/ 100 66 /*FUNCTION PentaVertexInput::Marshall{{{1*/ … … 128 94 } 129 95 /*}}}*/ 130 /*FUNCTION PentaVertexInput::MyRank{{{1*/ 131 int PentaVertexInput::MyRank(void){ 132 extern int my_rank; 133 return my_rank; 96 /*FUNCTION PentaVertexInput::Demarshall{{{1*/ 97 void PentaVertexInput::Demarshall(char** pmarshalled_dataset){ 98 99 char* marshalled_dataset=NULL; 100 int i; 101 102 /*recover marshalled_dataset: */ 103 marshalled_dataset=*pmarshalled_dataset; 104 105 /*this time, no need to get enum type, the pointer directly points to the beginning of the 106 *object data (thanks to DataSet::Demarshall):*/ 107 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 108 memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values); 109 110 /*return: */ 111 *pmarshalled_dataset=marshalled_dataset; 112 return; 113 } 114 /*}}}*/ 115 /*FUNCTION PentaVertexInput::Enum{{{1*/ 116 int PentaVertexInput::Enum(void){ 117 118 return PentaVertexInputEnum; 119 120 } 121 /*}}}*/ 122 123 /*PentaVertexInput management*/ 124 /*FUNCTION PentaVertexInput::copy{{{1*/ 125 Object* PentaVertexInput::copy() { 126 127 return new PentaVertexInput(this->enum_type,this->values); 128 129 } 130 /*}}}*/ 131 /*FUNCTION PentaVertexInput::EnumType{{{1*/ 132 int PentaVertexInput::EnumType(void){ 133 134 return this->enum_type; 135 134 136 } 135 137 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/PentaVertexInput.h
r4244 r4248 19 19 double values[6]; 20 20 21 /* constructors, destructors: {{{1*/21 /*PentaVertexInput constructors, destructors: {{{1*/ 22 22 PentaVertexInput(); 23 23 PentaVertexInput(int enum_type,double* values); 24 24 ~PentaVertexInput(); 25 25 /*}}}*/ 26 /*object management: {{{1*/ 26 /*Object virtual functions definitions:{{{1 */ 27 void Echo(); 27 28 void DeepEcho(); 28 void Echo();29 29 int Id(); 30 int MyRank(); 30 31 void Marshall(char** pmarshalled_dataset); 31 32 int MarshallSize(); 32 33 void Demarshall(char** pmarshalled_dataset); 33 34 int Enum(); 34 int MyRank();35 35 Object* copy(); 36 /*}}}*/ 37 /*PentaVertexInput management: {{{1*/ 36 38 int EnumType(); 37 38 39 Input* SpawnSingInput(int index); 39 40 Input* SpawnBeamInput(int* indices); 40 41 Input* SpawnTriaInput(int* indices); 41 42 ElementResult* SpawnResult(int step, double time); 42 43 43 /*}}}*/ 44 44 /*numerics: {{{1*/ -
issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Object constructors and destructor*/19 /*SingVertexInput constructors and destructor*/ 20 20 /*FUNCTION SingVertexInput::SingVertexInput(){{{1*/ 21 21 SingVertexInput::SingVertexInput(){ … … 36 36 /*}}}*/ 37 37 38 /*Object management*/ 39 /*FUNCTION SingVertexInput::copy{{{1*/ 40 Object* SingVertexInput::copy() { 41 42 return new SingVertexInput(this->enum_type,this->value); 43 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION SingVertexInput::Echo {{{1*/ 40 void SingVertexInput::Echo(void){ 41 this->DeepEcho(); 44 42 } 45 43 /*}}}*/ … … 50 48 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 51 49 printf(" value: %g\n",this->value); 50 } 51 /*}}}*/ 52 /*FUNCTION SingVertexInput::Id{{{1*/ 53 int SingVertexInput::Id(void){ return -1; } 54 /*}}}*/ 55 /*FUNCTION SingVertexInput::MyRank{{{1*/ 56 int SingVertexInput::MyRank(void){ 57 extern int my_rank; 58 return my_rank; 59 } 60 /*}}}*/ 61 /*FUNCTION SingVertexInput::Marshall{{{1*/ 62 void SingVertexInput::Marshall(char** pmarshalled_dataset){ 63 64 char* marshalled_dataset=NULL; 65 int enum_value=0; 66 67 /*recover marshalled_dataset: */ 68 marshalled_dataset=*pmarshalled_dataset; 69 70 /*get enum value of SingVertexInput: */ 71 enum_value=SingVertexInputEnum; 72 73 /*marshall enum: */ 74 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 75 76 /*marshall SingVertexInput data: */ 77 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 78 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 79 80 *pmarshalled_dataset=marshalled_dataset; 81 } 82 /*}}}*/ 83 /*FUNCTION SingVertexInput::MarshallSize{{{1*/ 84 int SingVertexInput::MarshallSize(){ 85 86 return sizeof(value)+ 87 +sizeof(enum_type)+ 88 +sizeof(int); //sizeof(int) for enum value 52 89 } 53 90 /*}}}*/ … … 71 108 } 72 109 /*}}}*/ 73 /*FUNCTION SingVertexInput::Echo {{{1*/74 void SingVertexInput::Echo(void){75 this->DeepEcho();76 }77 /*}}}*/78 110 /*FUNCTION SingVertexInput::Enum{{{1*/ 79 111 int SingVertexInput::Enum(void){ … … 83 115 } 84 116 /*}}}*/ 117 /*FUNCTION SingVertexInput::copy{{{1*/ 118 Object* SingVertexInput::copy() { 119 120 return new SingVertexInput(this->enum_type,this->value); 121 122 } 123 /*}}}*/ 124 125 /*SingVertexInput management*/ 85 126 /*FUNCTION SingVertexInput::EnumType{{{1*/ 86 127 int SingVertexInput::EnumType(void){ … … 88 129 return this->enum_type; 89 130 90 }91 /*}}}*/92 /*FUNCTION SingVertexInput::Id{{{1*/93 int SingVertexInput::Id(void){ return -1; }94 /*}}}*/95 /*FUNCTION SingVertexInput::Marshall{{{1*/96 void SingVertexInput::Marshall(char** pmarshalled_dataset){97 98 char* marshalled_dataset=NULL;99 int enum_value=0;100 101 /*recover marshalled_dataset: */102 marshalled_dataset=*pmarshalled_dataset;103 104 /*get enum value of SingVertexInput: */105 enum_value=SingVertexInputEnum;106 107 /*marshall enum: */108 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);109 110 /*marshall SingVertexInput data: */111 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);112 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);113 114 *pmarshalled_dataset=marshalled_dataset;115 }116 /*}}}*/117 /*FUNCTION SingVertexInput::MarshallSize{{{1*/118 int SingVertexInput::MarshallSize(){119 120 return sizeof(value)+121 +sizeof(enum_type)+122 +sizeof(int); //sizeof(int) for enum value123 }124 /*}}}*/125 /*FUNCTION SingVertexInput::MyRank{{{1*/126 int SingVertexInput::MyRank(void){127 extern int my_rank;128 return my_rank;129 131 } 130 132 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/SingVertexInput.h
r4244 r4248 19 19 double value; 20 20 21 /* constructors, destructors: {{{1*/21 /*SingVertexInput constructors, destructors: {{{1*/ 22 22 SingVertexInput(); 23 23 SingVertexInput(int enum_type,double value); 24 24 ~SingVertexInput(); 25 25 /*}}}*/ 26 /*object management: {{{1*/ 26 /*Object virtual functions definitions:{{{1 */ 27 void Echo(); 27 28 void DeepEcho(); 28 void Echo();29 29 int Id(); 30 int MyRank(); 30 31 void Marshall(char** pmarshalled_dataset); 31 32 int MarshallSize(); 32 33 void Demarshall(char** pmarshalled_dataset); 33 34 int Enum(); 34 int MyRank();35 35 Object* copy(); 36 /*}}}*/ 37 /*SingVertexInput management: {{{1*/ 36 38 int EnumType(); 37 38 39 Input* SpawnSingInput(int index); 39 40 Input* SpawnBeamInput(int* indices); 40 41 Input* SpawnTriaInput(int* indices); 41 42 ElementResult* SpawnResult(int step, double time); 42 43 43 /*}}}*/ 44 44 /*numerics: {{{1*/ -
issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp
r4236 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Object constructors and destructor*/19 /*TriaVertexInput constructors and destructor*/ 20 20 /*FUNCTION TriaVertexInput::TriaVertexInput(){{{1*/ 21 21 TriaVertexInput::TriaVertexInput(){ … … 38 38 /*}}}*/ 39 39 40 /*Object management*/ 41 /*FUNCTION TriaVertexInput::copy{{{1*/ 42 Object* TriaVertexInput::copy() { 43 44 return new TriaVertexInput(this->enum_type,this->values); 45 40 /*Object virtual functions definitions:*/ 41 /*FUNCTION TriaVertexInput::Echo {{{1*/ 42 void TriaVertexInput::Echo(void){ 43 this->DeepEcho(); 46 44 } 47 45 /*}}}*/ … … 52 50 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 53 51 printf(" values: [%g %g %g]\n",this->values[0],this->values[1],this->values[2]); 52 } 53 /*}}}*/ 54 /*FUNCTION TriaVertexInput::Id{{{1*/ 55 int TriaVertexInput::Id(void){ return -1; } 56 /*}}}*/ 57 /*FUNCTION TriaVertexInput::MyRank{{{1*/ 58 int TriaVertexInput::MyRank(void){ 59 extern int my_rank; 60 return my_rank; 61 } 62 /*}}}*/ 63 /*FUNCTION TriaVertexInput::Marshall{{{1*/ 64 void TriaVertexInput::Marshall(char** pmarshalled_dataset){ 65 66 char* marshalled_dataset=NULL; 67 int enum_value=0; 68 69 /*recover marshalled_dataset: */ 70 marshalled_dataset=*pmarshalled_dataset; 71 72 /*get enum value of TriaVertexInput: */ 73 enum_value=TriaVertexInputEnum; 74 75 /*marshall enum: */ 76 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 77 78 /*marshall TriaVertexInput data: */ 79 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 80 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values); 81 82 *pmarshalled_dataset=marshalled_dataset; 83 } 84 /*}}}*/ 85 /*FUNCTION TriaVertexInput::MarshallSize{{{1*/ 86 int TriaVertexInput::MarshallSize(){ 87 88 return sizeof(values)+ 89 +sizeof(enum_type)+ 90 +sizeof(int); //sizeof(int) for enum value 54 91 } 55 92 /*}}}*/ … … 73 110 } 74 111 /*}}}*/ 75 /*FUNCTION TriaVertexInput::Echo {{{1*/76 void TriaVertexInput::Echo(void){77 this->DeepEcho();78 }79 /*}}}*/80 112 /*FUNCTION TriaVertexInput::Enum{{{1*/ 81 113 int TriaVertexInput::Enum(void){ … … 85 117 } 86 118 /*}}}*/ 119 /*FUNCTION TriaVertexInput::copy{{{1*/ 120 Object* TriaVertexInput::copy() { 121 122 return new TriaVertexInput(this->enum_type,this->values); 123 124 } 125 /*}}}*/ 126 127 /*TriaVertexInput management*/ 87 128 /*FUNCTION TriaVertexInput::EnumType{{{1*/ 88 129 int TriaVertexInput::EnumType(void){ … … 90 131 return this->enum_type; 91 132 92 }93 /*}}}*/94 /*FUNCTION TriaVertexInput::Id{{{1*/95 int TriaVertexInput::Id(void){ return -1; }96 /*}}}*/97 /*FUNCTION TriaVertexInput::Marshall{{{1*/98 void TriaVertexInput::Marshall(char** pmarshalled_dataset){99 100 char* marshalled_dataset=NULL;101 int enum_value=0;102 103 /*recover marshalled_dataset: */104 marshalled_dataset=*pmarshalled_dataset;105 106 /*get enum value of TriaVertexInput: */107 enum_value=TriaVertexInputEnum;108 109 /*marshall enum: */110 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);111 112 /*marshall TriaVertexInput data: */113 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);114 memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);115 116 *pmarshalled_dataset=marshalled_dataset;117 }118 /*}}}*/119 /*FUNCTION TriaVertexInput::MarshallSize{{{1*/120 int TriaVertexInput::MarshallSize(){121 122 return sizeof(values)+123 +sizeof(enum_type)+124 +sizeof(int); //sizeof(int) for enum value125 }126 /*}}}*/127 /*FUNCTION TriaVertexInput::MyRank{{{1*/128 int TriaVertexInput::MyRank(void){129 extern int my_rank;130 return my_rank;131 133 } 132 134 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/TriaVertexInput.h
r4244 r4248 20 20 double values[3]; 21 21 22 /* constructors, destructors: {{{1*/22 /*TriaVertexInput constructors, destructors: {{{1*/ 23 23 TriaVertexInput(); 24 24 TriaVertexInput(int enum_type,double* values); 25 25 ~TriaVertexInput(); 26 26 /*}}}*/ 27 /*object management: {{{1*/ 27 /*Object virtual functions definitions:{{{1 */ 28 void Echo(); 28 29 void DeepEcho(); 29 void Echo();30 30 int Id(); 31 int MyRank(); 31 32 void Marshall(char** pmarshalled_dataset); 32 33 int MarshallSize(); 33 34 void Demarshall(char** pmarshalled_dataset); 34 35 int Enum(); 35 int MyRank();36 36 Object* copy(); 37 /*}}}*/ 38 /*TriaVertexInput management: {{{1*/ 37 39 int EnumType(); 38 39 40 Input* SpawnSingInput(int index); 40 41 Input* SpawnBeamInput(int* indices); 41 42 Input* SpawnTriaInput(int* indices); 42 43 ElementResult* SpawnResult(int step, double time); 43 44 44 /*}}}*/ 45 45 /*numerics: {{{1*/ -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r4232 r4248 19 19 /*}}}*/ 20 20 21 /* Object constructors and destructor*/21 /*Icefront constructors and destructor*/ 22 22 /*FUNCTION Icefront::Icefront() {{{1*/ 23 23 Icefront::Icefront(){ … … 99 99 100 100 /*}}}*/ 101 /*FUNCTION Icefront::copy {{{1*/102 Object* Icefront::copy() {103 104 Icefront* icefront=NULL;105 106 icefront=new Icefront();107 108 /*copy fields: */109 icefront->id=this->id;110 icefront->analysis_type=this->analysis_type;111 if(this->inputs){112 icefront->inputs=(Inputs*)this->inputs->Copy();113 }114 else{115 icefront->inputs=new Inputs();116 }117 /*point parameters: */118 icefront->parameters=this->parameters;119 120 /*now deal with hooks and objects: */121 icefront->hnodes.copy(&this->hnodes);122 icefront->helement.copy(&this->helement);123 icefront->hmatpar.copy(&this->hmatpar);124 125 return icefront;126 127 }128 /*}}}*/129 101 /*FUNCTION Icefront::~Icefront() {{{1*/ 130 102 Icefront::~Icefront(){ … … 134 106 /*}}}*/ 135 107 136 /*Object marshall*/ 137 /*FUNCTION Icefront::Configure {{{1*/ 138 void Icefront::Configure(Elements* elementsin,Loads* loadsin,DataSet* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 139 140 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 141 * datasets, using internal ids and offsets hidden in hooks: */ 142 hnodes.configure(nodesin); 143 helement.configure(elementsin); 144 hmatpar.configure(materialsin); 145 146 /*point parameters to real dataset: */ 147 this->parameters=parametersin; 148 } 149 /*}}}*/ 150 /*FUNCTION Icefront::DeepEcho{{{1*/ 151 void Icefront::DeepEcho(void){ 152 153 printf("Icefront:\n"); 154 printf(" id: %i\n",id); 155 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 156 hnodes.DeepEcho(); 157 helement.DeepEcho(); 158 hmatpar.DeepEcho(); 159 printf(" parameters\n"); 160 parameters->DeepEcho(); 161 printf(" inputs\n"); 162 inputs->DeepEcho(); 163 } 164 /*}}}*/ 165 /*FUNCTION Icefront::Demarshall {{{1*/ 166 void Icefront::Demarshall(char** pmarshalled_dataset){ 167 168 char* marshalled_dataset=NULL; 169 int i; 170 171 /*recover marshalled_dataset: */ 172 marshalled_dataset=*pmarshalled_dataset; 173 174 /*this time, no need to get enum type, the pointer directly points to the beginning of the 175 *object data (thanks to DataSet::Demarshall):*/ 176 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 177 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 178 179 /*demarshall hooks: */ 180 hnodes.Demarshall(&marshalled_dataset); 181 helement.Demarshall(&marshalled_dataset); 182 hmatpar.Demarshall(&marshalled_dataset); 183 184 /*demarshall inputs: */ 185 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 186 187 /*parameters: may not exist even yet, so let Configure handle it: */ 188 this->parameters=NULL; 189 190 /*return: */ 191 *pmarshalled_dataset=marshalled_dataset; 192 return; 193 } 194 /*}}}*/ 108 /*Object virtual functions definitions:*/ 195 109 /*FUNCTION Icefront::Echo {{{1*/ 196 110 void Icefront::Echo(void){ … … 207 121 } 208 122 /*}}}*/ 209 /*FUNCTION Icefront::Enum {{{1*/ 210 int Icefront::Enum(void){ 211 212 return IcefrontEnum; 213 123 /*FUNCTION Icefront::DeepEcho{{{1*/ 124 void Icefront::DeepEcho(void){ 125 126 printf("Icefront:\n"); 127 printf(" id: %i\n",id); 128 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 129 hnodes.DeepEcho(); 130 helement.DeepEcho(); 131 hmatpar.DeepEcho(); 132 printf(" parameters\n"); 133 parameters->DeepEcho(); 134 printf(" inputs\n"); 135 inputs->DeepEcho(); 214 136 } 215 137 /*}}}*/ 216 138 /*FUNCTION Icefront::Id {{{1*/ 217 139 int Icefront::Id(void){ return id; } 140 /*}}}*/ 141 /*FUNCTION Icefront::MyRank {{{1*/ 142 int Icefront::MyRank(void){ 143 extern int my_rank; 144 return my_rank; 145 } 218 146 /*}}}*/ 219 147 /*FUNCTION Icefront::Marshall {{{1*/ … … 268 196 } 269 197 /*}}}*/ 270 /*FUNCTION Icefront::MyRank {{{1*/ 271 int Icefront::MyRank(void){ 272 extern int my_rank; 273 return my_rank; 274 } 275 /*}}}*/ 276 277 /*Object functions*/ 198 /*FUNCTION Icefront::Demarshall {{{1*/ 199 void Icefront::Demarshall(char** pmarshalled_dataset){ 200 201 char* marshalled_dataset=NULL; 202 int i; 203 204 /*recover marshalled_dataset: */ 205 marshalled_dataset=*pmarshalled_dataset; 206 207 /*this time, no need to get enum type, the pointer directly points to the beginning of the 208 *object data (thanks to DataSet::Demarshall):*/ 209 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 210 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 211 212 /*demarshall hooks: */ 213 hnodes.Demarshall(&marshalled_dataset); 214 helement.Demarshall(&marshalled_dataset); 215 hmatpar.Demarshall(&marshalled_dataset); 216 217 /*demarshall inputs: */ 218 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 219 220 /*parameters: may not exist even yet, so let Configure handle it: */ 221 this->parameters=NULL; 222 223 /*return: */ 224 *pmarshalled_dataset=marshalled_dataset; 225 return; 226 } 227 /*}}}*/ 228 /*FUNCTION Icefront::Enum {{{1*/ 229 int Icefront::Enum(void){ 230 231 return IcefrontEnum; 232 233 } 234 /*}}}*/ 235 /*FUNCTION Icefront::copy {{{1*/ 236 Object* Icefront::copy() { 237 238 Icefront* icefront=NULL; 239 240 icefront=new Icefront(); 241 242 /*copy fields: */ 243 icefront->id=this->id; 244 icefront->analysis_type=this->analysis_type; 245 if(this->inputs){ 246 icefront->inputs=(Inputs*)this->inputs->Copy(); 247 } 248 else{ 249 icefront->inputs=new Inputs(); 250 } 251 /*point parameters: */ 252 icefront->parameters=this->parameters; 253 254 /*now deal with hooks and objects: */ 255 icefront->hnodes.copy(&this->hnodes); 256 icefront->helement.copy(&this->helement); 257 icefront->hmatpar.copy(&this->hmatpar); 258 259 return icefront; 260 261 } 262 /*}}}*/ 263 264 /*Load virtual functions definitions:*/ 265 /*FUNCTION Icefront::Configure {{{1*/ 266 void Icefront::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 267 268 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 269 * datasets, using internal ids and offsets hidden in hooks: */ 270 hnodes.configure(nodesin); 271 helement.configure(elementsin); 272 hmatpar.configure(materialsin); 273 274 /*point parameters to real dataset: */ 275 this->parameters=parametersin; 276 } 277 /*}}}*/ 278 278 /*FUNCTION Icefront::CreateKMatrix {{{1*/ 279 279 void Icefront::CreateKMatrix(Mat Kgg){ … … 307 307 } 308 308 /*}}}*/ 309 /*FUNCTION Icefront::PenaltyCreateKMatrix {{{1*/ 310 void Icefront::PenaltyCreateKMatrix(Mat Kgg,double kmax){ 311 /*do nothing: */ 312 } 313 /*}}}*/ 314 /*FUNCTION Icefront::PenaltyCreatePVector{{{1*/ 315 void Icefront::PenaltyCreatePVector(Vec pg,double kmax){ 316 /*do nothing: */ 317 } 318 /*}}}*/ 319 /*FUNCTION Icefront::InAnalysis(int analysis_type){{{1*/ 320 bool Icefront::InAnalysis(int in_analysis_type){ 321 if (in_analysis_type==this->analysis_type)return true; 322 else return false; 323 } 324 /*}}}*/ 325 326 /*Update virtual functions definitions:*/ 327 /*FUNCTION Icefront::InputUpdateFromVector(double* vector, int name, int type) {{{1*/ 328 void Icefront::InputUpdateFromVector(double* vector, int name, int type){ 329 /*Nothing updated yet*/ 330 } 331 /*}}}*/ 332 /*FUNCTION Icefront::InputUpdateFromVector(int* vector, int name, int type) {{{1*/ 333 void Icefront::InputUpdateFromVector(int* vector, int name, int type){ 334 /*Nothing updated yet*/ 335 } 336 /*}}}*/ 337 /*FUNCTION Icefront::InputUpdateFromVector(bool* vector, int name, int type) {{{1*/ 338 void Icefront::InputUpdateFromVector(bool* vector, int name, int type){ 339 /*Nothing updated yet*/ 340 } 341 /*}}}*/ 342 /*FUNCTION Icefront::InputUpdateFromConstant(double constant, int name) {{{1*/ 343 void Icefront::InputUpdateFromConstant(double constant, int name){ 344 /*Nothing updated yet*/ 345 } 346 /*}}}*/ 347 /*FUNCTION Icefront::InputUpdateFromConstant(int constant, int name) {{{1*/ 348 void Icefront::InputUpdateFromConstant(int constant, int name){ 349 /*Nothing updated yet*/ 350 } 351 /*}}}*/ 352 /*FUNCTION Icefront::InputUpdateFromConstant(bool constant, int name) {{{1*/ 353 void Icefront::InputUpdateFromConstant(bool constant, int name){ 354 /*Nothing updated yet*/ 355 } 356 /*}}}*/ 357 /*FUNCTION Icefront::InputUpdateFromSolution(double* solution) {{{1*/ 358 void Icefront::InputUpdateFromSolution(double* solution){ 359 /*Nothing updated yet*/ 360 } 361 /*}}}*/ 362 363 /*Icefront numerics: */ 309 364 /*FUNCTION Icefront::CreatePVectorDiagnosticHoriz {{{1*/ 310 365 void Icefront::CreatePVectorDiagnosticHoriz( Vec pg){ … … 725 780 *pnumberofdofspernode=numberofdofspernode; 726 781 727 }728 /*}}}*/729 /*FUNCTION Icefront::PenaltyCreateKMatrix {{{1*/730 void Icefront::PenaltyCreateKMatrix(Mat Kgg,double kmax){731 /*do nothing: */732 }733 /*}}}*/734 /*FUNCTION Icefront::PenaltyCreatePVector{{{1*/735 void Icefront::PenaltyCreatePVector(Vec pg,double kmax){736 /*do nothing: */737 782 } 738 783 /*}}}*/ … … 1332 1377 } 1333 1378 /*}}}*/ 1334 /*FUNCTION Icefront::InputUpdateFromVector(double* vector, int name, int type) {{{1*/1335 void Icefront::InputUpdateFromVector(double* vector, int name, int type){1336 /*Nothing updated yet*/1337 }1338 /*}}}*/1339 /*FUNCTION Icefront::InputUpdateFromVector(int* vector, int name, int type) {{{1*/1340 void Icefront::InputUpdateFromVector(int* vector, int name, int type){1341 /*Nothing updated yet*/1342 }1343 /*}}}*/1344 /*FUNCTION Icefront::InputUpdateFromVector(bool* vector, int name, int type) {{{1*/1345 void Icefront::InputUpdateFromVector(bool* vector, int name, int type){1346 /*Nothing updated yet*/1347 }1348 /*}}}*/1349 /*FUNCTION Icefront::InputUpdateFromConstant(double constant, int name) {{{1*/1350 void Icefront::InputUpdateFromConstant(double constant, int name){1351 /*Nothing updated yet*/1352 }1353 /*}}}*/1354 /*FUNCTION Icefront::InputUpdateFromConstant(int constant, int name) {{{1*/1355 void Icefront::InputUpdateFromConstant(int constant, int name){1356 /*Nothing updated yet*/1357 }1358 /*}}}*/1359 /*FUNCTION Icefront::InputUpdateFromConstant(bool constant, int name) {{{1*/1360 void Icefront::InputUpdateFromConstant(bool constant, int name){1361 /*Nothing updated yet*/1362 }1363 /*}}}*/1364 /*FUNCTION Icefront::InputUpdateFromSolution(double* solution) {{{1*/1365 void Icefront::InputUpdateFromSolution(double* solution){1366 /*Nothing updated yet*/1367 }1368 /*}}}*/1369 /*FUNCTION Icefront::InAnalysis(int analysis_type){{{1*/1370 bool Icefront::InAnalysis(int in_analysis_type){1371 if (in_analysis_type==this->analysis_type)return true;1372 else return false;1373 }1374 /*}}}*/1375 -
issm/trunk/src/c/objects/Loads/Icefront.h
r4244 r4248 33 33 Parameters* parameters; 34 34 35 /* constructors: {{{1*/35 /*Icefront constructors, destructors: {{{1*/ 36 36 Icefront(); 37 37 Icefront(int icefront_id,int i, IoModel* iomodel,int analysis_type); 38 38 ~Icefront(); 39 /*}}}*/ 40 /*Object virtual functions definitions:{{{1 */ 41 void Echo(); 42 void DeepEcho(); 43 int Id(); 44 int MyRank(); 45 void Marshall(char** pmarshalled_dataset); 46 int MarshallSize(); 47 void Demarshall(char** pmarshalled_dataset); 48 int Enum(); 39 49 Object* copy(); 40 50 /*}}}*/ 41 /*Object virtual functions resolution: {{{1*/ 42 void Configure(Elements* elementsin,Loads* loadsin,DataSet* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin); 43 void DeepEcho(); 44 void Demarshall(char** pmarshalled_dataset); 45 void Echo(); 46 int Enum(); 47 int Id(); 48 void Marshall(char** pmarshalled_dataset); 49 int MarshallSize(); 50 int MyRank(); 51 /*}}}*/ 52 /*Update virtual functions resolution: {{{1*/ 51 /*Update virtual functions definitions: {{{1*/ 53 52 void InputUpdateFromVector(double* vector, int name, int type); 54 53 void InputUpdateFromVector(int* vector, int name, int type); … … 58 57 void InputUpdateFromConstant(bool constant, int name); 59 58 void InputUpdateFromSolution(double* solution); 59 /*}}}*/ 60 /*Load virtual functions definitions: {{{1*/ 61 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 62 void CreateKMatrix(Mat Kgg); 63 void CreatePVector(Vec pg); 64 void PenaltyCreateKMatrix(Mat Kgg,double kmax); 65 void PenaltyCreatePVector(Vec pg,double kmax); 60 66 bool InAnalysis(int analysis_type); 61 67 /*}}}*/ 62 /*numerics: {{{1*/ 63 void CreateKMatrix(Mat Kgg); 64 void CreatePVector(Vec pg); 68 /*Load management: {{{1*/ 65 69 void CreatePVectorDiagnosticHoriz( Vec pg); 66 70 void CreatePVectorDiagnosticHorizSegment( Vec pg); … … 73 77 void QuadPressureLoadStokes(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, 74 78 double* normal1,double* normal2,double* normal3,double* normal4,double* xyz_list); 75 void PenaltyCreateKMatrix(Mat Kgg,double kmax);76 void PenaltyCreatePVector(Vec pg,double kmax);77 79 /*}}}*/ 78 80 }; -
issm/trunk/src/c/objects/Loads/Load.h
r4244 r4248 21 21 22 22 public: 23 23 24 virtual ~Load(){}; 24 virtual void Echo()=0; 25 virtual void DeepEcho()=0; 26 virtual int Id()=0; 27 virtual int MyRank()=0; 28 virtual void Marshall(char** pmarshalled_dataset)=0; 29 virtual int MarshallSize()=0; 30 virtual void Demarshall(char** pmarshalled_dataset)=0; 31 virtual void Configure(Elements* elements,Loads* loads,DataSet* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0; 25 /*Virtual functions: {{{1*/ 26 virtual void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0; 32 27 virtual void CreateKMatrix(Mat Kgg)=0; 33 28 virtual void CreatePVector(Vec pg)=0; … … 35 30 virtual void PenaltyCreatePVector(Vec pg,double kmax)=0; 36 31 virtual bool InAnalysis(int analysis_type)=0; 32 /*}}}*/ 37 33 }; 38 34 #endif -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r4232 r4248 18 18 extern int my_rank; 19 19 20 /* Objectconstructors and destructor*/20 /*Numericalflux constructors and destructor*/ 21 21 /*FUNCTION Numericalflux::Numericalflux(){{{1*/ 22 22 Numericalflux::Numericalflux(){ … … 120 120 } 121 121 /*}}}*/ 122 /*FUNCTION Numericalflux::copy {{{1*/123 Object* Numericalflux::copy() {124 125 Numericalflux* numericalflux=NULL;126 127 numericalflux=new Numericalflux();128 129 /*copy fields: */130 numericalflux->id=this->id;131 numericalflux->analysis_type=this->analysis_type;132 if(this->inputs){133 numericalflux->inputs=(Inputs*)this->inputs->Copy();134 }135 else{136 numericalflux->inputs=new Inputs();137 }138 /*point parameters: */139 numericalflux->parameters=this->parameters;140 141 /*now deal with hooks and objects: */142 numericalflux->hnodes.copy(&this->hnodes);143 numericalflux->helements.copy(&this->helements);144 145 return numericalflux;146 147 }148 /*}}}*/149 122 /*FUNCTION Numericalflux::~Numericalflux(){{{1*/ 150 123 Numericalflux::~Numericalflux(){ … … 154 127 /*}}}*/ 155 128 156 /*Object marshall*/ 157 /*FUNCTION Numericalflux::Configure {{{1*/ 158 void Numericalflux::Configure(Elements* elementsin,Loads* loadsin,DataSet* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 159 160 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 161 * datasets, using internal ids and offsets hidden in hooks: */ 162 hnodes.configure(nodesin); 163 helements.configure(elementsin); 164 165 /*point parameters to real dataset: */ 166 this->parameters=parametersin; 167 129 /*Object virtual functions definitions:*/ 130 /*FUNCTION Numericalflux::Echo {{{1*/ 131 void Numericalflux::Echo(void){ 132 this->DeepEcho(); 168 133 } 169 134 /*}}}*/ … … 183 148 } 184 149 /*}}}*/ 150 /*FUNCTION Numericalflux::Id {{{1*/ 151 int Numericalflux::Id(void){ 152 return id; 153 } 154 /*}}}*/ 155 /*FUNCTION Numericalflux::MyRank {{{1*/ 156 int Numericalflux::MyRank(void){ 157 extern int my_rank; 158 return my_rank; 159 } 160 /*}}}*/ 161 /*FUNCTION Numericalflux::Marshall {{{1*/ 162 void Numericalflux::Marshall(char** pmarshalled_dataset){ 163 164 char* marshalled_dataset=NULL; 165 int enum_type=0; 166 char* marshalled_inputs=NULL; 167 int marshalled_inputs_size; 168 169 /*recover marshalled_dataset: */ 170 marshalled_dataset=*pmarshalled_dataset; 171 172 /*get enum type of Numericalflux: */ 173 enum_type=NumericalfluxEnum; 174 175 /*marshall enum: */ 176 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 177 178 /*marshall Numericalflux data: */ 179 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 180 memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 181 182 /*Marshall hooks: */ 183 hnodes.Marshall(&marshalled_dataset); 184 helements.Marshall(&marshalled_dataset); 185 186 /*Marshall inputs: */ 187 marshalled_inputs_size=inputs->MarshallSize(); 188 marshalled_inputs=inputs->Marshall(); 189 memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char)); 190 marshalled_dataset+=marshalled_inputs_size; 191 192 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ 193 194 xfree((void**)&marshalled_inputs); 195 196 *pmarshalled_dataset=marshalled_dataset; 197 return; 198 } 199 /*}}}*/ 200 /*FUNCTION Numericalflux::MarshallSize{{{1*/ 201 int Numericalflux::MarshallSize(){ 202 203 return sizeof(id) 204 +sizeof(analysis_type) 205 +hnodes.MarshallSize() 206 +helements.MarshallSize() 207 +inputs->MarshallSize() 208 +sizeof(int); //sizeof(int) for enum type 209 } 210 /*}}}*/ 185 211 /*FUNCTION Numericalflux::Demarshall {{{1*/ 186 212 void Numericalflux::Demarshall(char** pmarshalled_dataset){ … … 212 238 } 213 239 /*}}}*/ 214 /*FUNCTION Numericalflux::Echo {{{1*/215 void Numericalflux::Echo(void){216 this->DeepEcho();217 }218 /*}}}*/219 240 /*FUNCTION Numericalflux::Enum {{{1*/ 220 241 int Numericalflux::Enum(void){ … … 224 245 } 225 246 /*}}}*/ 226 /*FUNCTION Numericalflux::Marshall {{{1*/ 227 void Numericalflux::Marshall(char** pmarshalled_dataset){ 228 229 char* marshalled_dataset=NULL; 230 int enum_type=0; 231 char* marshalled_inputs=NULL; 232 int marshalled_inputs_size; 233 234 /*recover marshalled_dataset: */ 235 marshalled_dataset=*pmarshalled_dataset; 236 237 /*get enum type of Numericalflux: */ 238 enum_type=NumericalfluxEnum; 239 240 /*marshall enum: */ 241 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 242 243 /*marshall Numericalflux data: */ 244 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 245 memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 246 247 /*Marshall hooks: */ 248 hnodes.Marshall(&marshalled_dataset); 249 helements.Marshall(&marshalled_dataset); 250 251 /*Marshall inputs: */ 252 marshalled_inputs_size=inputs->MarshallSize(); 253 marshalled_inputs=inputs->Marshall(); 254 memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char)); 255 marshalled_dataset+=marshalled_inputs_size; 256 257 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ 258 259 xfree((void**)&marshalled_inputs); 260 261 *pmarshalled_dataset=marshalled_dataset; 262 return; 263 } 264 /*}}}*/ 265 /*FUNCTION Numericalflux::MarshallSize{{{1*/ 266 int Numericalflux::MarshallSize(){ 267 268 return sizeof(id) 269 +sizeof(analysis_type) 270 +hnodes.MarshallSize() 271 +helements.MarshallSize() 272 +inputs->MarshallSize() 273 +sizeof(int); //sizeof(int) for enum type 274 } 275 /*}}}*/ 276 /*FUNCTION Numericalflux::MyRank {{{1*/ 277 int Numericalflux::MyRank(void){ 278 extern int my_rank; 279 return my_rank; 280 } 281 /*}}}*/ 282 283 /*Object functions*/ 247 /*FUNCTION Numericalflux::copy {{{1*/ 248 Object* Numericalflux::copy() { 249 250 Numericalflux* numericalflux=NULL; 251 252 numericalflux=new Numericalflux(); 253 254 /*copy fields: */ 255 numericalflux->id=this->id; 256 numericalflux->analysis_type=this->analysis_type; 257 if(this->inputs){ 258 numericalflux->inputs=(Inputs*)this->inputs->Copy(); 259 } 260 else{ 261 numericalflux->inputs=new Inputs(); 262 } 263 /*point parameters: */ 264 numericalflux->parameters=this->parameters; 265 266 /*now deal with hooks and objects: */ 267 numericalflux->hnodes.copy(&this->hnodes); 268 numericalflux->helements.copy(&this->helements); 269 270 return numericalflux; 271 272 } 273 /*}}}*/ 274 275 /*Load virtual functions definitions:*/ 276 /*FUNCTION Numericalflux::Configure {{{1*/ 277 void Numericalflux::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 278 279 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 280 * datasets, using internal ids and offsets hidden in hooks: */ 281 hnodes.configure(nodesin); 282 helements.configure(elementsin); 283 284 /*point parameters to real dataset: */ 285 this->parameters=parametersin; 286 287 } 288 /*}}}*/ 284 289 /*FUNCTION Numericalflux::CreateKMatrix {{{1*/ 285 290 void Numericalflux::CreateKMatrix(Mat Kgg){ … … 300 305 } 301 306 /*}}}*/ 307 /*FUNCTION Numericalflux::CreatePVector {{{1*/ 308 void Numericalflux::CreatePVector(Vec pg){ 309 310 int type; 311 312 /*recover type: */ 313 inputs->GetParameterValue(&type,TypeEnum); 314 315 if (type==InternalEnum){ 316 CreatePVectorInternal(pg); 317 } 318 else if (type==BoundaryEnum){ 319 CreatePVectorBoundary(pg); 320 } 321 else ISSMERROR("type not supported yet"); 322 323 } 324 /*}}}*/ 325 /*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{1*/ 326 void Numericalflux::PenaltyCreateKMatrix(Mat Kgg,double kmax){ 327 328 /*No stiffness loads applied, do nothing: */ 329 return; 330 331 } 332 /*}}}*/ 333 /*FUNCTION Numericalflux::PenaltyCreatePVector{{{1*/ 334 void Numericalflux::PenaltyCreatePVector(Vec pg,double kmax){ 335 336 /*No penalty loads applied, do nothing: */ 337 return; 338 339 } 340 /*}}}*/ 341 /*FUNCTION Numericalflux::InAnalysis(int analysis_type){{{1*/ 342 bool Numericalflux::InAnalysis(int in_analysis_type){ 343 if (in_analysis_type==this->analysis_type) return true; 344 else return false; 345 } 346 /*}}}*/ 347 348 /*Numericalflux management*/ 302 349 /*FUNCTION Numericalflux::CreateKMatrixInternal {{{1*/ 303 350 void Numericalflux::CreateKMatrixInternal(Mat Kgg){ … … 541 588 } 542 589 /*}}}*/ 543 /*FUNCTION Numericalflux::CreatePVector {{{1*/544 void Numericalflux::CreatePVector(Vec pg){545 546 int type;547 548 /*recover type: */549 inputs->GetParameterValue(&type,TypeEnum);550 551 if (type==InternalEnum){552 CreatePVectorInternal(pg);553 }554 else if (type==BoundaryEnum){555 CreatePVectorBoundary(pg);556 }557 else ISSMERROR("type not supported yet");558 559 }560 /*}}}*/561 590 /*FUNCTION Numericalflux::CreatePVectorInternal{{{1*/ 562 591 void Numericalflux::CreatePVectorInternal(Vec pg){ … … 684 713 } 685 714 /*}}}*/ 686 /*}}}*/687 715 /*FUNCTION Numericalflux::GetB {{{1*/ 688 716 void Numericalflux::GetB(double* B, double gauss_coord){ … … 741 769 } 742 770 /*}}}*/ 743 /*FUNCTION Numericalflux::Id {{{1*/744 int Numericalflux::Id(void){745 return id;746 }747 /*}}}*/748 771 /*FUNCTION Numericalflux::GetJacobianDeterminant{{{1*/ 749 772 void Numericalflux::GetJacobianDeterminant(double* pJdet,double xyz_list[4][3], double gauss_coord){ … … 831 854 } 832 855 /*}}}*/ 833 /*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{1*/834 void Numericalflux::PenaltyCreateKMatrix(Mat Kgg,double kmax){835 836 /*No stiffness loads applied, do nothing: */837 return;838 839 }840 /*}}}*/841 /*FUNCTION Numericalflux::PenaltyCreatePVector{{{1*/842 void Numericalflux::PenaltyCreatePVector(Vec pg,double kmax){843 844 /*No penalty loads applied, do nothing: */845 return;846 847 }848 /*}}}*/849 /*FUNCTION Numericalflux::InAnalysis(int analysis_type){{{1*/850 bool Numericalflux::InAnalysis(int in_analysis_type){851 if (in_analysis_type==this->analysis_type) return true;852 else return false;853 }854 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Numericalflux.h
r4244 r4248 28 28 29 29 30 /* Constructors {{{1*/30 /*Numericalflux constructors,destructors {{{1*/ 31 31 Numericalflux(); 32 32 Numericalflux(int numericalflux_id,int i, IoModel* iomodel,int analysis_type); 33 33 ~Numericalflux(); 34 Object* copy();35 34 /*}}}*/ 36 /*Object virtual functions resolution: {{{1*/37 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);35 /*Object virtual functions definitions:{{{1 */ 36 void Echo(); 38 37 void DeepEcho(); 39 void Demarshall(char** pmarshalled_dataset);40 void Echo();41 int Enum();42 38 int Id(); 39 int MyRank(); 43 40 void Marshall(char** pmarshalled_dataset); 44 41 int MarshallSize(); 45 int MyRank(); 42 void Demarshall(char** pmarshalled_dataset); 43 int Enum(); 44 Object* copy(); 46 45 /*}}}*/ 47 46 /*Update virtual functions resolution: {{{1*/ … … 54 53 void InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");} 55 54 /*}}}*/ 56 /*Numerics: {{{1*/ 55 /*Load virtual functions definitions: {{{1*/ 56 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 57 void CreateKMatrix(Mat Kgg); 58 void CreatePVector(Vec pg); 59 void PenaltyCreateKMatrix(Mat Kgg,double kmax); 60 void PenaltyCreatePVector(Vec pg,double kmax); 57 61 bool InAnalysis(int analysis_type); 62 /*}}}*/ 63 /*Numericalflux management:{{{1*/ 58 64 void GetJacobianDeterminant(double* pJdet,double xyz_list[4][3], double gauss_coord); 59 65 void GetNodalFunctions(double* l1l4, double gauss_coord); … … 63 69 void GetNormal(double* normal,double xyz_list[4][3]); 64 70 void GetParameterValue(double* pp, double* plist, double gauss_coord); 65 66 void CreateKMatrix(Mat Kgg);67 71 void CreateKMatrixInternal(Mat Kgg); 68 72 void CreateKMatrixBoundary(Mat Kgg); 69 void CreatePVector(Vec pg);70 73 void CreatePVectorInternal(Vec pg); 71 74 void CreatePVectorBoundary(Vec pg); 72 void PenaltyCreateKMatrix(Mat Kgg,double kmax);73 void PenaltyCreatePVector(Vec pg,double kmax);74 75 /*}}}*/ 75 76 -
issm/trunk/src/c/objects/Loads/Pengrid.cpp
r4236 r4248 18 18 #include "../../Container/Container.h" 19 19 20 /* Objectconstructors and destructor*/20 /*Pengrid constructors and destructor*/ 21 21 /*FUNCTION Pengrid::constructor {{{1*/ 22 22 Pengrid::Pengrid(){ … … 67 67 } 68 68 /*}}}*/ 69 /*FUNCTION Icefront::copy {{{1*/70 Object* Pengrid::copy() {71 72 Pengrid* pengrid=NULL;73 74 pengrid=new Pengrid();75 76 /*copy fields: */77 pengrid->id=this->id;78 pengrid->analysis_type=this->analysis_type;79 if(this->inputs){80 pengrid->inputs=(Inputs*)this->inputs->Copy();81 }82 else{83 pengrid->inputs=new Inputs();84 }85 /*point parameters: */86 pengrid->parameters=this->parameters;87 88 /*now deal with hooks and objects: */89 pengrid->hnode.copy(&this->hnode);90 pengrid->helement.copy(&this->helement);91 pengrid->hmatpar.copy(&this->hmatpar);92 93 //let's not forget internals94 pengrid->active=this->active=0;95 pengrid->zigzag_counter=this->zigzag_counter=0;96 97 return pengrid;98 99 }100 /*}}}*/101 69 /*FUNCTION Pengrid::destructor {{{1*/ 102 70 Pengrid::~Pengrid(){ … … 104 72 } 105 73 /*}}}1*/ 106 107 /*Object management*/ 108 /*FUNCTION Pengrid::Configure {{{1*/ 109 void Pengrid::Configure(Elements* elementsin,Loads* loadsin,DataSet* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 110 111 /*Take care of hooking up all objects for this load, ie links the objects in the hooks to their respective 112 * datasets, using internal ids and offsets hidden in hooks: */ 113 hnode.configure(nodesin); 114 helement.configure(elementsin); 115 hmatpar.configure(materialsin); 116 117 /*point parameters to real dataset: */ 118 this->parameters=parametersin; 74 75 /*Object virtual functions definitions:*/ 76 /*FUNCTION Pengrid::Echo {{{1*/ 77 void Pengrid::Echo(void){ 78 this->DeepEcho(); 119 79 } 120 80 /*}}}1*/ … … 136 96 } 137 97 /*}}}*/ 138 /*FUNCTION Pengrid::Demarshall {{{1*/139 void Pengrid::Demarshall(char** pmarshalled_dataset){140 141 char* marshalled_dataset=NULL;142 int i;143 144 /*recover marshalled_dataset: */145 marshalled_dataset=*pmarshalled_dataset;146 147 /*this time, no need to get enum type, the pointer directly points to the beginning of the148 *object data (thanks to DataSet::Demarshall):*/149 150 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);151 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);152 memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active);153 memcpy(&zigzag_counter,marshalled_dataset,sizeof(zigzag_counter));marshalled_dataset+=sizeof(zigzag_counter);154 155 /*demarshall hooks: */156 hnode.Demarshall(&marshalled_dataset);157 helement.Demarshall(&marshalled_dataset);158 hmatpar.Demarshall(&marshalled_dataset);159 160 /*demarshall inputs: */161 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);162 163 /*parameters: may not exist even yet, so let Configure handle it: */164 this->parameters=NULL;165 166 /*return: */167 *pmarshalled_dataset=marshalled_dataset;168 return;169 }170 /*}}}*/171 /*FUNCTION Pengrid::Echo {{{1*/172 void Pengrid::Echo(void){173 this->DeepEcho();174 }175 /*}}}1*/176 /*FUNCTION Pengrid::Enum {{{1*/177 int Pengrid::Enum(void){178 179 return PengridEnum;180 }181 /*}}}1*/182 98 /*FUNCTION Pengrid::Id {{{1*/ 183 99 int Pengrid::Id(void){ return id; } 100 /*}}}1*/ 101 /*FUNCTION Pengrid::MyRank {{{1*/ 102 int Pengrid::MyRank(void){ 103 extern int my_rank; 104 return my_rank; 105 } 184 106 /*}}}1*/ 185 107 /*FUNCTION Pengrid::Marshall {{{1*/ … … 239 161 } 240 162 /*}}}*/ 241 /*FUNCTION Pengrid::MyRank {{{1*/ 242 int Pengrid::MyRank(void){ 243 extern int my_rank; 244 return my_rank; 245 } 246 /*}}}1*/ 247 248 /*Object functions*/ 163 /*FUNCTION Pengrid::Demarshall {{{1*/ 164 void Pengrid::Demarshall(char** pmarshalled_dataset){ 165 166 char* marshalled_dataset=NULL; 167 int i; 168 169 /*recover marshalled_dataset: */ 170 marshalled_dataset=*pmarshalled_dataset; 171 172 /*this time, no need to get enum type, the pointer directly points to the beginning of the 173 *object data (thanks to DataSet::Demarshall):*/ 174 175 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 176 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 177 memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active); 178 memcpy(&zigzag_counter,marshalled_dataset,sizeof(zigzag_counter));marshalled_dataset+=sizeof(zigzag_counter); 179 180 /*demarshall hooks: */ 181 hnode.Demarshall(&marshalled_dataset); 182 helement.Demarshall(&marshalled_dataset); 183 hmatpar.Demarshall(&marshalled_dataset); 184 185 /*demarshall inputs: */ 186 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 187 188 /*parameters: may not exist even yet, so let Configure handle it: */ 189 this->parameters=NULL; 190 191 /*return: */ 192 *pmarshalled_dataset=marshalled_dataset; 193 return; 194 } 195 /*}}}*/ 196 /*FUNCTION Pengrid::Enum {{{1*/ 197 int Pengrid::Enum(void){ 198 199 return PengridEnum; 200 } 201 /*}}}1*/ 202 /*FUNCTION Icefront::copy {{{1*/ 203 Object* Pengrid::copy() { 204 205 Pengrid* pengrid=NULL; 206 207 pengrid=new Pengrid(); 208 209 /*copy fields: */ 210 pengrid->id=this->id; 211 pengrid->analysis_type=this->analysis_type; 212 if(this->inputs){ 213 pengrid->inputs=(Inputs*)this->inputs->Copy(); 214 } 215 else{ 216 pengrid->inputs=new Inputs(); 217 } 218 /*point parameters: */ 219 pengrid->parameters=this->parameters; 220 221 /*now deal with hooks and objects: */ 222 pengrid->hnode.copy(&this->hnode); 223 pengrid->helement.copy(&this->helement); 224 pengrid->hmatpar.copy(&this->hmatpar); 225 226 //let's not forget internals 227 pengrid->active=this->active=0; 228 pengrid->zigzag_counter=this->zigzag_counter=0; 229 230 return pengrid; 231 232 } 233 /*}}}*/ 234 235 /*Load virtual functions definitions:*/ 236 /*FUNCTION Pengrid::Configure {{{1*/ 237 void Pengrid::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 238 239 /*Take care of hooking up all objects for this load, ie links the objects in the hooks to their respective 240 * datasets, using internal ids and offsets hidden in hooks: */ 241 hnode.configure(nodesin); 242 helement.configure(elementsin); 243 hmatpar.configure(materialsin); 244 245 /*point parameters to real dataset: */ 246 this->parameters=parametersin; 247 } 248 /*}}}1*/ 249 249 /*FUNCTION Pengrid::CreateKMatrix {{{1*/ 250 250 void Pengrid::CreateKMatrix(Mat Kgg){ … … 263 263 } 264 264 /*}}}1*/ 265 /*FUNCTION Pengrid::PenaltyCreateMatrix {{{1*/ 266 void Pengrid::PenaltyCreateKMatrix(Mat Kgg,double kmax){ 267 268 int analysis_type; 269 270 /*Retrieve parameters: */ 271 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 272 273 if (analysis_type==DiagnosticStokesAnalysisEnum){ 274 PenaltyCreateKMatrixDiagnosticStokes( Kgg,kmax); 275 } 276 else if (analysis_type==ThermalAnalysisEnum){ 277 PenaltyCreateKMatrixThermal( Kgg,kmax); 278 } 279 else if (analysis_type==MeltingAnalysisEnum){ 280 PenaltyCreateKMatrixMelting( Kgg,kmax); 281 } 282 else{ 283 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type)); 284 } 285 286 } 287 /*}}}1*/ 288 /*FUNCTION Pengrid::PenaltyCreatePVector {{{1*/ 289 void Pengrid::PenaltyCreatePVector(Vec pg,double kmax){ 290 291 int analysis_type; 292 293 /*Retrieve parameters: */ 294 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 295 296 if (analysis_type==ThermalAnalysisEnum){ 297 PenaltyCreatePVectorThermal( pg,kmax); 298 } 299 else if (analysis_type==MeltingAnalysisEnum){ 300 PenaltyCreatePVectorMelting( pg,kmax); 301 } 302 else if (analysis_type==DiagnosticStokesAnalysisEnum){ 303 304 /*No loads applied, do nothing: */ 305 return; 306 307 } 308 else{ 309 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type)); 310 } 311 312 } 313 /*}}}1*/ 314 /*FUNCTION Pengrid::InAnalysis(int analysis_type){{{1*/ 315 bool Pengrid::InAnalysis(int in_analysis_type){ 316 if (in_analysis_type==this->analysis_type)return true; 317 else return false; 318 } 319 /*}}}*/ 320 321 /*Update virtual functions definitions:*/ 322 /*FUNCTION Pengrid::InputUpdateFromVector(double* vector, int name, int type) {{{1*/ 323 void Pengrid::InputUpdateFromVector(double* vector, int name, int type){ 324 /*Nothing updated yet*/ 325 } 326 /*}}}*/ 327 /*FUNCTION Pengrid::InputUpdateFromVector(int* vector, int name, int type) {{{1*/ 328 void Pengrid::InputUpdateFromVector(int* vector, int name, int type){ 329 /*Nothing updated yet*/ 330 } 331 /*}}}*/ 332 /*FUNCTION Pengrid::InputUpdateFromVector(bool* vector, int name, int type) {{{1*/ 333 void Pengrid::InputUpdateFromVector(bool* vector, int name, int type){ 334 /*Nothing updated yet*/ 335 } 336 /*}}}*/ 337 /*FUNCTION Pengrid::InputUpdateFromConstant(double constant, int name) {{{1*/ 338 void Pengrid::InputUpdateFromConstant(double constant, int name){ 339 switch(name){ 340 341 case MeltingOffsetEnum: 342 inputs->AddInput(new DoubleInput(name,constant)); 343 return; 344 345 } 346 } 347 /*}}}*/ 348 /*FUNCTION Pengrid::InputUpdateFromConstant(int constant, int name) {{{1*/ 349 void Pengrid::InputUpdateFromConstant(int constant, int name){ 350 /*Nothing updated yet*/ 351 } 352 /*}}}*/ 353 /*FUNCTION Pengrid::InputUpdateFromConstant(bool constant, int name) {{{1*/ 354 void Pengrid::InputUpdateFromConstant(bool constant, int name){ 355 356 switch(name){ 357 358 case ResetPenaltiesEnum: 359 if (constant) zigzag_counter=0; 360 return; 361 362 } 363 } 364 /*}}}*/ 365 /*FUNCTION Pengrid::InputUpdateFromSolution(double* solution) {{{1*/ 366 void Pengrid::InputUpdateFromSolution(double* solution){ 367 /*Nothing updated yet*/ 368 } 369 /*}}}*/ 370 371 /*Pengrid management:*/ 265 372 /*FUNCTION Pengrid::GetDofList {{{1*/ 266 373 void Pengrid::GetDofList(int* doflist,int* pnumberofdofspernode){ … … 402 509 } 403 510 /*}}}1*/ 404 /*FUNCTION Pengrid::PenaltyCreateMatrix {{{1*/405 void Pengrid::PenaltyCreateKMatrix(Mat Kgg,double kmax){406 407 int analysis_type;408 409 /*Retrieve parameters: */410 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);411 412 if (analysis_type==DiagnosticStokesAnalysisEnum){413 PenaltyCreateKMatrixDiagnosticStokes( Kgg,kmax);414 }415 else if (analysis_type==ThermalAnalysisEnum){416 PenaltyCreateKMatrixThermal( Kgg,kmax);417 }418 else if (analysis_type==MeltingAnalysisEnum){419 PenaltyCreateKMatrixMelting( Kgg,kmax);420 }421 else{422 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));423 }424 425 }426 /*}}}1*/427 511 /*FUNCTION Pengrid::PenaltyCreateKMatrixDiagnosticStokes {{{1*/ 428 512 void Pengrid::PenaltyCreateKMatrixDiagnosticStokes(Mat Kgg,double kmax){ … … 552 636 /*Add Ke to global matrix Kgg: */ 553 637 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES); 554 }555 /*}}}1*/556 /*FUNCTION Pengrid::PenaltyCreatePVector {{{1*/557 void Pengrid::PenaltyCreatePVector(Vec pg,double kmax){558 559 int analysis_type;560 561 /*Retrieve parameters: */562 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);563 564 if (analysis_type==ThermalAnalysisEnum){565 PenaltyCreatePVectorThermal( pg,kmax);566 }567 else if (analysis_type==MeltingAnalysisEnum){568 PenaltyCreatePVectorMelting( pg,kmax);569 }570 else if (analysis_type==DiagnosticStokesAnalysisEnum){571 572 /*No loads applied, do nothing: */573 return;574 575 }576 else{577 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));578 }579 580 638 } 581 639 /*}}}1*/ … … 709 767 } 710 768 /*}}}1*/ 711 712 /*Updates: */713 769 /*FUNCTION Pengrid::UpdateFromDakota {{{1*/ 714 770 void Pengrid::UpdateFromDakota(void* inputs){ … … 721 777 } 722 778 /*}}}1*/ 723 /*FUNCTION Pengrid::InputUpdateFromVector(double* vector, int name, int type) {{{1*/724 void Pengrid::InputUpdateFromVector(double* vector, int name, int type){725 /*Nothing updated yet*/726 }727 /*}}}*/728 /*FUNCTION Pengrid::InputUpdateFromVector(int* vector, int name, int type) {{{1*/729 void Pengrid::InputUpdateFromVector(int* vector, int name, int type){730 /*Nothing updated yet*/731 }732 /*}}}*/733 /*FUNCTION Pengrid::InputUpdateFromVector(bool* vector, int name, int type) {{{1*/734 void Pengrid::InputUpdateFromVector(bool* vector, int name, int type){735 /*Nothing updated yet*/736 }737 /*}}}*/738 /*FUNCTION Pengrid::InputUpdateFromConstant(double constant, int name) {{{1*/739 void Pengrid::InputUpdateFromConstant(double constant, int name){740 switch(name){741 742 case MeltingOffsetEnum:743 inputs->AddInput(new DoubleInput(name,constant));744 return;745 746 }747 }748 /*}}}*/749 /*FUNCTION Pengrid::InputUpdateFromConstant(int constant, int name) {{{1*/750 void Pengrid::InputUpdateFromConstant(int constant, int name){751 /*Nothing updated yet*/752 }753 /*}}}*/754 /*FUNCTION Pengrid::InputUpdateFromConstant(bool constant, int name) {{{1*/755 void Pengrid::InputUpdateFromConstant(bool constant, int name){756 757 switch(name){758 759 case ResetPenaltiesEnum:760 if (constant) zigzag_counter=0;761 return;762 763 }764 }765 /*}}}*/766 /*FUNCTION Pengrid::InputUpdateFromSolution(double* solution) {{{1*/767 void Pengrid::InputUpdateFromSolution(double* solution){768 /*Nothing updated yet*/769 }770 /*}}}*/771 /*FUNCTION Pengrid::InAnalysis(int analysis_type){{{1*/772 bool Pengrid::InAnalysis(int in_analysis_type){773 if (in_analysis_type==this->analysis_type)return true;774 else return false;775 }776 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Pengrid.h
r4244 r4248 34 34 public: 35 35 36 /* FUNCTIONconstructors, destructors {{{1*/36 /*Pengrid constructors, destructors {{{1*/ 37 37 Pengrid(); 38 38 Pengrid(int index, int id, IoModel* iomodel,int analysis_type); 39 39 ~Pengrid(); 40 Object* copy();41 40 /*}}}*/ 42 /*Object virtual functions resolution: {{{1*/43 void Configure(Elements* elementsin,Loads* loadsin,DataSet* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin);41 /*Object virtual functions definitions:{{{1 */ 42 void Echo(); 44 43 void DeepEcho(); 45 void Demarshall(char** pmarshalled_dataset);46 void Echo();47 int Enum();48 44 int Id(); 45 int MyRank(); 49 46 void Marshall(char** pmarshalled_dataset); 50 47 int MarshallSize(); 51 int MyRank(); 48 void Demarshall(char** pmarshalled_dataset); 49 int Enum(); 50 Object* copy(); 52 51 /*}}}*/ 53 52 /*Update virtual functions resolution: {{{1*/ … … 60 59 void InputUpdateFromSolution(double* solution); 61 60 /*}}}*/ 62 /* FUNCTION element numerical routines{{{1*/63 bool InAnalysis(int analysis_type);61 /*Load virtual functions definitions: {{{1*/ 62 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 64 63 void CreateKMatrix(Mat Kgg); 65 64 void CreatePVector(Vec pg); 66 65 void PenaltyCreateKMatrix(Mat Kgg,double kmax); 67 66 void PenaltyCreatePVector(Vec pg,double kmax); 67 bool InAnalysis(int analysis_type); 68 /*}}}*/ 69 /*Pengrid management {{{1*/ 68 70 void PenaltyCreateKMatrixDiagnosticStokes(Mat Kgg,double kmax); 69 71 void GetDofList(int* doflist,int* pnumberofdofspernode); … … 74 76 void PenaltyConstrain(int* punstable); 75 77 void PenaltyConstrainThermal(int* punstable); 76 77 /*updates:*/78 78 void UpdateFromDakota(void* inputs); 79 79 void UpdateInputs(double* solution); -
issm/trunk/src/c/objects/Loads/Penpair.cpp
r4232 r4248 17 17 #include "../../shared/shared.h" 18 18 19 /* Objectconstructors and destructor*/19 /*Penpair constructors and destructor*/ 20 20 /*FUNCTION Penpair::constructor {{{1*/ 21 21 Penpair::Penpair(){ … … 47 47 } 48 48 /*}}}1*/ 49 /*FUNCTION Penpair::copy {{{1*/50 Object* Penpair::copy() {51 52 Penpair* penpair=NULL;53 54 penpair=new Penpair();55 56 /*copy fields: */57 penpair->id=this->id;58 penpair->analysis_type=this->analysis_type;59 60 /*now deal with hooks and objects: */61 penpair->hnodes.copy(&this->hnodes);62 63 return penpair;64 65 }66 /*}}}*/67 49 /*FUNCTION Penpair::destructor {{{1*/ 68 50 Penpair::~Penpair(){ … … 70 52 } 71 53 /*}}}1*/ 72 73 /*Object marshall*/ 74 /*FUNCTION Penpair::Configure {{{1*/ 75 void Penpair::Configure(Elements* elementsin,Loads* loadsin,DataSet* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 76 77 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 78 * datasets, using internal ids and offsets hidden in hooks: */ 79 hnodes.configure(nodesin); 80 54 55 /*Object virtual functions definitions:*/ 56 /*FUNCTION Penpair::Echo {{{1*/ 57 void Penpair::Echo(void){ 58 59 int i; 60 61 printf("Penpair:\n"); 62 printf(" id: %i\n",id); 63 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 64 hnodes.Echo(); 65 66 return; 81 67 } 82 68 /*}}}1*/ … … 92 78 } 93 79 /*}}}1*/ 80 /*FUNCTION Penpair::Id {{{1*/ 81 int Penpair::Id(void){ return id; } 82 /*}}}1*/ 83 /*FUNCTION Penpair::MyRank {{{1*/ 84 int Penpair::MyRank(void){ 85 extern int my_rank; 86 return my_rank; 87 } 88 /*}}}1*/ 89 /*FUNCTION Penpair::Marshall {{{1*/ 90 void Penpair::Marshall(char** pmarshalled_dataset){ 91 92 char* marshalled_dataset=NULL; 93 int enum_type=0; 94 95 /*recover marshalled_dataset: */ 96 marshalled_dataset=*pmarshalled_dataset; 97 98 /*get enum type of Penpair: */ 99 enum_type=PenpairEnum; 100 101 /*marshall enum: */ 102 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 103 104 /*marshall Penpair data: */ 105 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 106 memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 107 108 /*Marshall hooks*/ 109 hnodes.Marshall(&marshalled_dataset); 110 111 *pmarshalled_dataset=marshalled_dataset; 112 return; 113 } 114 /*}}}1*/ 115 /*FUNCTION Penpair::MarshallSize {{{1*/ 116 int Penpair::MarshallSize(){ 117 118 return sizeof(id)+ 119 +sizeof(analysis_type) 120 +hnodes.MarshallSize() 121 +sizeof(int); //sizeof(int) for enum type 122 } 123 /*}}}1*/ 94 124 /*FUNCTION Penpair::Demarshall {{{1*/ 95 125 void Penpair::Demarshall(char** pmarshalled_dataset){ … … 114 144 } 115 145 /*}}}1*/ 116 /*FUNCTION Penpair::Echo {{{1*/117 void Penpair::Echo(void){118 119 int i;120 121 printf("Penpair:\n");122 printf(" id: %i\n",id);123 printf(" analysis_type: %s\n",EnumAsString(analysis_type));124 hnodes.Echo();125 126 return;127 }128 /*}}}1*/129 146 /*FUNCTION Penpair::Enum {{{1*/ 130 147 int Penpair::Enum(void){ … … 133 150 } 134 151 /*}}}1*/ 135 /*FUNCTION Penpair::Id {{{1*/ 136 int Penpair::Id(void){ return id; } 137 /*}}}1*/ 138 /*FUNCTION Penpair::Marshall {{{1*/ 139 void Penpair::Marshall(char** pmarshalled_dataset){ 140 141 char* marshalled_dataset=NULL; 142 int enum_type=0; 143 144 /*recover marshalled_dataset: */ 145 marshalled_dataset=*pmarshalled_dataset; 146 147 /*get enum type of Penpair: */ 148 enum_type=PenpairEnum; 149 150 /*marshall enum: */ 151 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 152 153 /*marshall Penpair data: */ 154 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 155 memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 156 157 /*Marshall hooks*/ 158 hnodes.Marshall(&marshalled_dataset); 159 160 *pmarshalled_dataset=marshalled_dataset; 161 return; 162 } 163 /*}}}1*/ 164 /*FUNCTION Penpair::MarshallSize {{{1*/ 165 int Penpair::MarshallSize(){ 166 167 return sizeof(id)+ 168 +sizeof(analysis_type) 169 +hnodes.MarshallSize() 170 +sizeof(int); //sizeof(int) for enum type 171 } 172 /*}}}1*/ 173 /*FUNCTION Penpair::MyRank {{{1*/ 174 int Penpair::MyRank(void){ 175 extern int my_rank; 176 return my_rank; 177 } 178 /*}}}1*/ 179 180 /*Object functions*/ 152 /*FUNCTION Penpair::copy {{{1*/ 153 Object* Penpair::copy() { 154 155 Penpair* penpair=NULL; 156 157 penpair=new Penpair(); 158 159 /*copy fields: */ 160 penpair->id=this->id; 161 penpair->analysis_type=this->analysis_type; 162 163 /*now deal with hooks and objects: */ 164 penpair->hnodes.copy(&this->hnodes); 165 166 return penpair; 167 168 } 169 /*}}}*/ 170 171 /*Load virtual functions definitions:*/ 172 /*FUNCTION Penpair::Configure {{{1*/ 173 void Penpair::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 174 175 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 176 * datasets, using internal ids and offsets hidden in hooks: */ 177 hnodes.configure(nodesin); 178 179 } 180 /*}}}1*/ 181 181 /*FUNCTION Penpair::CreateKMatrix {{{1*/ 182 182 void Penpair::CreateKMatrix(Mat Kgg){ -
issm/trunk/src/c/objects/Loads/Penpair.h
r4244 r4248 24 24 public: 25 25 26 /* constructors: {{{1*/26 /*Penpair constructors, destructors: {{{1*/ 27 27 Penpair(); 28 28 Penpair(int penpair_id,int* penpair_node_ids,int analysis_type); 29 29 Penpair(int penpair_id,Hook* penpair_hnodes,int analysis_type); 30 30 ~Penpair(); 31 Object* copy();32 31 /*}}}*/ 33 /*Object virtual functions resolution: {{{1*/34 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);32 /*Object virtual functions definitions:{{{1 */ 33 void Echo(); 35 34 void DeepEcho(); 36 void Demarshall(char** pmarshalled_dataset);37 void Echo();38 int Enum();39 35 int Id(); 36 int MyRank(); 40 37 void Marshall(char** pmarshalled_dataset); 41 38 int MarshallSize(); 42 int MyRank(); 39 void Demarshall(char** pmarshalled_dataset); 40 int Enum(); 41 Object* copy(); 43 42 /*}}}*/ 44 43 /*Update virtual functions resolution: {{{1*/ … … 51 50 void InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");} 52 51 /*}}}*/ 53 /*numerics: {{{1*/54 bool InAnalysis(int analysis_type);52 /*Load virtual functions definitions: {{{1*/ 53 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 55 54 void CreateKMatrix(Mat Kgg); 56 55 void CreatePVector(Vec pg); 57 56 void PenaltyCreateKMatrix(Mat Kgg,double kmax); 58 57 void PenaltyCreatePVector(Vec pg,double kmax); 58 bool InAnalysis(int analysis_type); 59 59 /*}}}*/ 60 60 }; -
issm/trunk/src/c/objects/Loads/Riftfront.cpp
r4232 r4248 20 20 /*}}}*/ 21 21 22 /* Object constructors and destructor*/22 /*Riftfront constructors and destructor*/ 23 23 /*FUNCTION Riftfront::Riftfront(){{{1*/ 24 24 Riftfront::Riftfront(){ … … 94 94 } 95 95 /*}}}1*/ 96 /*FUNCTION Riftfront::copy {{{1*/97 Object* Riftfront::copy() {98 99 Riftfront* riftfront=NULL;100 101 riftfront=new Riftfront();102 103 /*copy fields: */104 riftfront->id=this->id;105 riftfront->analysis_type=this->analysis_type;106 if(this->inputs){107 riftfront->inputs=(Inputs*)this->inputs->Copy();108 }109 else{110 riftfront->inputs=new Inputs();111 }112 /*point parameters: */113 riftfront->parameters=this->parameters;114 115 /*now deal with hooks and objects: */116 riftfront->hnodes.copy(&this->hnodes);117 riftfront->helements.copy(&this->helements);118 riftfront->hmatpar.copy(&this->hmatpar);119 120 return riftfront;121 122 }123 /*}}}*/124 96 /*FUNCTION Riftfront::~Riftfront(){{{1*/ 125 97 Riftfront::~Riftfront(){ … … 129 101 /*}}}*/ 130 102 131 /*Object marshall*/ 132 /*FUNCTION Riftfront::Configure {{{1*/ 133 void Riftfront::Configure(Elements* elementsin,Loads* loadsin,DataSet* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 134 135 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 136 * datasets, using internal ids and offsets hidden in hooks: */ 137 hnodes.configure(nodesin); 138 hmatpar.configure(materialsin); 139 140 /*point parameters to real dataset: */ 141 this->parameters=parametersin; 142 143 } 144 /*}}}*/ 103 /*Object virtual functions definitions:*/ 104 /*FUNCTION Riftfront::Echo {{{1*/ 105 void Riftfront::Echo(void){ 106 this->DeepEcho(); 107 } 108 /*}}}1*/ 145 109 /*FUNCTION Riftfront::DeepEcho{{{1*/ 146 110 void Riftfront::DeepEcho(void){ … … 157 121 } 158 122 /*}}}*/ 159 /*FUNCTION Riftfront::Demarshall {{{1*/160 void Riftfront::Demarshall(char** pmarshalled_dataset){161 162 char* marshalled_dataset=NULL;163 int i;164 165 /*recover marshalled_dataset: */166 marshalled_dataset=*pmarshalled_dataset;167 168 /*this time, no need to get enum type, the pointer directly points to the beginning of the169 *object data (thanks to DataSet::Demarshall):*/170 171 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);172 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);173 174 memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active);175 memcpy(&normal,marshalled_dataset,sizeof(normal));marshalled_dataset+=sizeof(normal);176 memcpy(&length,marshalled_dataset,sizeof(length));marshalled_dataset+=sizeof(length);177 memcpy(&fraction,marshalled_dataset,sizeof(fraction));marshalled_dataset+=sizeof(fraction);178 memcpy(&frozen,marshalled_dataset,sizeof(frozen));marshalled_dataset+=sizeof(frozen);179 memcpy(&counter,marshalled_dataset,sizeof(counter));marshalled_dataset+=sizeof(counter);180 memcpy(&prestable,marshalled_dataset,sizeof(prestable));marshalled_dataset+=sizeof(prestable);181 memcpy(&penalty_lock,marshalled_dataset,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock);182 memcpy(&material_converged,marshalled_dataset,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged);183 184 /*demarshall hooks: */185 hnodes.Demarshall(&marshalled_dataset);186 hmatpar.Demarshall(&marshalled_dataset);187 188 /*demarshall inputs: */189 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);190 191 /*parameters: may not exist even yet, so let Configure handle it: */192 this->parameters=NULL;193 194 /*return: */195 *pmarshalled_dataset=marshalled_dataset;196 }197 /*}}}*/198 /*FUNCTION Riftfront::Echo {{{1*/199 void Riftfront::Echo(void){200 this->DeepEcho();201 }202 /*}}}1*/203 /*FUNCTION Riftfront::Enum {{{1*/204 int Riftfront::Enum(void){205 206 return RiftfrontEnum;207 208 }209 /*}}}1*/210 123 /*FUNCTION Riftfront::Id {{{1*/ 211 124 int Riftfront::Id(void){ return id; } 125 /*}}}1*/ 126 /*FUNCTION Riftfront::MyRank {{{1*/ 127 int Riftfront::MyRank(void){ 128 extern int my_rank; 129 return my_rank; 130 } 212 131 /*}}}1*/ 213 132 /*FUNCTION Riftfront::Marshall {{{1*/ … … 279 198 } 280 199 /*}}}*/ 281 /*FUNCTION Riftfront::MyRank {{{1*/ 282 int Riftfront::MyRank(void){ 283 extern int my_rank; 284 return my_rank; 285 } 286 /*}}}1*/ 287 288 /*Object functions*/ 289 /*FUNCTION Riftfront::Constrain {{{1*/ 290 #define _ZIGZAGCOUNTER_ 291 292 int Riftfront::Constrain(int* punstable){ 293 294 const int numgrids = 2; 295 double max_penetration; 296 double penetration; 297 int activate; 298 int found; 299 int unstable; 300 double vx1; 301 double vy1; 302 double vx2; 303 double vy2; 304 double fractionincrement; 305 306 307 /*Objects: */ 308 Element **elements = NULL; 309 Node **nodes = NULL; 310 Tria *tria1 = NULL; 311 Tria *tria2 = NULL; 312 313 /*Recover hook objects: */ 314 elements=(Element**)helements.deliverp(); 315 nodes=(Node**)hnodes.deliverp(); 316 317 /*enum of element? */ 318 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 319 320 /*recover elements on both side of rift: */ 321 tria1=(Tria*)elements[0]; 322 tria2=(Tria*)elements[1]; 323 324 /*Is this constraint frozen? In which case we don't touch: */ 325 if (this->frozen){ 326 *punstable=0; 327 return 1; 328 } 329 330 /*recover parameters: */ 331 this->inputs->GetParameterValue(&fractionincrement,FractionIncrementEnum); 332 333 /*First recover velocity: */ 334 tria1->inputs->GetParameterValue(&vx1,nodes[0],VxEnum); 335 tria2->inputs->GetParameterValue(&vx2,nodes[1],VxEnum); 336 tria1->inputs->GetParameterValue(&vy1,nodes[0],VyEnum); 337 tria2->inputs->GetParameterValue(&vy2,nodes[1],VyEnum); 338 339 /*Node 1 faces node 2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 340 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 341 342 /*activation: */ 343 if(penetration<0)activate=1; 344 else activate=0; 345 346 /*Here, we try to avoid zigzaging. When a penalty activates and deactivates for more than penalty_lock times, 347 * we increase the fraction of melange:*/ 348 if(this->counter>this->penalty_lock){ 349 /*reset counter: */ 350 this->counter=0; 351 /*increase melange fraction: */ 352 this->fraction+=fractionincrement; 353 if (this->fraction>1)this->fraction=(double)1.0; 354 //printf("riftfront %i fraction: %g\n",this->Id(),this->fraction); 355 } 356 357 //Figure out stability of this penalty 358 if(this->active==activate){ 359 unstable=0; 200 /*FUNCTION Riftfront::Demarshall {{{1*/ 201 void Riftfront::Demarshall(char** pmarshalled_dataset){ 202 203 char* marshalled_dataset=NULL; 204 int i; 205 206 /*recover marshalled_dataset: */ 207 marshalled_dataset=*pmarshalled_dataset; 208 209 /*this time, no need to get enum type, the pointer directly points to the beginning of the 210 *object data (thanks to DataSet::Demarshall):*/ 211 212 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 213 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 214 215 memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active); 216 memcpy(&normal,marshalled_dataset,sizeof(normal));marshalled_dataset+=sizeof(normal); 217 memcpy(&length,marshalled_dataset,sizeof(length));marshalled_dataset+=sizeof(length); 218 memcpy(&fraction,marshalled_dataset,sizeof(fraction));marshalled_dataset+=sizeof(fraction); 219 memcpy(&frozen,marshalled_dataset,sizeof(frozen));marshalled_dataset+=sizeof(frozen); 220 memcpy(&counter,marshalled_dataset,sizeof(counter));marshalled_dataset+=sizeof(counter); 221 memcpy(&prestable,marshalled_dataset,sizeof(prestable));marshalled_dataset+=sizeof(prestable); 222 memcpy(&penalty_lock,marshalled_dataset,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); 223 memcpy(&material_converged,marshalled_dataset,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged); 224 225 /*demarshall hooks: */ 226 hnodes.Demarshall(&marshalled_dataset); 227 hmatpar.Demarshall(&marshalled_dataset); 228 229 /*demarshall inputs: */ 230 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 231 232 /*parameters: may not exist even yet, so let Configure handle it: */ 233 this->parameters=NULL; 234 235 /*return: */ 236 *pmarshalled_dataset=marshalled_dataset; 237 } 238 /*}}}*/ 239 /*FUNCTION Riftfront::Enum {{{1*/ 240 int Riftfront::Enum(void){ 241 242 return RiftfrontEnum; 243 244 } 245 /*}}}1*/ 246 /*FUNCTION Riftfront::copy {{{1*/ 247 Object* Riftfront::copy() { 248 249 Riftfront* riftfront=NULL; 250 251 riftfront=new Riftfront(); 252 253 /*copy fields: */ 254 riftfront->id=this->id; 255 riftfront->analysis_type=this->analysis_type; 256 if(this->inputs){ 257 riftfront->inputs=(Inputs*)this->inputs->Copy(); 360 258 } 361 259 else{ 362 unstable=1; 363 this->counter++; 364 } 365 366 //Set penalty flag 367 this->active=activate; 368 369 //if ((penetration>0) & (this->active==1))printf("Riftfront %i wants to be released\n",Id()); 370 371 /*assign output pointer: */ 372 *punstable=unstable; 373 } 374 /*}}}1*/ 260 riftfront->inputs=new Inputs(); 261 } 262 /*point parameters: */ 263 riftfront->parameters=this->parameters; 264 265 /*now deal with hooks and objects: */ 266 riftfront->hnodes.copy(&this->hnodes); 267 riftfront->helements.copy(&this->helements); 268 riftfront->hmatpar.copy(&this->hmatpar); 269 270 return riftfront; 271 272 } 273 /*}}}*/ 274 275 /*Load virtual functions definitions:*/ 276 /*FUNCTION Riftfront::Configure {{{1*/ 277 void Riftfront::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 278 279 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 280 * datasets, using internal ids and offsets hidden in hooks: */ 281 hnodes.configure(nodesin); 282 hmatpar.configure(materialsin); 283 284 /*point parameters to real dataset: */ 285 this->parameters=parametersin; 286 287 } 288 /*}}}*/ 375 289 /*FUNCTION Riftfront::CreateKMatrix {{{1*/ 376 290 void Riftfront::CreateKMatrix(Mat Kgg){ … … 381 295 void Riftfront::CreatePVector(Vec pg){ 382 296 /*do nothing: */ 383 }384 /*}}}1*/385 /*FUNCTION Riftfront::FreezeConstraints{{{1*/386 void Riftfront::FreezeConstraints(void){387 388 /*Just set frozen flag to 1: */389 this->frozen=1;390 391 }392 /*}}}1*/393 /*FUNCTION Riftfront::GetDofList {{{1*/394 395 void Riftfront::GetDofList(int* doflist,int* pnumberofdofspernode){396 397 int i,j;398 int doflist_per_node[MAXDOFSPERNODE];399 int numberofdofspernode;400 Node **nodes = NULL;401 402 nodes=(Node**)hnodes.deliverp();403 404 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){405 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode);406 for(j=0;j<numberofdofspernode;j++){407 doflist[i*numberofdofspernode+j]=doflist_per_node[j];408 }409 }410 411 /*Assign output pointers:*/412 *pnumberofdofspernode=numberofdofspernode;413 }414 /*}}}1*/415 /*FUNCTION Riftfront::IsFrozen{{{1*/416 bool Riftfront::IsFrozen(void){417 418 /*Just set frozen flag to 1: */419 if(this->frozen)return 1;420 else return 0;421 }422 /*}}}1*/423 /*FUNCTION Riftfront::IsMaterialStable {{{1*/424 int Riftfront::IsMaterialStable(void){425 426 int found=0;427 double converged=0;428 429 this->inputs->GetParameterValue(&converged,ConvergedEnum);430 431 if(converged){432 /*ok, material non-linearity has converged. If that was already the case, we keep433 * constraining the rift front. If it was not, and this is the first time the material434 * has converged, we start constraining now!: */435 this->material_converged=1;436 }437 438 return this->material_converged;439 }440 /*}}}1*/441 /*FUNCTION Riftfront::MaxPenetration {{{1*/442 int Riftfront::MaxPenetration(double* ppenetration){443 444 const int numgrids=2;445 double max_penetration;446 double penetration=0;447 int found;448 double vx1;449 double vy1;450 double vx2;451 double vy2;452 453 /*Objects: */454 Element **elements = NULL;455 Node **nodes = NULL;456 Tria *tria1 = NULL;457 Tria *tria2 = NULL;458 459 /*Recover hook objects: */460 elements=(Element**)helements.deliverp();461 nodes=(Node**)hnodes.deliverp();462 463 /*enum of element? */464 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!");465 466 /*recover elements on both side of rift: */467 tria1=(Tria*)elements[0];468 tria2=(Tria*)elements[1];469 470 //initialize:471 penetration=-1;472 473 /*recover velocity: */474 tria1->inputs->GetParameterValue(&vx1,nodes[0],VxEnum);475 tria2->inputs->GetParameterValue(&vx2,nodes[1],VxEnum);476 tria1->inputs->GetParameterValue(&vy1,nodes[0],VyEnum);477 tria2->inputs->GetParameterValue(&vy2,nodes[1],VyEnum);478 479 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */480 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1];481 482 /*Now, we return penetration only if we are active!: */483 if(this->active==0)penetration=-1;484 485 /*If we are zigzag locked, same thing: */486 if(this->counter>this->penalty_lock)penetration=-1;487 488 /*assign output pointer: */489 *ppenetration=penetration;490 491 }492 /*}}}1*/493 /*FUNCTION Riftfront::OutputProperties {{{1*/494 void Riftfront::OutputProperties(Vec riftproperties){495 496 int row_id=0;497 double value;498 499 /*recover id of penalty: */500 row_id=this->Id()-1; //c indexing, ids were matlab indexed501 value=(double)this->fraction;502 503 /*Plug id and fraction into riftproperties matrix: */504 VecSetValues(riftproperties,1,&row_id,&value,INSERT_VALUES);505 297 } 506 298 /*}}}1*/ … … 744 536 } 745 537 /*}}}1*/ 538 /*FUNCTION Riftfront::InAnalysis(int analysis_type){{{1*/ 539 bool Riftfront::InAnalysis(int in_analysis_type){ 540 if (in_analysis_type==this->analysis_type) return true; 541 else return false; 542 } 543 /*}}}*/ 544 545 /*Riftfront numerics*/ 546 /*FUNCTION Riftfront::Constrain {{{1*/ 547 #define _ZIGZAGCOUNTER_ 548 549 int Riftfront::Constrain(int* punstable){ 550 551 const int numgrids = 2; 552 double max_penetration; 553 double penetration; 554 int activate; 555 int found; 556 int unstable; 557 double vx1; 558 double vy1; 559 double vx2; 560 double vy2; 561 double fractionincrement; 562 563 564 /*Objects: */ 565 Element **elements = NULL; 566 Node **nodes = NULL; 567 Tria *tria1 = NULL; 568 Tria *tria2 = NULL; 569 570 /*Recover hook objects: */ 571 elements=(Element**)helements.deliverp(); 572 nodes=(Node**)hnodes.deliverp(); 573 574 /*enum of element? */ 575 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 576 577 /*recover elements on both side of rift: */ 578 tria1=(Tria*)elements[0]; 579 tria2=(Tria*)elements[1]; 580 581 /*Is this constraint frozen? In which case we don't touch: */ 582 if (this->frozen){ 583 *punstable=0; 584 return 1; 585 } 586 587 /*recover parameters: */ 588 this->inputs->GetParameterValue(&fractionincrement,FractionIncrementEnum); 589 590 /*First recover velocity: */ 591 tria1->inputs->GetParameterValue(&vx1,nodes[0],VxEnum); 592 tria2->inputs->GetParameterValue(&vx2,nodes[1],VxEnum); 593 tria1->inputs->GetParameterValue(&vy1,nodes[0],VyEnum); 594 tria2->inputs->GetParameterValue(&vy2,nodes[1],VyEnum); 595 596 /*Node 1 faces node 2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 597 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 598 599 /*activation: */ 600 if(penetration<0)activate=1; 601 else activate=0; 602 603 /*Here, we try to avoid zigzaging. When a penalty activates and deactivates for more than penalty_lock times, 604 * we increase the fraction of melange:*/ 605 if(this->counter>this->penalty_lock){ 606 /*reset counter: */ 607 this->counter=0; 608 /*increase melange fraction: */ 609 this->fraction+=fractionincrement; 610 if (this->fraction>1)this->fraction=(double)1.0; 611 //printf("riftfront %i fraction: %g\n",this->Id(),this->fraction); 612 } 613 614 //Figure out stability of this penalty 615 if(this->active==activate){ 616 unstable=0; 617 } 618 else{ 619 unstable=1; 620 this->counter++; 621 } 622 623 //Set penalty flag 624 this->active=activate; 625 626 //if ((penetration>0) & (this->active==1))printf("Riftfront %i wants to be released\n",Id()); 627 628 /*assign output pointer: */ 629 *punstable=unstable; 630 } 631 /*}}}1*/ 632 /*FUNCTION Riftfront::FreezeConstraints{{{1*/ 633 void Riftfront::FreezeConstraints(void){ 634 635 /*Just set frozen flag to 1: */ 636 this->frozen=1; 637 638 } 639 /*}}}1*/ 640 /*FUNCTION Riftfront::GetDofList {{{1*/ 641 642 void Riftfront::GetDofList(int* doflist,int* pnumberofdofspernode){ 643 644 int i,j; 645 int doflist_per_node[MAXDOFSPERNODE]; 646 int numberofdofspernode; 647 Node **nodes = NULL; 648 649 nodes=(Node**)hnodes.deliverp(); 650 651 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){ 652 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 653 for(j=0;j<numberofdofspernode;j++){ 654 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 655 } 656 } 657 658 /*Assign output pointers:*/ 659 *pnumberofdofspernode=numberofdofspernode; 660 } 661 /*}}}1*/ 662 /*FUNCTION Riftfront::IsFrozen{{{1*/ 663 bool Riftfront::IsFrozen(void){ 664 665 /*Just set frozen flag to 1: */ 666 if(this->frozen)return 1; 667 else return 0; 668 } 669 /*}}}1*/ 670 /*FUNCTION Riftfront::IsMaterialStable {{{1*/ 671 int Riftfront::IsMaterialStable(void){ 672 673 int found=0; 674 double converged=0; 675 676 this->inputs->GetParameterValue(&converged,ConvergedEnum); 677 678 if(converged){ 679 /*ok, material non-linearity has converged. If that was already the case, we keep 680 * constraining the rift front. If it was not, and this is the first time the material 681 * has converged, we start constraining now!: */ 682 this->material_converged=1; 683 } 684 685 return this->material_converged; 686 } 687 /*}}}1*/ 688 /*FUNCTION Riftfront::MaxPenetration {{{1*/ 689 int Riftfront::MaxPenetration(double* ppenetration){ 690 691 const int numgrids=2; 692 double max_penetration; 693 double penetration=0; 694 int found; 695 double vx1; 696 double vy1; 697 double vx2; 698 double vy2; 699 700 /*Objects: */ 701 Element **elements = NULL; 702 Node **nodes = NULL; 703 Tria *tria1 = NULL; 704 Tria *tria2 = NULL; 705 706 /*Recover hook objects: */ 707 elements=(Element**)helements.deliverp(); 708 nodes=(Node**)hnodes.deliverp(); 709 710 /*enum of element? */ 711 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 712 713 /*recover elements on both side of rift: */ 714 tria1=(Tria*)elements[0]; 715 tria2=(Tria*)elements[1]; 716 717 //initialize: 718 penetration=-1; 719 720 /*recover velocity: */ 721 tria1->inputs->GetParameterValue(&vx1,nodes[0],VxEnum); 722 tria2->inputs->GetParameterValue(&vx2,nodes[1],VxEnum); 723 tria1->inputs->GetParameterValue(&vy1,nodes[0],VyEnum); 724 tria2->inputs->GetParameterValue(&vy2,nodes[1],VyEnum); 725 726 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 727 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 728 729 /*Now, we return penetration only if we are active!: */ 730 if(this->active==0)penetration=-1; 731 732 /*If we are zigzag locked, same thing: */ 733 if(this->counter>this->penalty_lock)penetration=-1; 734 735 /*assign output pointer: */ 736 *ppenetration=penetration; 737 738 } 739 /*}}}1*/ 740 /*FUNCTION Riftfront::OutputProperties {{{1*/ 741 void Riftfront::OutputProperties(Vec riftproperties){ 742 743 int row_id=0; 744 double value; 745 746 /*recover id of penalty: */ 747 row_id=this->Id()-1; //c indexing, ids were matlab indexed 748 value=(double)this->fraction; 749 750 /*Plug id and fraction into riftproperties matrix: */ 751 VecSetValues(riftproperties,1,&row_id,&value,INSERT_VALUES); 752 } 753 /*}}}1*/ 746 754 /*FUNCTION Riftfront::Penetration {{{1*/ 747 755 int Riftfront::Penetration(double* ppenetration){ … … 929 937 } 930 938 /*}}}1*/ 931 /*FUNCTION Riftfront::InAnalysis(int analysis_type){{{1*/932 bool Riftfront::InAnalysis(int in_analysis_type){933 if (in_analysis_type==this->analysis_type) return true;934 else return false;935 }936 /*}}}*/937 -
issm/trunk/src/c/objects/Loads/Riftfront.h
r4244 r4248 43 43 44 44 45 /* constructors,destructors: {{{1*/45 /*Riftfrontconstructors,destructors: {{{1*/ 46 46 Riftfront(); 47 47 Riftfront(int riftfront_id,int i, IoModel* iomodel,int analysis_type); 48 48 ~Riftfront(); 49 49 /*}}}*/ 50 /*Object virtual functions resolution: {{{1*/ 51 void Configure(Elements* elements,Loads* loads,DataSet* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 52 Object* copy(); 50 /*Object virtual functions definitions:{{{1 */ 51 void Echo(); 53 52 void DeepEcho(); 54 void Demarshall(char** pmarshalled_dataset);55 void Echo();56 int Enum();57 53 int Id(); 54 int MyRank(); 58 55 void Marshall(char** pmarshalled_dataset); 59 56 int MarshallSize(); 60 int MyRank(); 57 void Demarshall(char** pmarshalled_dataset); 58 int Enum(); 59 Object* copy(); 61 60 /*}}}*/ 62 61 /*Update virtual functions resolution: {{{1*/ … … 69 68 void InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");} 70 69 /*}}}*/ 71 /*numerics: {{{1*/ 72 bool InAnalysis(int analysis_type); 73 void GetDofList(int* doflist,int* pnumberofdofs); 70 /*Load virtual functions definitions: {{{1*/ 71 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 74 72 void CreateKMatrix(Mat Kgg); 75 73 void CreatePVector(Vec pg); 76 74 void PenaltyCreateKMatrix(Mat Kgg,double kmax); 77 75 void PenaltyCreatePVector(Vec pg,double kmax); 76 bool InAnalysis(int analysis_type); 77 /*}}}*/ 78 /*Riftfront management: {{{1*/ 79 void GetDofList(int* doflist,int* pnumberofdofs); 78 80 bool PreStable(); 79 81 void SetPreStable(); -
issm/trunk/src/c/objects/Materials/Material.h
r4244 r4248 18 18 public: 19 19 virtual ~Material(){}; 20 virtual void Echo()=0;21 virtual void DeepEcho()=0;22 virtual int Id()=0;23 virtual int MyRank()=0;24 virtual void Marshall(char** pmarshalled_dataset)=0;25 virtual int MarshallSize()=0;26 virtual void Demarshall(char** pmarshalled_dataset)=0;27 20 }; 28 21 #endif -
issm/trunk/src/c/objects/Materials/Matice.cpp
r4244 r4248 16 16 #include "../../include/include.h" 17 17 18 /* Objectconstructors and destructor*/18 /*Matice constructors and destructor*/ 19 19 /*FUNCTION Matice::Matice(){{{1*/ 20 20 Matice::Matice(){ … … 79 79 /*}}}*/ 80 80 81 /*Object marshall*/ 81 /*Object virtual functions definitions:*/ 82 /*FUNCTION Matice::Echo {{{1*/ 83 void Matice::Echo(void){ 84 85 printf("Matice:\n"); 86 printf(" mid: %i\n",mid); 87 printf(" B: %g\n",B); 88 printf(" n: %g\n",n); 89 return; 90 } 91 /*}}}*/ 92 /*FUNCTION Matice::DeepEcho {{{1*/ 93 void Matice::DeepEcho(void){ 94 95 printf("Matice:\n"); 96 printf(" mid: %i\n",mid); 97 printf(" B: %g\n",B); 98 printf(" n: %g\n",n); 99 return; 100 } 101 /*}}}*/ 102 /*FUNCTION Matice::Id {{{1*/ 103 int Matice::Id(void){ return mid; } 104 /*}}}*/ 105 /*FUNCTION Matice::MyRank {{{1*/ 106 int Matice::MyRank(void){ 107 extern int my_rank; 108 return my_rank; 109 } 110 /*}}}*/ 82 111 /*FUNCTION Matice::Marshall {{{1*/ 83 112 void Matice::Marshall(char** pmarshalled_dataset){ … … 130 159 } 131 160 /*}}}*/ 132 133 /*Object functions*/ 161 /*FUNCTION Matice::Enum {{{1*/ 162 int Matice::Enum(void){ 163 164 return MaticeEnum; 165 166 } 167 /*}}}*/ 134 168 /*FUNCTION Matice::copy {{{1*/ 135 169 Object* Matice::copy() { … … 137 171 } 138 172 /*}}}*/ 139 /*FUNCTION Matice::DeepEcho {{{1*/ 140 void Matice::DeepEcho(void){ 141 142 printf("Matice:\n"); 143 printf(" mid: %i\n",mid); 144 printf(" B: %g\n",B); 145 printf(" n: %g\n",n); 146 return; 147 } 148 /*}}}*/ 149 /*FUNCTION Matice::Echo {{{1*/ 150 void Matice::Echo(void){ 151 152 printf("Matice:\n"); 153 printf(" mid: %i\n",mid); 154 printf(" B: %g\n",B); 155 printf(" n: %g\n",n); 156 return; 157 } 158 /*}}}*/ 159 /*FUNCTION Matice::Enum {{{1*/ 160 int Matice::Enum(void){ 161 162 return MaticeEnum; 163 164 } 165 /*}}}*/ 173 174 /*Matice management*/ 166 175 /*FUNCTION Matice::GetB {{{1*/ 167 176 double Matice::GetB(){ 168 177 return B; 169 178 } 170 /*}}}*/171 /*FUNCTION Matice::Id {{{1*/172 int Matice::Id(void){ return mid; }173 179 /*}}}*/ 174 180 /*FUNCTION Matice::GetN {{{1*/ … … 430 436 } 431 437 /*}}}*/ 432 /*FUNCTION Matice::MyRank {{{1*/433 int Matice::MyRank(void){434 extern int my_rank;435 return my_rank;436 }437 /*}}}*/438 438 /*FUNCTION Matice::SetB {{{1*/ 439 439 void Matice::SetB(double B_param){ -
issm/trunk/src/c/objects/Materials/Matice.h
r4244 r4248 21 21 public: 22 22 23 /*Matice constructors, destructors: {{{1*/ 23 24 Matice(); 24 25 Matice(int mid,double B,double n); … … 26 27 void Init(int mid,double B,double n); 27 28 ~Matice(); 28 29 /*Object virtual functions resolution: {{{1*/29 /*}}}*/ 30 /*Object virtual functions definitions:{{{1 */ 30 31 void Echo(); 31 Object* copy();32 32 void DeepEcho(); 33 int Id(); 34 int MyRank(); 33 35 void Marshall(char** pmarshalled_dataset); 34 36 int MarshallSize(); 35 37 void Demarshall(char** pmarshalled_dataset); 36 38 int Enum(); 37 int Id(); 38 int MyRank(); 39 Object* copy(); 39 40 /*}}}*/ 40 /*Update virtual functions resolution: {{{1*/41 /*Update virtual functions definitions: {{{1*/ 41 42 void InputUpdateFromVector(double* vector, int name, int type); 42 43 void InputUpdateFromVector(int* vector, int name, int type); … … 47 48 void InputUpdateFromSolution(double* solution); 48 49 /*}}}*/ 49 /* Numerics: {{{1*/50 /*Matice Numerics: {{{1*/ 50 51 void SetB(double B_param); 51 52 void GetViscosity2d(double* pviscosity, double* pepsilon); -
issm/trunk/src/c/objects/Materials/Matpar.cpp
r4244 r4248 18 18 19 19 20 /* Objectconstructors and destructor*/20 /*Matpar constructors and destructor*/ 21 21 /*FUNCTION Matpar::Matpar() {{{1*/ 22 22 Matpar::Matpar(){ … … 84 84 /*}}}1*/ 85 85 86 /*Object marshall*/ 87 /*FUNCTION Matpar::Demarshall {{{1*/ 88 void Matpar::Demarshall(char** pmarshalled_dataset){ 89 90 char* marshalled_dataset=NULL; 91 92 /*recover marshalled_dataset: */ 93 marshalled_dataset=*pmarshalled_dataset; 94 95 /*this time, no need to get enum type, the pointer directly points to the beginning of the 96 *object data (thanks to DataSet::Demarshall):*/ 97 98 memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid); 99 memcpy(&rho_ice,marshalled_dataset,sizeof(rho_ice));marshalled_dataset+=sizeof(rho_ice); 100 memcpy(&rho_water,marshalled_dataset,sizeof(rho_water));marshalled_dataset+=sizeof(rho_water); 101 memcpy(&heatcapacity,marshalled_dataset,sizeof(heatcapacity));marshalled_dataset+=sizeof(heatcapacity); 102 memcpy(&thermalconductivity,marshalled_dataset,sizeof(thermalconductivity));marshalled_dataset+=sizeof(thermalconductivity); 103 memcpy(&latentheat,marshalled_dataset,sizeof(latentheat));marshalled_dataset+=sizeof(latentheat); 104 memcpy(&beta,marshalled_dataset,sizeof(beta));marshalled_dataset+=sizeof(beta); 105 memcpy(&meltingpoint,marshalled_dataset,sizeof(meltingpoint));marshalled_dataset+=sizeof(meltingpoint); 106 memcpy(&mixed_layer_capacity,marshalled_dataset,sizeof(mixed_layer_capacity));marshalled_dataset+=sizeof(mixed_layer_capacity); 107 memcpy(&thermal_exchange_velocity,marshalled_dataset,sizeof(thermal_exchange_velocity));marshalled_dataset+=sizeof(thermal_exchange_velocity); 108 memcpy(&g,marshalled_dataset,sizeof(g));marshalled_dataset+=sizeof(g); 109 110 /*return: */ 111 *pmarshalled_dataset=marshalled_dataset; 112 return; 86 /*Object virtual functions definitions:*/ 87 /*FUNCTION Matpar::Echo {{{1*/ 88 void Matpar::Echo(void){ 89 90 printf("Matpar:\n"); 91 printf(" mid: %i\n",mid); 92 printf(" rho_ice: %g\n",rho_ice); 93 printf(" rho_water: %g\n",rho_water); 94 printf(" heatcapacity: %g\n",heatcapacity); 95 printf(" thermalconductivity: %g\n",thermalconductivity); 96 printf(" latentheat: %g\n",latentheat); 97 printf(" beta: %g\n",beta); 98 printf(" meltingpoint: %g\n",meltingpoint); 99 printf(" mixed_layer_capacity: %g\n",mixed_layer_capacity); 100 printf(" thermal_exchange_velocity: %g\n",thermal_exchange_velocity); 101 printf(" g: %g\n",g); 102 return; 103 } 104 /*}}}1*/ 105 /*FUNCTION Matpar::DeepEcho {{{1*/ 106 void Matpar::DeepEcho(void){ 107 108 printf("Matpar:\n"); 109 printf(" mid: %i\n",mid); 110 printf(" rho_ice: %g\n",rho_ice); 111 printf(" rho_water: %g\n",rho_water); 112 printf(" heatcapacity: %g\n",heatcapacity); 113 printf(" thermalconductivity: %g\n",thermalconductivity); 114 printf(" latentheat: %g\n",latentheat); 115 printf(" beta: %g\n",beta); 116 printf(" meltingpoint: %g\n",meltingpoint); 117 printf(" mixed_layer_capacity: %g\n",mixed_layer_capacity); 118 printf(" thermal_exchange_velocity: %g\n",thermal_exchange_velocity); 119 printf(" g: %g\n",g); 120 return; 121 } 122 /*}}}1*/ 123 /*FUNCTION Matpar::Id {{{1*/ 124 int Matpar::Id(void){ return mid; } 125 /*}}}1*/ 126 /*FUNCTION Matpar::MyRank {{{1*/ 127 int Matpar::MyRank(void){ 128 extern int my_rank; 129 return my_rank; 113 130 } 114 131 /*}}}1*/ … … 162 179 } 163 180 /*}}}1*/ 164 165 /*Object functions*/ 181 /*FUNCTION Matpar::Demarshall {{{1*/ 182 void Matpar::Demarshall(char** pmarshalled_dataset){ 183 184 char* marshalled_dataset=NULL; 185 186 /*recover marshalled_dataset: */ 187 marshalled_dataset=*pmarshalled_dataset; 188 189 /*this time, no need to get enum type, the pointer directly points to the beginning of the 190 *object data (thanks to DataSet::Demarshall):*/ 191 192 memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid); 193 memcpy(&rho_ice,marshalled_dataset,sizeof(rho_ice));marshalled_dataset+=sizeof(rho_ice); 194 memcpy(&rho_water,marshalled_dataset,sizeof(rho_water));marshalled_dataset+=sizeof(rho_water); 195 memcpy(&heatcapacity,marshalled_dataset,sizeof(heatcapacity));marshalled_dataset+=sizeof(heatcapacity); 196 memcpy(&thermalconductivity,marshalled_dataset,sizeof(thermalconductivity));marshalled_dataset+=sizeof(thermalconductivity); 197 memcpy(&latentheat,marshalled_dataset,sizeof(latentheat));marshalled_dataset+=sizeof(latentheat); 198 memcpy(&beta,marshalled_dataset,sizeof(beta));marshalled_dataset+=sizeof(beta); 199 memcpy(&meltingpoint,marshalled_dataset,sizeof(meltingpoint));marshalled_dataset+=sizeof(meltingpoint); 200 memcpy(&mixed_layer_capacity,marshalled_dataset,sizeof(mixed_layer_capacity));marshalled_dataset+=sizeof(mixed_layer_capacity); 201 memcpy(&thermal_exchange_velocity,marshalled_dataset,sizeof(thermal_exchange_velocity));marshalled_dataset+=sizeof(thermal_exchange_velocity); 202 memcpy(&g,marshalled_dataset,sizeof(g));marshalled_dataset+=sizeof(g); 203 204 /*return: */ 205 *pmarshalled_dataset=marshalled_dataset; 206 return; 207 } 208 /*}}}1*/ 209 /*FUNCTION Matpar::Enum {{{1*/ 210 int Matpar::Enum(void){ 211 212 return MatparEnum; 213 214 } 215 /*}}}1*/ 166 216 /*FUNCTION Matpar::copy {{{1*/ 167 217 Object* Matpar::copy() { … … 169 219 } 170 220 /*}}}1*/ 171 /*FUNCTION Matpar::DeepEcho {{{1*/ 172 void Matpar::DeepEcho(void){ 173 174 printf("Matpar:\n"); 175 printf(" mid: %i\n",mid); 176 printf(" rho_ice: %g\n",rho_ice); 177 printf(" rho_water: %g\n",rho_water); 178 printf(" heatcapacity: %g\n",heatcapacity); 179 printf(" thermalconductivity: %g\n",thermalconductivity); 180 printf(" latentheat: %g\n",latentheat); 181 printf(" beta: %g\n",beta); 182 printf(" meltingpoint: %g\n",meltingpoint); 183 printf(" mixed_layer_capacity: %g\n",mixed_layer_capacity); 184 printf(" thermal_exchange_velocity: %g\n",thermal_exchange_velocity); 185 printf(" g: %g\n",g); 186 return; 187 } 188 /*}}}1*/ 189 /*FUNCTION Matpar::Echo {{{1*/ 190 void Matpar::Echo(void){ 191 192 printf("Matpar:\n"); 193 printf(" mid: %i\n",mid); 194 printf(" rho_ice: %g\n",rho_ice); 195 printf(" rho_water: %g\n",rho_water); 196 printf(" heatcapacity: %g\n",heatcapacity); 197 printf(" thermalconductivity: %g\n",thermalconductivity); 198 printf(" latentheat: %g\n",latentheat); 199 printf(" beta: %g\n",beta); 200 printf(" meltingpoint: %g\n",meltingpoint); 201 printf(" mixed_layer_capacity: %g\n",mixed_layer_capacity); 202 printf(" thermal_exchange_velocity: %g\n",thermal_exchange_velocity); 203 printf(" g: %g\n",g); 204 return; 205 } 206 /*}}}1*/ 207 /*FUNCTION Matpar::Enum {{{1*/ 208 int Matpar::Enum(void){ 209 210 return MatparEnum; 211 212 } 213 /*}}}1*/ 221 222 /*Matpar management: */ 214 223 /*FUNCTION Matpar::GetBeta {{{1*/ 215 224 double Matpar::GetBeta(){ … … 226 235 return heatcapacity; 227 236 } 228 /*}}}1*/229 /*FUNCTION Matpar::Id {{{1*/230 int Matpar::Id(void){ return mid; }231 237 /*}}}1*/ 232 238 /*FUNCTION Matpar::GetLatentHeat {{{1*/ … … 266 272 } 267 273 /*}}}1*/ 268 /*FUNCTION Matpar::MyRank {{{1*/269 int Matpar::MyRank(void){270 extern int my_rank;271 return my_rank;272 }273 /*}}}1*/274 274 /*FUNCTION Matpar::InputUpdateFromVector(double* vector, int name, int type) {{{1*/ 275 275 void Matpar::InputUpdateFromVector(double* vector, int name, int type){ -
issm/trunk/src/c/objects/Materials/Matpar.h
r4244 r4248 36 36 ~Matpar(); 37 37 38 /*Object virtual functions resolution: {{{1*/38 /*Object virtual functions definitions:{{{1 */ 39 39 void Echo(); 40 40 void DeepEcho(); 41 int Id(); 42 int MyRank(); 41 43 void Marshall(char** pmarshalled_dataset); 42 44 int MarshallSize(); 43 45 void Demarshall(char** pmarshalled_dataset); 44 46 int Enum(); 45 int Id();46 47 Object* copy(); 47 int MyRank();48 48 /*}}}*/ 49 49 /*Update virtual functions resolution: {{{1*/ -
issm/trunk/src/c/objects/Node.cpp
r4244 r4248 18 18 #include "../include/include.h" 19 19 /*}}}*/ 20 21 /*Object constructors and destructors: {{{1*/ 20 /*Node constructors and destructors: {{{1*/ 22 21 /*FUNCTION Node::Node() default constructor {{{2*/ 23 22 Node::Node(){ … … 176 175 /*}}}*/ 177 176 /*}}}*/ 178 /*Object management: {{{1*/ 179 /*FUNCTION Node::Configure {{{2*/ 180 void Node::Configure(DataSet* nodesin,Vertices* verticesin){ 181 182 int i; 183 184 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 185 * datasets, using internal ids and offsets hidden in hooks: */ 186 hvertex.configure(verticesin); 187 hupper_node.configure(nodesin); 188 189 } 190 /*FUNCTION Node::copy {{{2*/ 191 Object* Node::copy() { 192 193 return new Node(this->id,this->sid,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs,this->analysis_type); 194 195 } 196 177 /*Object virtual functions definitions: {{{1*/ 178 /*FUNCTION Node::Echo{{{2*/ 179 void Node::Echo(void){ 180 181 printf("Node:\n"); 182 printf(" id: %i\n",id); 183 printf(" sid: %i\n",sid); 184 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 185 indexing.Echo(); 186 printf(" hvertex: not displayed\n"); 187 printf(" hupper_node: not displayed\n"); 188 printf(" inputs: %p\n",inputs); 189 190 191 } 197 192 /*}}}*/ 198 193 /*FUNCTION Node::DeepEcho{{{2*/ … … 214 209 } 215 210 /*}}}*/ 216 /*FUNCTION Node::Demarshall{{{2*/217 void Node::Demarshall(char** pmarshalled_dataset){218 219 char* marshalled_dataset=NULL;220 221 /*recover marshalled_dataset: */222 marshalled_dataset=*pmarshalled_dataset;223 224 /*this time, no need to get enum type, the pointer directly points to the beginning of the225 *object data (thanks to DataSet::Demarshall):*/226 227 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);228 memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);229 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);230 231 /*demarshall objects: */232 indexing.Demarshall(&marshalled_dataset);233 hvertex.Demarshall(&marshalled_dataset);234 hupper_node.Demarshall(&marshalled_dataset);235 236 /*demarshall inputs: */237 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);238 239 /*return: */240 *pmarshalled_dataset=marshalled_dataset;241 return;242 }243 /*}}}*/244 /*FUNCTION Node::Echo{{{2*/245 void Node::Echo(void){246 247 printf("Node:\n");248 printf(" id: %i\n",id);249 printf(" sid: %i\n",sid);250 printf(" analysis_type: %s\n",EnumAsString(analysis_type));251 indexing.Echo();252 printf(" hvertex: not displayed\n");253 printf(" hupper_node: not displayed\n");254 printf(" inputs: %p\n",inputs);255 256 257 }258 /*}}}*/259 /*FUNCTION Node::Enum{{{2*/260 int Node::Enum(void){261 262 return NodeEnum;263 264 }265 /*}}}*/266 /*FUNCTION Node::GetDof {{{2*/267 int Node::GetDof(int dofindex){268 269 return indexing.doflist[dofindex];270 271 }272 /*}}}*/273 /*FUNCTION Node::GetDofList1{{{2*/274 int Node::GetDofList1(void){275 276 Vertex* vertex=NULL;277 278 vertex=(Vertex*)this->hvertex.delivers();279 280 return vertex->dof;281 }282 /*}}}*/283 /*FUNCTION Node::GetDofList{{{2*/284 void Node::GetDofList(int* outdoflist,int* pnumberofdofspernode){285 286 int i;287 for(i=0;i<this->indexing.numberofdofs;i++){288 outdoflist[i]=indexing.doflist[i];289 }290 /*Assign output pointers:*/291 *pnumberofdofspernode=this->indexing.numberofdofs;292 }293 /*}}}*/294 211 /*FUNCTION Node::Id{{{2*/ 295 212 int Node::Id(void){ return id; } 296 213 /*}}}*/ 297 /*FUNCTION Node::Sid{{{2*/ 298 int Node::Sid(void){ return sid; } 299 /*}}}*/ 300 /*FUNCTION Node::GetVertexId {{{2*/ 301 int Node::GetVertexId(void){ 302 303 Vertex* vertex=NULL; 304 305 vertex=(Vertex*)hvertex.delivers(); 306 return vertex->id; 307 } 308 /*}}}*/ 309 /*FUNCTION Node::GetVertexDof {{{2*/ 310 int Node::GetVertexDof(void){ 311 312 Vertex* vertex=NULL; 313 314 vertex=(Vertex*)hvertex.delivers(); 315 return vertex->dof; 214 /*FUNCTION Node::MyRank{{{2*/ 215 int Node::MyRank(void){ 216 extern int my_rank; 217 218 return my_rank; 316 219 } 317 220 /*}}}*/ … … 369 272 } 370 273 /*}}}*/ 274 /*FUNCTION Node::Demarshall{{{2*/ 275 void Node::Demarshall(char** pmarshalled_dataset){ 276 277 char* marshalled_dataset=NULL; 278 279 /*recover marshalled_dataset: */ 280 marshalled_dataset=*pmarshalled_dataset; 281 282 /*this time, no need to get enum type, the pointer directly points to the beginning of the 283 *object data (thanks to DataSet::Demarshall):*/ 284 285 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 286 memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid); 287 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 288 289 /*demarshall objects: */ 290 indexing.Demarshall(&marshalled_dataset); 291 hvertex.Demarshall(&marshalled_dataset); 292 hupper_node.Demarshall(&marshalled_dataset); 293 294 /*demarshall inputs: */ 295 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 296 297 /*return: */ 298 *pmarshalled_dataset=marshalled_dataset; 299 return; 300 } 301 /*}}}*/ 302 /*FUNCTION Node::Enum{{{2*/ 303 int Node::Enum(void){ 304 305 return NodeEnum; 306 307 } 308 /*}}}*/ 309 /*FUNCTION Node::copy {{{2*/ 310 Object* Node::copy() { 311 312 return new Node(this->id,this->sid,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs,this->analysis_type); 313 314 } 315 316 /*}}}*/ 317 /*}}}*/ 318 /*Node management: {{{1*/ 319 /*FUNCTION Node::Configure {{{2*/ 320 void Node::Configure(DataSet* nodesin,Vertices* verticesin){ 321 322 int i; 323 324 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 325 * datasets, using internal ids and offsets hidden in hooks: */ 326 hvertex.configure(verticesin); 327 hupper_node.configure(nodesin); 328 329 } 330 /*FUNCTION Node::GetDof {{{2*/ 331 int Node::GetDof(int dofindex){ 332 333 return indexing.doflist[dofindex]; 334 335 } 336 /*}}}*/ 337 /*FUNCTION Node::GetDofList1{{{2*/ 338 int Node::GetDofList1(void){ 339 340 Vertex* vertex=NULL; 341 342 vertex=(Vertex*)this->hvertex.delivers(); 343 344 return vertex->dof; 345 } 346 /*}}}*/ 347 /*FUNCTION Node::GetDofList{{{2*/ 348 void Node::GetDofList(int* outdoflist,int* pnumberofdofspernode){ 349 350 int i; 351 for(i=0;i<this->indexing.numberofdofs;i++){ 352 outdoflist[i]=indexing.doflist[i]; 353 } 354 /*Assign output pointers:*/ 355 *pnumberofdofspernode=this->indexing.numberofdofs; 356 } 357 /*}}}*/ 358 /*FUNCTION Node::Sid{{{2*/ 359 int Node::Sid(void){ return sid; } 360 /*}}}*/ 361 /*FUNCTION Node::GetVertexId {{{2*/ 362 int Node::GetVertexId(void){ 363 364 Vertex* vertex=NULL; 365 366 vertex=(Vertex*)hvertex.delivers(); 367 return vertex->id; 368 } 369 /*}}}*/ 370 /*FUNCTION Node::GetVertexDof {{{2*/ 371 int Node::GetVertexDof(void){ 372 373 Vertex* vertex=NULL; 374 375 vertex=(Vertex*)hvertex.delivers(); 376 return vertex->dof; 377 } 378 /*}}}*/ 371 379 /*FUNCTION Node::SetVertexDof {{{2*/ 372 380 void Node::SetVertexDof(int in_dof){ … … 386 394 /*}}}*/ 387 395 /*}}}*/ 388 /* Objectnumerics: {{{1*/396 /*Node numerics: {{{1*/ 389 397 /*FUNCTION Node::ApplyConstraints{{{2*/ 390 398 void Node::ApplyConstraint(Vec yg,int dof,double value){ … … 783 791 } 784 792 /*}}}*/ 785 /*FUNCTION Node::MyRank{{{2*/786 int Node::MyRank(void){787 extern int my_rank;788 789 return my_rank;790 }791 /*}}}*/792 793 /*FUNCTION Node::InputUpdateFromVector(double* vector, int name, int type){{{2*/ 793 794 void Node::InputUpdateFromVector(double* vector, int name, int type){ -
issm/trunk/src/c/objects/Node.h
r4244 r4248 34 34 public: 35 35 36 /* FUNCTIONconstructors, destructors {{{1*/36 /*Node constructors, destructors {{{1*/ 37 37 Node(); 38 38 Node(int id,int sid, int vertex_id, int upper_node_id, int numberofdofs); … … 41 41 ~Node(); 42 42 /*}}}*/ 43 /*Object virtual functions resolution: {{{1*/44 void Configure(DataSet* nodes,Vertices* vertices);43 /*Object virtual functions definitions:{{{1 */ 44 void Echo(); 45 45 void DeepEcho(); 46 void Demarshall(char** pmarshalled_dataset); 47 void Echo(); 48 int Enum(); 49 int Id(void); 50 int Sid(void); 46 int Id(); 47 int MyRank(); 51 48 void Marshall(char** pmarshalled_dataset); 52 49 int MarshallSize(); 53 int MyRank(void); 50 void Demarshall(char** pmarshalled_dataset); 51 int Enum(); 52 Object* copy(); 54 53 /*}}}*/ 55 /*Update virtual functions resolution: {{{1*/54 /*Update virtual functions definitions: {{{1*/ 56 55 void InputUpdateFromVector(double* vector, int name, int type); 57 56 void InputUpdateFromVector(int* vector, int name, int type); … … 62 61 void InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");} 63 62 /*}}}*/ 64 /*FUNCTION numerical routines {{{1*/ 63 /*Node numerical routines {{{1*/ 64 void Configure(DataSet* nodes,Vertices* vertices); 65 int Sid(void); 65 66 int GetVertexDof(void); 66 67 int GetVertexId(void); … … 82 83 double GetZ(); 83 84 double GetSigma(); 84 Object* copy();85 85 Node* GetUpperNode(); 86 86 int IsOnBed(); … … 93 93 void VecExtrude(Vec vector,double* vector_serial); 94 94 /*}}}*/ 95 /* FUNCTION DofObject routines {{{1*/95 /*Dof Object routines {{{1*/ 96 96 void DistributeDofs(int* pdofcount); 97 97 void OffsetDofs(int dofcount); -
issm/trunk/src/c/objects/Object.h
r4244 r4248 15 15 16 16 public: 17 17 18 virtual ~Object() {}; 18 19 virtual void Echo()=0; … … 25 26 virtual int Enum()=0; 26 27 virtual Object* copy()=0; 28 27 29 }; 28 30 #endif -
issm/trunk/src/c/objects/Params/BoolParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*BoolParam constructors and destructor*/ 23 23 /*FUNCTION BoolParam::BoolParam(){{{1*/ 24 24 BoolParam::BoolParam(){ … … 39 39 /*}}}*/ 40 40 41 /*Object methods*/ 42 /*FUNCTION BoolParam::copy{{{1*/ 43 Object* BoolParam::copy() { 44 45 return new BoolParam(this->enum_type,this->value); 46 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION BoolParam::Echo {{{1*/ 43 void BoolParam::Echo(void){ 44 this->DeepEcho(); 47 45 } 48 46 /*}}}*/ … … 55 53 } 56 54 /*}}}*/ 57 /*FUNCTION BoolParam::Demarshall{{{1*/58 void BoolParam::Demarshall(char** pmarshalled_dataset){59 60 char* marshalled_dataset=NULL;61 int i;62 63 /*recover marshalled_dataset: */64 marshalled_dataset=*pmarshalled_dataset;65 66 /*this time, no need to get enum type, the pointer directly points to the beginning of the67 *object data (thanks to DataSet::Demarshall):*/68 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);69 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);70 71 /*return: */72 *pmarshalled_dataset=marshalled_dataset;73 return;74 }75 /*}}}*/76 /*FUNCTION BoolParam::Echo {{{1*/77 void BoolParam::Echo(void){78 this->DeepEcho();79 }80 /*}}}*/81 /*FUNCTION BoolParam::Enum{{{1*/82 int BoolParam::Enum(void){83 84 return BoolParamEnum;85 86 }87 /*}}}*/88 55 /*FUNCTION BoolParam::Id{{{1*/ 89 56 int BoolParam::Id(void){ return -1; } 57 /*}}}*/ 58 /*FUNCTION BoolParam::MyRank{{{1*/ 59 int BoolParam::MyRank(void){ 60 extern int my_rank; 61 return my_rank; 62 } 90 63 /*}}}*/ 91 64 /*FUNCTION BoolParam::Marshall{{{1*/ … … 119 92 } 120 93 /*}}}*/ 121 /*FUNCTION BoolParam::MyRank{{{1*/ 122 int BoolParam::MyRank(void){ 123 extern int my_rank; 124 return my_rank; 94 /*FUNCTION BoolParam::Demarshall{{{1*/ 95 void BoolParam::Demarshall(char** pmarshalled_dataset){ 96 97 char* marshalled_dataset=NULL; 98 int i; 99 100 /*recover marshalled_dataset: */ 101 marshalled_dataset=*pmarshalled_dataset; 102 103 /*this time, no need to get enum type, the pointer directly points to the beginning of the 104 *object data (thanks to DataSet::Demarshall):*/ 105 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 106 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value); 107 108 /*return: */ 109 *pmarshalled_dataset=marshalled_dataset; 110 return; 125 111 } 126 112 /*}}}*/ 113 /*FUNCTION BoolParam::Enum{{{1*/ 114 int BoolParam::Enum(void){ 115 116 return BoolParamEnum; 117 118 } 119 /*}}}*/ 120 /*FUNCTION BoolParam::copy{{{1*/ 121 Object* BoolParam::copy() { 122 123 return new BoolParam(this->enum_type,this->value); 124 125 } 126 /*}}}*/ 127 128 /*BoolParam virtual functions definitions: */ 127 129 /*FUNCTION BoolParam::GetParameterName(void); {{{1*/ 128 130 char* BoolParam::GetParameterName(void){ -
issm/trunk/src/c/objects/Params/BoolParam.h
r4244 r4248 35 35 IssmBool value; 36 36 37 /* constructors, destructors: {{{1*/37 /*BoolParam constructors, destructors: {{{1*/ 38 38 BoolParam(); 39 39 BoolParam(int enum_type,IssmBool value); 40 40 ~BoolParam(); 41 41 /*}}}*/ 42 /*Object methods: {{{1*/43 Object* copy();42 /*Object virtual functions definitions:{{{1 */ 43 void Echo(); 44 44 void DeepEcho(); 45 void Demarshall(char** pmarshalled_dataset); 46 void Echo(); 47 int Enum(); 48 int Id(); 45 int Id(); 46 int MyRank(); 49 47 void Marshall(char** pmarshalled_dataset); 50 48 int MarshallSize(); 51 int MyRank(); 49 void Demarshall(char** pmarshalled_dataset); 50 int Enum(); 51 Object* copy(); 52 52 /*}}}*/ 53 /*Param methods: {{{1*/53 /*Param vritual function definitions: {{{1*/ 54 54 int EnumType(){return enum_type;} 55 55 void GetParameterValue(bool* pbool){*pbool=value;} -
issm/trunk/src/c/objects/Params/DoubleMatParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*DoubleMatParam constructors and destructor*/ 23 23 /*FUNCTION DoubleMatParam::DoubleMatParam(){{{1*/ 24 24 DoubleMatParam::DoubleMatParam(){ … … 44 44 /*}}}*/ 45 45 46 /*Object methods*/ 47 /*FUNCTION DoubleMatParam::copy{{{1*/ 48 Object* DoubleMatParam::copy() { 49 50 return new DoubleMatParam(this->enum_type,this->value,this->M,this->N); 46 /*Object virtual functions definitions:*/ 47 /*FUNCTION DoubleMatParam::Echo {{{1*/ 48 void DoubleMatParam::Echo(void){ 49 50 printf("DoubleMatParam:\n"); 51 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 52 printf(" matrix size: %ix%i\n",this->M,this->N); 51 53 52 54 } … … 67 69 } 68 70 /*}}}*/ 71 /*FUNCTION DoubleMatParam::Id{{{1*/ 72 int DoubleMatParam::Id(void){ return -1; } 73 /*}}}*/ 74 /*FUNCTION DoubleMatParam::MyRank{{{1*/ 75 int DoubleMatParam::MyRank(void){ 76 extern int my_rank; 77 return my_rank; 78 } 79 /*}}}*/ 80 /*FUNCTION DoubleMatParam::Marshall{{{1*/ 81 void DoubleMatParam::Marshall(char** pmarshalled_dataset){ 82 83 char* marshalled_dataset=NULL; 84 int enum_value=0; 85 86 /*recover marshalled_dataset: */ 87 marshalled_dataset=*pmarshalled_dataset; 88 89 /*get enum value of DoubleMatParam: */ 90 enum_value=DoubleMatParamEnum; 91 92 /*marshall enum: */ 93 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 94 95 /*marshall DoubleMatParam data: */ 96 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 97 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 98 memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N); 99 memcpy(marshalled_dataset,value,M*N*sizeof(double));marshalled_dataset+=M*N*sizeof(double); 100 101 *pmarshalled_dataset=marshalled_dataset; 102 } 103 /*}}}*/ 104 /*FUNCTION DoubleMatParam::MarshallSize{{{1*/ 105 int DoubleMatParam::MarshallSize(){ 106 107 return sizeof(M) 108 +sizeof(N) 109 +M*N*sizeof(double) 110 +sizeof(enum_type)+ 111 +sizeof(int); //sizeof(int) for enum value 112 } 113 /*}}}*/ 69 114 /*FUNCTION DoubleMatParam::Demarshall{{{1*/ 70 115 void DoubleMatParam::Demarshall(char** pmarshalled_dataset){ … … 91 136 } 92 137 /*}}}*/ 93 /*FUNCTION DoubleMatParam::Echo {{{1*/94 void DoubleMatParam::Echo(void){95 96 printf("DoubleMatParam:\n");97 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));98 printf(" matrix size: %ix%i\n",this->M,this->N);99 100 }101 /*}}}*/102 138 /*FUNCTION DoubleMatParam::Enum{{{1*/ 103 139 int DoubleMatParam::Enum(void){ … … 107 143 } 108 144 /*}}}*/ 109 /*FUNCTION DoubleMatParam::Id{{{1*/ 110 int DoubleMatParam::Id(void){ return -1; } 111 /*}}}*/ 112 /*FUNCTION DoubleMatParam::Marshall{{{1*/ 113 void DoubleMatParam::Marshall(char** pmarshalled_dataset){ 114 115 char* marshalled_dataset=NULL; 116 int enum_value=0; 117 118 /*recover marshalled_dataset: */ 119 marshalled_dataset=*pmarshalled_dataset; 120 121 /*get enum value of DoubleMatParam: */ 122 enum_value=DoubleMatParamEnum; 123 124 /*marshall enum: */ 125 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 126 127 /*marshall DoubleMatParam data: */ 128 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 129 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 130 memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N); 131 memcpy(marshalled_dataset,value,M*N*sizeof(double));marshalled_dataset+=M*N*sizeof(double); 132 133 *pmarshalled_dataset=marshalled_dataset; 134 } 135 /*}}}*/ 136 /*FUNCTION DoubleMatParam::MarshallSize{{{1*/ 137 int DoubleMatParam::MarshallSize(){ 138 139 return sizeof(M) 140 +sizeof(N) 141 +M*N*sizeof(double) 142 +sizeof(enum_type)+ 143 +sizeof(int); //sizeof(int) for enum value 144 } 145 /*}}}*/ 146 /*FUNCTION DoubleMatParam::MyRank{{{1*/ 147 int DoubleMatParam::MyRank(void){ 148 extern int my_rank; 149 return my_rank; 150 } 151 /*}}}*/ 145 /*FUNCTION DoubleMatParam::copy{{{1*/ 146 Object* DoubleMatParam::copy() { 147 148 return new DoubleMatParam(this->enum_type,this->value,this->M,this->N); 149 150 } 151 /*}}}*/ 152 153 /*DoubleMatParam virtual functions definitions: */ 152 154 /*FUNCTION DoubleMatParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){{{1*/ 153 155 void DoubleMatParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){ -
issm/trunk/src/c/objects/Params/DoubleMatParam.h
r4244 r4248 38 38 39 39 public: 40 /* constructors, destructors: {{{1*/40 /*DoubleMatParam constructors, destructors: {{{1*/ 41 41 DoubleMatParam(); 42 42 DoubleMatParam(int enum_type,IssmDouble* value,int M,int N); 43 43 ~DoubleMatParam(); 44 44 /*}}}*/ 45 /*Object methods: {{{1*/46 Object* copy();45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 47 47 void DeepEcho(); 48 void Demarshall(char** pmarshalled_dataset); 49 void Echo(); 50 int Enum(); 51 int Id(); 48 int Id(); 49 int MyRank(); 52 50 void Marshall(char** pmarshalled_dataset); 53 51 int MarshallSize(); 54 int MyRank(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 55 55 /*}}}*/ 56 /*Param methods: {{{1*/56 /*Param vritual function definitions: {{{1*/ 57 57 int EnumType(){return enum_type;} 58 58 void GetParameterValue(bool* pbool){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));} -
issm/trunk/src/c/objects/Params/DoubleParam.cpp
r4244 r4248 17 17 #include "../../include/include.h" 18 18 19 /* Objectconstructors and destructor*/19 /*DoubleParam constructors and destructor*/ 20 20 /*FUNCTION DoubleParam::DoubleParam(){{{1*/ 21 21 DoubleParam::DoubleParam(){ … … 36 36 /*}}}*/ 37 37 38 /*Object methods*/ 39 /*FUNCTION DoubleParam::copy{{{1*/ 40 Object* DoubleParam::copy() { 41 42 return new DoubleParam(this->enum_type,this->value); 43 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION DoubleParam::Echo {{{1*/ 40 void DoubleParam::Echo(void){ 41 this->DeepEcho(); 44 42 } 45 43 /*}}}*/ … … 52 50 } 53 51 /*}}}*/ 54 /*FUNCTION DoubleParam::Demarshall{{{1*/55 void DoubleParam::Demarshall(char** pmarshalled_dataset){56 57 char* marshalled_dataset=NULL;58 int i;59 60 /*recover marshalled_dataset: */61 marshalled_dataset=*pmarshalled_dataset;62 63 /*this time, no need to get enum type, the pointer directly points to the beginning of the64 *object data (thanks to DataSet::Demarshall):*/65 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);66 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);67 68 /*return: */69 *pmarshalled_dataset=marshalled_dataset;70 return;71 }72 /*}}}*/73 /*FUNCTION DoubleParam::Echo {{{1*/74 void DoubleParam::Echo(void){75 this->DeepEcho();76 }77 /*}}}*/78 /*FUNCTION DoubleParam::Enum{{{1*/79 int DoubleParam::Enum(void){80 81 return DoubleParamEnum;82 83 }84 /*}}}*/85 52 /*FUNCTION DoubleParam::Id{{{1*/ 86 53 int DoubleParam::Id(void){ return -1; } 54 /*}}}*/ 55 /*FUNCTION DoubleParam::MyRank{{{1*/ 56 int DoubleParam::MyRank(void){ 57 extern int my_rank; 58 return my_rank; 59 } 87 60 /*}}}*/ 88 61 /*FUNCTION DoubleParam::Marshall{{{1*/ … … 116 89 } 117 90 /*}}}*/ 118 /*FUNCTION DoubleParam::MyRank{{{1*/ 119 int DoubleParam::MyRank(void){ 120 extern int my_rank; 121 return my_rank; 91 /*FUNCTION DoubleParam::Demarshall{{{1*/ 92 void DoubleParam::Demarshall(char** pmarshalled_dataset){ 93 94 char* marshalled_dataset=NULL; 95 int i; 96 97 /*recover marshalled_dataset: */ 98 marshalled_dataset=*pmarshalled_dataset; 99 100 /*this time, no need to get enum type, the pointer directly points to the beginning of the 101 *object data (thanks to DataSet::Demarshall):*/ 102 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 103 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value); 104 105 /*return: */ 106 *pmarshalled_dataset=marshalled_dataset; 107 return; 122 108 } 123 109 /*}}}*/ 110 /*FUNCTION DoubleParam::Enum{{{1*/ 111 int DoubleParam::Enum(void){ 112 113 return DoubleParamEnum; 114 115 } 116 /*}}}*/ 117 /*FUNCTION DoubleParam::copy{{{1*/ 118 Object* DoubleParam::copy() { 119 120 return new DoubleParam(this->enum_type,this->value); 121 122 } 123 /*}}}*/ 124 125 /*DoubleParam virtual functions definitions: */ 124 126 /*FUNCTION DoubleParam::GetParameterName(void); {{{1*/ 125 127 char* DoubleParam::GetParameterName(void){ -
issm/trunk/src/c/objects/Params/DoubleParam.h
r4244 r4248 36 36 37 37 public: 38 /* constructors, destructors: {{{1*/38 /*DoubleParam constructors, destructors: {{{1*/ 39 39 DoubleParam(); 40 40 DoubleParam(int enum_type,IssmDouble value); 41 41 ~DoubleParam(); 42 42 /*}}}*/ 43 /*Object methods: {{{1*/44 Object* copy();43 /*Object virtual functions definitions:{{{1 */ 44 void Echo(); 45 45 void DeepEcho(); 46 void Demarshall(char** pmarshalled_dataset); 47 void Echo(); 48 int Enum(); 49 int Id(); 46 int Id(); 47 int MyRank(); 50 48 void Marshall(char** pmarshalled_dataset); 51 49 int MarshallSize(); 52 int MyRank(); 50 void Demarshall(char** pmarshalled_dataset); 51 int Enum(); 52 Object* copy(); 53 53 /*}}}*/ 54 /*Param methods: {{{1*/54 /*Param vritual function definitions: {{{1*/ 55 55 int EnumType(){return enum_type;} 56 56 void GetParameterValue(bool* pbool); -
issm/trunk/src/c/objects/Params/DoubleVecParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*DoubleVecParam constructors and destructor*/ 23 23 /*FUNCTION DoubleVecParam::DoubleVecParam(){{{1*/ 24 24 DoubleVecParam::DoubleVecParam(){ … … 43 43 /*}}}*/ 44 44 45 /*Object methods*/ 46 /*FUNCTION DoubleVecParam::copy{{{1*/ 47 Object* DoubleVecParam::copy() { 48 49 return new DoubleVecParam(this->enum_type,this->values,this->M); 45 /*Object virtual functions definitions:*/ 46 /*FUNCTION DoubleVecParam::Echo {{{1*/ 47 void DoubleVecParam::Echo(void){ 48 49 printf("DoubleVecParam:\n"); 50 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 51 printf(" vector size: %i\n",this->M); 50 52 51 53 } … … 64 66 } 65 67 /*}}}*/ 68 /*FUNCTION DoubleVecParam::Id{{{1*/ 69 int DoubleVecParam::Id(void){ return -1; } 70 /*}}}*/ 71 /*FUNCTION DoubleVecParam::MyRank{{{1*/ 72 int DoubleVecParam::MyRank(void){ 73 extern int my_rank; 74 return my_rank; 75 } 76 /*}}}*/ 77 /*FUNCTION DoubleVecParam::Marshall{{{1*/ 78 void DoubleVecParam::Marshall(char** pmarshalled_dataset){ 79 80 char* marshalled_dataset=NULL; 81 int enum_value=0; 82 83 /*recover marshalled_dataset: */ 84 marshalled_dataset=*pmarshalled_dataset; 85 86 /*get enum value of DoubleVecParam: */ 87 enum_value=DoubleVecParamEnum; 88 89 /*marshall enum: */ 90 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 91 92 /*marshall DoubleVecParam data: */ 93 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 94 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 95 memcpy(marshalled_dataset,values,M*sizeof(double));marshalled_dataset+=M*sizeof(double); 96 97 *pmarshalled_dataset=marshalled_dataset; 98 } 99 /*}}}*/ 100 /*FUNCTION DoubleVecParam::MarshallSize{{{1*/ 101 int DoubleVecParam::MarshallSize(){ 102 103 return sizeof(M) 104 +M*sizeof(double) 105 +sizeof(enum_type)+ 106 +sizeof(int); //sizeof(int) for enum value 107 } 108 /*}}}*/ 66 109 /*FUNCTION DoubleVecParam::Demarshall{{{1*/ 67 110 void DoubleVecParam::Demarshall(char** pmarshalled_dataset){ … … 87 130 } 88 131 /*}}}*/ 89 /*FUNCTION DoubleVecParam::Echo {{{1*/90 void DoubleVecParam::Echo(void){91 92 printf("DoubleVecParam:\n");93 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));94 printf(" vector size: %i\n",this->M);95 96 }97 /*}}}*/98 132 /*FUNCTION DoubleVecParam::Enum{{{1*/ 99 133 int DoubleVecParam::Enum(void){ … … 103 137 } 104 138 /*}}}*/ 105 /*FUNCTION DoubleVecParam::Id{{{1*/ 106 int DoubleVecParam::Id(void){ return -1; } 107 /*}}}*/ 108 /*FUNCTION DoubleVecParam::Marshall{{{1*/ 109 void DoubleVecParam::Marshall(char** pmarshalled_dataset){ 110 111 char* marshalled_dataset=NULL; 112 int enum_value=0; 113 114 /*recover marshalled_dataset: */ 115 marshalled_dataset=*pmarshalled_dataset; 116 117 /*get enum value of DoubleVecParam: */ 118 enum_value=DoubleVecParamEnum; 119 120 /*marshall enum: */ 121 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 122 123 /*marshall DoubleVecParam data: */ 124 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 125 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 126 memcpy(marshalled_dataset,values,M*sizeof(double));marshalled_dataset+=M*sizeof(double); 127 128 *pmarshalled_dataset=marshalled_dataset; 129 } 130 /*}}}*/ 131 /*FUNCTION DoubleVecParam::MarshallSize{{{1*/ 132 int DoubleVecParam::MarshallSize(){ 133 134 return sizeof(M) 135 +M*sizeof(double) 136 +sizeof(enum_type)+ 137 +sizeof(int); //sizeof(int) for enum value 138 } 139 /*}}}*/ 140 /*FUNCTION DoubleVecParam::MyRank{{{1*/ 141 int DoubleVecParam::MyRank(void){ 142 extern int my_rank; 143 return my_rank; 144 } 145 /*}}}*/ 139 /*FUNCTION DoubleVecParam::copy{{{1*/ 140 Object* DoubleVecParam::copy() { 141 142 return new DoubleVecParam(this->enum_type,this->values,this->M); 143 144 } 145 /*}}}*/ 146 147 /*DoubleVecParam virtual functions definitions: */ 146 148 /*FUNCTION DoubleVecParam::GetParameterValue(double** pdoublearray,int* pM){{{1*/ 147 149 void DoubleVecParam::GetParameterValue(double** pdoublearray,int* pM){ -
issm/trunk/src/c/objects/Params/DoubleVecParam.h
r4244 r4248 36 36 37 37 public: 38 /* constructors, destructors: {{{1*/38 /*DoubleVecParam constructors, destructors: {{{1*/ 39 39 DoubleVecParam(); 40 40 DoubleVecParam(int enum_type,IssmDouble* values,int M); 41 41 ~DoubleVecParam(); 42 42 /*}}}*/ 43 /* Object methods: {{{1*/44 Object* copy();43 /* /*Object virtual functions definitions:{{{1 */ 44 void Echo(); 45 45 void DeepEcho(); 46 void Demarshall(char** pmarshalled_dataset); 47 void Echo(); 48 int Enum(); 49 int Id(); 46 int Id(); 47 int MyRank(); 50 48 void Marshall(char** pmarshalled_dataset); 51 49 int MarshallSize(); 52 int MyRank(); 50 void Demarshall(char** pmarshalled_dataset); 51 int Enum(); 52 Object* copy(); 53 53 /*}}}*/ 54 /*Param methods: {{{1*/54 /*Param virtual functions definitions: {{{1*/ 55 55 int EnumType(){return enum_type;} 56 56 void GetParameterValue(bool* pbool){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));} … … 73 73 void SetValue(Vec vec){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 74 74 void SetValue(Mat mat){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 75 75 76 76 char* GetParameterName(void); 77 77 #ifdef _SERIAL_ 78 78 void SetMatlabField(mxArray* dataref); 79 79 #endif 80 81 80 /*}}}*/ 82 81 }; -
issm/trunk/src/c/objects/Params/IntParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*IntParam constructors and destructor*/ 23 23 /*FUNCTION IntParam::IntParam(){{{1*/ 24 24 IntParam::IntParam(){ … … 39 39 /*}}}*/ 40 40 41 /*Object methods*/ 42 /*FUNCTION IntParam::copy{{{1*/ 43 Object* IntParam::copy() { 44 45 return new IntParam(this->enum_type,this->value); 46 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION IntParam::Echo {{{1*/ 43 void IntParam::Echo(void){ 44 this->DeepEcho(); 47 45 } 48 46 /*}}}*/ … … 55 53 } 56 54 /*}}}*/ 57 /*FUNCTION IntParam::Demarshall{{{1*/58 void IntParam::Demarshall(char** pmarshalled_dataset){59 60 char* marshalled_dataset=NULL;61 int i;62 63 /*recover marshalled_dataset: */64 marshalled_dataset=*pmarshalled_dataset;65 66 /*this time, no need to get enum type, the pointer directly points to the beginning of the67 *object data (thanks to DataSet::Demarshall):*/68 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);69 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);70 71 /*return: */72 *pmarshalled_dataset=marshalled_dataset;73 return;74 }75 /*}}}*/76 /*FUNCTION IntParam::Echo {{{1*/77 void IntParam::Echo(void){78 this->DeepEcho();79 }80 /*}}}*/81 /*FUNCTION IntParam::Enum{{{1*/82 int IntParam::Enum(void){83 84 return IntParamEnum;85 86 }87 /*}}}*/88 55 /*FUNCTION IntParam::Id{{{1*/ 89 56 int IntParam::Id(void){ return -1; } 57 /*}}}*/ 58 /*FUNCTION IntParam::MyRank{{{1*/ 59 int IntParam::MyRank(void){ 60 extern int my_rank; 61 return my_rank; 62 } 90 63 /*}}}*/ 91 64 /*FUNCTION IntParam::Marshall{{{1*/ … … 119 92 } 120 93 /*}}}*/ 121 /*FUNCTION IntParam::MyRank{{{1*/ 122 int IntParam::MyRank(void){ 123 extern int my_rank; 124 return my_rank; 94 /*FUNCTION IntParam::Demarshall{{{1*/ 95 void IntParam::Demarshall(char** pmarshalled_dataset){ 96 97 char* marshalled_dataset=NULL; 98 int i; 99 100 /*recover marshalled_dataset: */ 101 marshalled_dataset=*pmarshalled_dataset; 102 103 /*this time, no need to get enum type, the pointer directly points to the beginning of the 104 *object data (thanks to DataSet::Demarshall):*/ 105 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 106 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value); 107 108 /*return: */ 109 *pmarshalled_dataset=marshalled_dataset; 110 return; 125 111 } 126 112 /*}}}*/ 113 /*FUNCTION IntParam::Enum{{{1*/ 114 int IntParam::Enum(void){ 115 116 return IntParamEnum; 117 118 } 119 /*}}}*/ 120 /*FUNCTION IntParam::copy{{{1*/ 121 Object* IntParam::copy() { 122 123 return new IntParam(this->enum_type,this->value); 124 125 } 126 /*}}}*/ 127 128 /*IntParam virtual functions definitions: */ 127 129 /*FUNCTION IntParam::GetParameterName(void); {{{1*/ 128 130 char* IntParam::GetParameterName(void){ -
issm/trunk/src/c/objects/Params/IntParam.h
r4244 r4248 35 35 36 36 public: 37 /* constructors, destructors: {{{1*/37 /*IntParam constructors, destructors: {{{1*/ 38 38 IntParam(); 39 39 IntParam(int enum_type,IssmInt value); 40 40 ~IntParam(); 41 41 /*}}}*/ 42 /*Object methods: {{{1*/43 Object* copy();42 /*Object virtual functions definitions:{{{1 */ 43 void Echo(); 44 44 void DeepEcho(); 45 void Demarshall(char** pmarshalled_dataset); 46 void Echo(); 47 int Enum(); 48 int Id(); 45 int Id(); 46 int MyRank(); 49 47 void Marshall(char** pmarshalled_dataset); 50 48 int MarshallSize(); 51 int MyRank(); 49 void Demarshall(char** pmarshalled_dataset); 50 int Enum(); 51 Object* copy(); 52 52 /*}}}*/ 53 /*Param methods: {{{1*/53 /*Param vritual function definitions: {{{1*/ 54 54 int EnumType(){return enum_type;} 55 55 void GetParameterValue(bool* pbool){ISSMERROR("Int param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));} -
issm/trunk/src/c/objects/Params/Param.h
r4160 r4248 30 30 virtual ~Param(){}; 31 31 32 /* methods:{{{1*/32 /*Virtual functions:{{{1*/ 33 33 virtual int EnumType()=0; 34 34 virtual void GetParameterValue(bool* pbool)=0; … … 56 56 virtual void SetMatlabField(mxArray* dataref)=0; 57 57 #endif 58 59 58 /*}}}*/ 60 59 -
issm/trunk/src/c/objects/Params/PetscMatParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*PetscMatParam constructors and destructor*/ 23 23 /*FUNCTION PetscMatParam::PetscMatParam(){{{1*/ 24 24 PetscMatParam::PetscMatParam(){ … … 44 44 /*}}}*/ 45 45 46 /*Object methods*/ 47 /*FUNCTION PetscMatParam::copy{{{1*/ 48 Object* PetscMatParam::copy() { 49 50 return new PetscMatParam(this->enum_type,this->value); 46 /*Object virtual functions definitions:*/ 47 /*FUNCTION PetscMatParam::Echo {{{1*/ 48 void PetscMatParam::Echo(void){ 49 50 printf("PetscMatParam:\n"); 51 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 51 52 52 53 } … … 59 60 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 60 61 MatView(value,PETSC_VIEWER_STDOUT_WORLD); 62 } 63 /*}}}*/ 64 /*FUNCTION PetscMatParam::Id{{{1*/ 65 int PetscMatParam::Id(void){ return -1; } 66 /*}}}*/ 67 /*FUNCTION PetscMatParam::MyRank{{{1*/ 68 int PetscMatParam::MyRank(void){ 69 extern int my_rank; 70 return my_rank; 71 } 72 /*}}}*/ 73 /*FUNCTION PetscMatParam::Marshall{{{1*/ 74 void PetscMatParam::Marshall(char** pmarshalled_dataset){ 75 76 char* marshalled_dataset=NULL; 77 int enum_value=0; 78 int M,N; 79 double* serial_mat=NULL; 80 81 /*recover marshalled_dataset: */ 82 marshalled_dataset=*pmarshalled_dataset; 83 84 /*get enum value of PetscMatParam: */ 85 enum_value=PetscMatParamEnum; 86 87 /*marshall enum: */ 88 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 89 90 /*marshall PetscMatParam data: */ 91 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 92 if(value){ 93 MatGetSize(value,&M,&N); 94 MatToSerial(&serial_mat,value); 95 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 96 memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N); 97 memcpy(marshalled_dataset,serial_mat,M*N*sizeof(double));marshalled_dataset+=(M*N*sizeof(double)); 98 } 99 else{ 100 M=0; 101 N=0; 102 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 103 memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N); 104 } 105 106 /*Free ressources:*/ 107 xfree((void**)&serial_mat); 108 109 /*return:*/ 110 *pmarshalled_dataset=marshalled_dataset; 111 } 112 /*}}}*/ 113 /*FUNCTION PetscMatParam::MarshallSize{{{1*/ 114 int PetscMatParam::MarshallSize(){ 115 116 int M=0; 117 int N=0; 118 if(value)MatGetSize(value,&M,&N); 119 120 return sizeof(M)+ 121 sizeof(N)+ 122 M*N*sizeof(double)+ 123 +sizeof(enum_type)+ 124 +sizeof(int); //sizeof(int) for enum value 61 125 } 62 126 /*}}}*/ … … 108 172 } 109 173 /*}}}*/ 110 /*FUNCTION PetscMatParam::Echo {{{1*/111 void PetscMatParam::Echo(void){112 113 printf("PetscMatParam:\n");114 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));115 116 }117 /*}}}*/118 174 /*FUNCTION PetscMatParam::Enum{{{1*/ 119 175 int PetscMatParam::Enum(void){ … … 123 179 } 124 180 /*}}}*/ 125 /*FUNCTION PetscMatParam::Id{{{1*/ 126 int PetscMatParam::Id(void){ return -1; } 127 /*}}}*/ 128 /*FUNCTION PetscMatParam::Marshall{{{1*/ 129 void PetscMatParam::Marshall(char** pmarshalled_dataset){ 130 131 char* marshalled_dataset=NULL; 132 int enum_value=0; 133 int M,N; 134 double* serial_mat=NULL; 135 136 /*recover marshalled_dataset: */ 137 marshalled_dataset=*pmarshalled_dataset; 138 139 /*get enum value of PetscMatParam: */ 140 enum_value=PetscMatParamEnum; 141 142 /*marshall enum: */ 143 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 144 145 /*marshall PetscMatParam data: */ 146 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 147 if(value){ 148 MatGetSize(value,&M,&N); 149 MatToSerial(&serial_mat,value); 150 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 151 memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N); 152 memcpy(marshalled_dataset,serial_mat,M*N*sizeof(double));marshalled_dataset+=(M*N*sizeof(double)); 153 } 154 else{ 155 M=0; 156 N=0; 157 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 158 memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N); 159 } 160 161 /*Free ressources:*/ 162 xfree((void**)&serial_mat); 163 164 /*return:*/ 165 *pmarshalled_dataset=marshalled_dataset; 166 } 167 /*}}}*/ 168 /*FUNCTION PetscMatParam::MarshallSize{{{1*/ 169 int PetscMatParam::MarshallSize(){ 170 171 int M=0; 172 int N=0; 173 if(value)MatGetSize(value,&M,&N); 174 175 return sizeof(M)+ 176 sizeof(N)+ 177 M*N*sizeof(double)+ 178 +sizeof(enum_type)+ 179 +sizeof(int); //sizeof(int) for enum value 180 } 181 /*}}}*/ 182 /*FUNCTION PetscMatParam::MyRank{{{1*/ 183 int PetscMatParam::MyRank(void){ 184 extern int my_rank; 185 return my_rank; 186 } 187 /*}}}*/ 181 /*FUNCTION PetscMatParam::copy{{{1*/ 182 Object* PetscMatParam::copy() { 183 184 return new PetscMatParam(this->enum_type,this->value); 185 186 } 187 /*}}}*/ 188 189 /*PetscMatParam virtual functions definitions: */ 188 190 /*FUNCTION PetscMatParam::GetParameterValue(Mat* pvalue){{{1*/ 189 191 void PetscMatParam::GetParameterValue(Mat* poutput){ -
issm/trunk/src/c/objects/Params/PetscMatParam.h
r4244 r4248 36 36 37 37 public: 38 /* constructors, destructors: {{{1*/38 /*PetscMatParam constructors, destructors: {{{1*/ 39 39 PetscMatParam(); 40 40 PetscMatParam(int enum_type,Mat value); 41 41 ~PetscMatParam(); 42 42 /*}}}*/ 43 /*Object methods: {{{1*/44 Object* copy();43 /*Object virtual functions definitions:{{{1 */ 44 void Echo(); 45 45 void DeepEcho(); 46 void Demarshall(char** pmarshalled_dataset); 47 void Echo(); 48 int Enum(); 49 int Id(); 46 int Id(); 47 int MyRank(); 50 48 void Marshall(char** pmarshalled_dataset); 51 49 int MarshallSize(); 52 int MyRank(); 50 void Demarshall(char** pmarshalled_dataset); 51 int Enum(); 52 Object* copy(); 53 53 /*}}}*/ 54 /*Param methods: {{{1*/54 /*Param vritual function definitions: {{{1*/ 55 55 int EnumType(){return enum_type;} 56 56 void GetParameterValue(bool* pbool){ISSMERROR("PetscMat param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));} -
issm/trunk/src/c/objects/Params/PetscVecParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*PetscVecParam constructors and destructor*/ 23 23 /*FUNCTION PetscVecParam::PetscVecParam(){{{1*/ 24 24 PetscVecParam::PetscVecParam(){ … … 45 45 /*}}}*/ 46 46 47 /*Object methods*/ 48 /*FUNCTION PetscVecParam::copy{{{1*/ 49 Object* PetscVecParam::copy() { 50 51 return new PetscVecParam(this->enum_type,this->value); 47 /*Object virtual functions definitions:*/ 48 /*FUNCTION PetscVecParam::Echo {{{1*/ 49 void PetscVecParam::Echo(void){ 50 51 printf("PetscVecParam:\n"); 52 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 52 53 53 54 } … … 62 63 } 63 64 /*}}}*/ 64 /*FUNCTION PetscVecParam::Demarshall{{{1*/65 void PetscVecParam::Demarshall(char** pmarshalled_dataset){66 67 char* marshalled_dataset=NULL;68 int i;69 int M;70 double* serial_vec=NULL;71 int* idxm=NULL;72 73 /*recover marshalled_dataset: */74 marshalled_dataset=*pmarshalled_dataset;75 76 /*this time, no need to get enum type, the pointer directly points to the beginning of the77 *object data (thanks to DataSet::Demarshall):*/78 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);79 80 /*data: */81 82 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);83 if(M){84 serial_vec=(double*)xmalloc(M*sizeof(double));85 memcpy(serial_vec,marshalled_dataset,M*sizeof(double));marshalled_dataset+=(M*sizeof(double));86 87 value=NewVec(M);88 idxm=(int*)xmalloc(M*sizeof(int));89 for(i=0;i<M;i++)idxm[i]=i;90 VecSetValues(value,M,idxm,serial_vec,INSERT_VALUES);91 92 VecAssemblyBegin(value);93 VecAssemblyEnd(value);94 95 96 }97 else{98 value=NULL;99 }100 101 /*Free ressources:*/102 xfree((void**)&serial_vec);103 xfree((void**)&idxm);104 105 /*return: */106 *pmarshalled_dataset=marshalled_dataset;107 }108 /*}}}*/109 /*FUNCTION PetscVecParam::Echo {{{1*/110 void PetscVecParam::Echo(void){111 112 printf("PetscVecParam:\n");113 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));114 115 }116 /*}}}*/117 /*FUNCTION PetscVecParam::Enum{{{1*/118 int PetscVecParam::Enum(void){119 120 return PetscVecParamEnum;121 122 }123 /*}}}*/124 65 /*FUNCTION PetscVecParam::Id{{{1*/ 125 66 int PetscVecParam::Id(void){ return -1; } 67 /*}}}*/ 68 /*FUNCTION PetscVecParam::MyRank{{{1*/ 69 int PetscVecParam::MyRank(void){ 70 extern int my_rank; 71 return my_rank; 72 } 126 73 /*}}}*/ 127 74 /*FUNCTION PetscVecParam::Marshall{{{1*/ … … 172 119 } 173 120 /*}}}*/ 174 /*FUNCTION PetscVecParam::MyRank{{{1*/ 175 int PetscVecParam::MyRank(void){ 176 extern int my_rank; 177 return my_rank; 178 } 179 /*}}}*/ 121 /*FUNCTION PetscVecParam::Demarshall{{{1*/ 122 void PetscVecParam::Demarshall(char** pmarshalled_dataset){ 123 124 char* marshalled_dataset=NULL; 125 int i; 126 int M; 127 double* serial_vec=NULL; 128 int* idxm=NULL; 129 130 /*recover marshalled_dataset: */ 131 marshalled_dataset=*pmarshalled_dataset; 132 133 /*this time, no need to get enum type, the pointer directly points to the beginning of the 134 *object data (thanks to DataSet::Demarshall):*/ 135 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 136 137 /*data: */ 138 139 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M); 140 if(M){ 141 serial_vec=(double*)xmalloc(M*sizeof(double)); 142 memcpy(serial_vec,marshalled_dataset,M*sizeof(double));marshalled_dataset+=(M*sizeof(double)); 143 144 value=NewVec(M); 145 idxm=(int*)xmalloc(M*sizeof(int)); 146 for(i=0;i<M;i++)idxm[i]=i; 147 VecSetValues(value,M,idxm,serial_vec,INSERT_VALUES); 148 149 VecAssemblyBegin(value); 150 VecAssemblyEnd(value); 151 152 153 } 154 else{ 155 value=NULL; 156 } 157 158 /*Free ressources:*/ 159 xfree((void**)&serial_vec); 160 xfree((void**)&idxm); 161 162 /*return: */ 163 *pmarshalled_dataset=marshalled_dataset; 164 } 165 /*}}}*/ 166 /*FUNCTION PetscVecParam::Enum{{{1*/ 167 int PetscVecParam::Enum(void){ 168 169 return PetscVecParamEnum; 170 171 } 172 /*}}}*/ 173 /*FUNCTION PetscVecParam::copy{{{1*/ 174 Object* PetscVecParam::copy() { 175 176 return new PetscVecParam(this->enum_type,this->value); 177 178 } 179 /*}}}*/ 180 181 /*PetscVecParam virtual functions definitions: */ 180 182 /*FUNCTION PetscVecParam::GetParameterValue(Vec* pvalue){{{1*/ 181 183 void PetscVecParam::GetParameterValue(Vec* poutput){ -
issm/trunk/src/c/objects/Params/PetscVecParam.h
r4244 r4248 36 36 37 37 public: 38 /* constructors, destructors: {{{1*/38 /*PetscVecParam constructors, destructors: {{{1*/ 39 39 PetscVecParam(); 40 40 PetscVecParam(int enum_type,Vec value); 41 41 ~PetscVecParam(); 42 42 /*}}}*/ 43 /*Object methods: {{{1*/44 Object* copy();43 /*Object virtual functions definitions:{{{1 */ 44 void Echo(); 45 45 void DeepEcho(); 46 void Demarshall(char** pmarshalled_dataset); 47 void Echo(); 48 int Enum(); 49 int Id(); 46 int Id(); 47 int MyRank(); 50 48 void Marshall(char** pmarshalled_dataset); 51 49 int MarshallSize(); 52 int MyRank(); 50 void Demarshall(char** pmarshalled_dataset); 51 int Enum(); 52 Object* copy(); 53 53 /*}}}*/ 54 /*Param methods: {{{1*/54 /*Param vritual function definitions: {{{1*/ 55 55 int EnumType(){return enum_type;} 56 56 void GetParameterValue(bool* pbool){ISSMERROR("PetscVec param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));} -
issm/trunk/src/c/objects/Params/StringArrayParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*StringArrayParam constructors and destructor*/ 23 23 /*FUNCTION StringArrayParam::StringArrayParam(){{{1*/ 24 24 StringArrayParam::StringArrayParam(){ … … 60 60 /*}}}*/ 61 61 62 /*Object methods*/ 63 /*FUNCTION StringArrayParam::copy{{{1*/ 64 Object* StringArrayParam::copy() { 65 66 return new StringArrayParam(this->enum_type,this->value,this->numstrings); 67 68 } 69 /*}}}*/ 70 /*FUNCTION StringArrayParam::DeepEcho{{{1*/ 71 void StringArrayParam::DeepEcho(void){ 72 73 int i; 74 char* string=NULL; 75 76 printf("StringArrayParam:\n"); 77 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 78 for(i=0;i<this->numstrings;i++){ 79 string=this->value[i]; 80 printf(" %i: %s\n",i,string); 81 } 82 } 83 /*}}}*/ 84 /*FUNCTION StringArrayParam::Demarshall{{{1*/ 85 void StringArrayParam::Demarshall(char** pmarshalled_dataset){ 86 87 char* marshalled_dataset=NULL; 88 int i; 89 int stringsize; 90 char* string=NULL; 91 92 /*recover marshalled_dataset: */ 93 marshalled_dataset=*pmarshalled_dataset; 94 95 /*this time, no need to get enum type, the pointer directly points to the beginning of the 96 *object data (thanks to DataSet::Demarshall):*/ 97 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 98 99 memcpy(&numstrings,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int); 100 this->value=(char**)xmalloc(numstrings*sizeof(char*)); 101 102 for(i=0;i<numstrings;i++){ 103 memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int); 104 105 string=(char*)xmalloc(stringsize*sizeof(char)); 106 memcpy(string,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char); 107 108 this->value[i]=string; 109 } 110 111 /*return: */ 112 *pmarshalled_dataset=marshalled_dataset; 113 return; 114 } 115 /*}}}*/ 62 /*Object virtual functions definitions:*/ 116 63 /*FUNCTION StringArrayParam::Echo {{{1*/ 117 64 void StringArrayParam::Echo(void){ … … 119 66 } 120 67 /*}}}*/ 121 /*FUNCTION StringArrayParam::Enum{{{1*/ 122 int StringArrayParam::Enum(void){ 123 124 return StringArrayParamEnum; 125 68 /*FUNCTION StringArrayParam::DeepEcho{{{1*/ 69 void StringArrayParam::DeepEcho(void){ 70 71 int i; 72 char* string=NULL; 73 74 printf("StringArrayParam:\n"); 75 printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type)); 76 for(i=0;i<this->numstrings;i++){ 77 string=this->value[i]; 78 printf(" %i: %s\n",i,string); 79 } 126 80 } 127 81 /*}}}*/ 128 82 /*FUNCTION StringArrayParam::Id{{{1*/ 129 83 int StringArrayParam::Id(void){ return -1; } 130 /*}}}*/131 /*FUNCTION StringArrayParam::Marshall{{{1*/132 void StringArrayParam::Marshall(char** pmarshalled_dataset){133 134 int i;135 char* marshalled_dataset=NULL;136 int enum_value=0;137 int stringsize;138 char* string=NULL;139 140 /*recover marshalled_dataset: */141 marshalled_dataset=*pmarshalled_dataset;142 143 /*get enum value of StringArrayParam: */144 enum_value=StringArrayParamEnum;145 146 /*marshall enum: */147 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);148 149 /*marshall data: */150 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);151 memcpy(marshalled_dataset,&numstrings,sizeof(numstrings));marshalled_dataset+=sizeof(numstrings);152 for(i=0;i<numstrings;i++){153 string=this->value[i];154 stringsize=strlen(string)+1;155 156 memcpy(marshalled_dataset,&stringsize,sizeof(stringsize));marshalled_dataset+=sizeof(stringsize);157 memcpy(marshalled_dataset,string,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);158 }159 160 *pmarshalled_dataset=marshalled_dataset;161 }162 /*}}}*/163 /*FUNCTION StringArrayParam::MarshallSize{{{1*/164 int StringArrayParam::MarshallSize(){165 166 int i;167 int marshallsize;168 int stringsize;169 char* string=NULL;170 171 marshallsize+=sizeof(numstrings);172 173 for(i=0;i<numstrings;i++){174 string=this->value[i];175 stringsize=strlen(string)+1;176 marshallsize+=sizeof(stringsize);177 marshallsize+=stringsize*sizeof(char);178 }179 180 marshallsize+=sizeof(enum_type);181 marshallsize+=sizeof(int); //sizeof(int) for enum value182 183 return marshallsize;184 }185 84 /*}}}*/ 186 85 /*FUNCTION StringArrayParam::MyRank{{{1*/ … … 190 89 } 191 90 /*}}}*/ 91 /*FUNCTION StringArrayParam::Marshall{{{1*/ 92 void StringArrayParam::Marshall(char** pmarshalled_dataset){ 93 94 int i; 95 char* marshalled_dataset=NULL; 96 int enum_value=0; 97 int stringsize; 98 char* string=NULL; 99 100 /*recover marshalled_dataset: */ 101 marshalled_dataset=*pmarshalled_dataset; 102 103 /*get enum value of StringArrayParam: */ 104 enum_value=StringArrayParamEnum; 105 106 /*marshall enum: */ 107 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value); 108 109 /*marshall data: */ 110 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 111 memcpy(marshalled_dataset,&numstrings,sizeof(numstrings));marshalled_dataset+=sizeof(numstrings); 112 for(i=0;i<numstrings;i++){ 113 string=this->value[i]; 114 stringsize=strlen(string)+1; 115 116 memcpy(marshalled_dataset,&stringsize,sizeof(stringsize));marshalled_dataset+=sizeof(stringsize); 117 memcpy(marshalled_dataset,string,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char); 118 } 119 120 *pmarshalled_dataset=marshalled_dataset; 121 } 122 /*}}}*/ 123 /*FUNCTION StringArrayParam::MarshallSize{{{1*/ 124 int StringArrayParam::MarshallSize(){ 125 126 int i; 127 int marshallsize; 128 int stringsize; 129 char* string=NULL; 130 131 marshallsize+=sizeof(numstrings); 132 133 for(i=0;i<numstrings;i++){ 134 string=this->value[i]; 135 stringsize=strlen(string)+1; 136 marshallsize+=sizeof(stringsize); 137 marshallsize+=stringsize*sizeof(char); 138 } 139 140 marshallsize+=sizeof(enum_type); 141 marshallsize+=sizeof(int); //sizeof(int) for enum value 142 143 return marshallsize; 144 } 145 /*}}}*/ 146 /*FUNCTION StringArrayParam::Demarshall{{{1*/ 147 void StringArrayParam::Demarshall(char** pmarshalled_dataset){ 148 149 char* marshalled_dataset=NULL; 150 int i; 151 int stringsize; 152 char* string=NULL; 153 154 /*recover marshalled_dataset: */ 155 marshalled_dataset=*pmarshalled_dataset; 156 157 /*this time, no need to get enum type, the pointer directly points to the beginning of the 158 *object data (thanks to DataSet::Demarshall):*/ 159 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 160 161 memcpy(&numstrings,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int); 162 this->value=(char**)xmalloc(numstrings*sizeof(char*)); 163 164 for(i=0;i<numstrings;i++){ 165 memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int); 166 167 string=(char*)xmalloc(stringsize*sizeof(char)); 168 memcpy(string,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char); 169 170 this->value[i]=string; 171 } 172 173 /*return: */ 174 *pmarshalled_dataset=marshalled_dataset; 175 return; 176 } 177 /*}}}*/ 178 /*FUNCTION StringArrayParam::Enum{{{1*/ 179 int StringArrayParam::Enum(void){ 180 181 return StringArrayParamEnum; 182 183 } 184 /*}}}*/ 185 /*FUNCTION StringArrayParam::copy{{{1*/ 186 Object* StringArrayParam::copy() { 187 188 return new StringArrayParam(this->enum_type,this->value,this->numstrings); 189 190 } 191 /*}}}*/ 192 193 /*StringArrayParam virtual functions definitions: */ 192 194 /*FUNCTION StringArrayParam::GetParameterValue(char*** pstringarray, int* pnumstrings){{{1*/ 193 195 void StringArrayParam::GetParameterValue(char*** pstringarray,int* pM){ -
issm/trunk/src/c/objects/Params/StringArrayParam.h
r4244 r4248 38 38 39 39 public: 40 /* constructors, destructors: {{{1*/40 /*StringArrayParam constructors, destructors: {{{1*/ 41 41 StringArrayParam(); 42 42 StringArrayParam(int enum_type,char** values, int numstrings); 43 43 ~StringArrayParam(); 44 44 /*}}}*/ 45 /*Object methods: {{{1*/46 Object* copy();45 /*Object virtual functions definitions:{{{1 */ 46 void Echo(); 47 47 void DeepEcho(); 48 void Demarshall(char** pmarshalled_dataset); 49 void Echo(); 50 int Enum(); 51 int Id(); 48 int Id(); 49 int MyRank(); 52 50 void Marshall(char** pmarshalled_dataset); 53 51 int MarshallSize(); 54 int MyRank(); 52 void Demarshall(char** pmarshalled_dataset); 53 int Enum(); 54 Object* copy(); 55 55 /*}}}*/ 56 /*Param methods: {{{1*/56 /*Param vritual function definitions: {{{1*/ 57 57 int EnumType(){return enum_type;} 58 58 void GetParameterValue(bool* pbool){ISSMERROR("StringArray param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));} … … 80 80 void SetMatlabField(mxArray* dataref); 81 81 #endif 82 83 82 /*}}}*/ 84 83 }; -
issm/trunk/src/c/objects/Params/StringParam.cpp
r4244 r4248 20 20 /*}}}*/ 21 21 22 /* Objectconstructors and destructor*/22 /*StringParam constructors and destructor*/ 23 23 /*FUNCTION StringParam::StringParam(){{{1*/ 24 24 StringParam::StringParam(){ … … 41 41 /*}}}*/ 42 42 43 /*Object methods*/ 44 /*FUNCTION StringParam::copy{{{1*/ 45 Object* StringParam::copy() { 46 47 return new StringParam(this->enum_type,this->value); 48 43 /*Object virtual functions definitions:*/ 44 /*FUNCTION StringParam::Echo {{{1*/ 45 void StringParam::Echo(void){ 46 this->DeepEcho(); 49 47 } 50 48 /*}}}*/ … … 57 55 } 58 56 /*}}}*/ 59 /*FUNCTION StringParam::Demarshall{{{1*/60 void StringParam::Demarshall(char** pmarshalled_dataset){61 62 char* marshalled_dataset=NULL;63 int i;64 int stringsize;65 66 /*recover marshalled_dataset: */67 marshalled_dataset=*pmarshalled_dataset;68 69 /*this time, no need to get enum type, the pointer directly points to the beginning of the70 *object data (thanks to DataSet::Demarshall):*/71 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);72 73 memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);74 75 this->value=(char*)xmalloc(stringsize*sizeof(char));76 memcpy(this->value,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);77 78 /*return: */79 *pmarshalled_dataset=marshalled_dataset;80 return;81 }82 /*}}}*/83 /*FUNCTION StringParam::Echo {{{1*/84 void StringParam::Echo(void){85 this->DeepEcho();86 }87 /*}}}*/88 /*FUNCTION StringParam::Enum{{{1*/89 int StringParam::Enum(void){90 91 return StringParamEnum;92 93 }94 /*}}}*/95 57 /*FUNCTION StringParam::Id{{{1*/ 96 58 int StringParam::Id(void){ return -1; } 59 /*}}}*/ 60 /*FUNCTION StringParam::MyRank{{{1*/ 61 int StringParam::MyRank(void){ 62 extern int my_rank; 63 return my_rank; 64 } 97 65 /*}}}*/ 98 66 /*FUNCTION StringParam::Marshall{{{1*/ … … 134 102 } 135 103 /*}}}*/ 136 /*FUNCTION StringParam::MyRank{{{1*/ 137 int StringParam::MyRank(void){ 138 extern int my_rank; 139 return my_rank; 104 /*FUNCTION StringParam::Demarshall{{{1*/ 105 void StringParam::Demarshall(char** pmarshalled_dataset){ 106 107 char* marshalled_dataset=NULL; 108 int i; 109 int stringsize; 110 111 /*recover marshalled_dataset: */ 112 marshalled_dataset=*pmarshalled_dataset; 113 114 /*this time, no need to get enum type, the pointer directly points to the beginning of the 115 *object data (thanks to DataSet::Demarshall):*/ 116 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 117 118 memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int); 119 120 this->value=(char*)xmalloc(stringsize*sizeof(char)); 121 memcpy(this->value,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char); 122 123 /*return: */ 124 *pmarshalled_dataset=marshalled_dataset; 125 return; 140 126 } 141 127 /*}}}*/ 128 /*FUNCTION StringParam::Enum{{{1*/ 129 int StringParam::Enum(void){ 130 131 return StringParamEnum; 132 133 } 134 /*}}}*/ 135 /*FUNCTION StringParam::copy{{{1*/ 136 Object* StringParam::copy() { 137 138 return new StringParam(this->enum_type,this->value); 139 140 } 141 /*}}}*/ 142 143 /*StringParam virtual functions definitions: */ 142 144 /*FUNCTION StringParam::GetParameterValue(char** pstring){{{1*/ 143 145 void StringParam::GetParameterValue(char** pstring){ -
issm/trunk/src/c/objects/Params/StringParam.h
r4244 r4248 36 36 37 37 public: 38 /* constructors, destructors: {{{1*/38 /*StringParam constructors, destructors: {{{1*/ 39 39 StringParam(); 40 40 StringParam(int enum_type,char* value); 41 41 ~StringParam(); 42 42 /*}}}*/ 43 /*Object methods: {{{1*/44 Object* copy();43 /*Object virtual functions definitions:{{{1 */ 44 void Echo(); 45 45 void DeepEcho(); 46 void Demarshall(char** pmarshalled_dataset); 47 void Echo(); 48 int Enum(); 49 int Id(); 46 int Id(); 47 int MyRank(); 50 48 void Marshall(char** pmarshalled_dataset); 51 49 int MarshallSize(); 52 int MyRank(); 50 void Demarshall(char** pmarshalled_dataset); 51 int Enum(); 52 Object* copy(); 53 53 /*}}}*/ 54 /*Param methods: {{{1*/54 /*Param vritual function definitions: {{{1*/ 55 55 int EnumType(){return enum_type;} 56 56 void GetParameterValue(bool* pbool){ISSMERROR("String param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));} -
issm/trunk/src/c/objects/Vertex.cpp
r4244 r4248 17 17 /*}}}*/ 18 18 19 /* Object constructors and destructor{{{1*/20 /*FUNCTION Vertex::Vertex() {{{ 2*/19 /*Vertex constructors and destructor:*/ 20 /*FUNCTION Vertex::Vertex() {{{1*/ 21 21 Vertex::Vertex(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION Vertex::Vertex(int vertex_id, double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){{{ 2*/25 /*FUNCTION Vertex::Vertex(int vertex_id, double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){{{1*/ 26 26 Vertex::Vertex(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){ 27 27 this->Init(vertex_id, vertex_sid,vertex_x, vertex_y, vertex_z, vertex_sigma); 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION Vertex::Init{{{ 2*/30 /*FUNCTION Vertex::Init{{{1*/ 31 31 void Vertex::Init(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){ 32 32 … … 43 43 } 44 44 /*}}}*/ 45 /*FUNCTION Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel) {{{ 2*/45 /*FUNCTION Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel) {{{1*/ 46 46 Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel){ 47 47 … … 50 50 } 51 51 /*}}}*/ 52 /*FUNCTION Vertex::~Vertex() {{{ 2*/52 /*FUNCTION Vertex::~Vertex() {{{1*/ 53 53 Vertex::~Vertex(){ 54 54 return; 55 55 } 56 56 /*}}}*/ 57 /*}}}*/ 58 /*Object management {{{1*/ 59 /*FUNCTION copy {{{2*/ 60 Object* Vertex::copy() { 61 62 return new Vertex(*this); 63 64 } 65 /*}}}*/ 66 /*FUNCTION DeepEcho{{{2*/ 67 68 void Vertex::DeepEcho(void){ 69 this->Echo(); 70 } 71 /*}}}*/ 72 /*FUNCTION Demarshall {{{2*/ 73 void Vertex::Demarshall(char** pmarshalled_dataset){ 74 75 char* marshalled_dataset=NULL; 76 int i; 77 78 /*recover marshalled_dataset: */ 79 marshalled_dataset=*pmarshalled_dataset; 80 81 /*this time, no need to get enum type, the pointer directly points to the beginning of the 82 *object data (thanks to DataSet::Demarshall):*/ 83 84 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 85 memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid); 86 memcpy(&x,marshalled_dataset,sizeof(x));marshalled_dataset+=sizeof(x); 87 memcpy(&y,marshalled_dataset,sizeof(y));marshalled_dataset+=sizeof(y); 88 memcpy(&z,marshalled_dataset,sizeof(z));marshalled_dataset+=sizeof(z); 89 memcpy(&sigma,marshalled_dataset,sizeof(sigma));marshalled_dataset+=sizeof(sigma); 90 memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof); 91 memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone); 92 93 /*return: */ 94 *pmarshalled_dataset=marshalled_dataset; 95 return; 96 } 97 /*}}}*/ 98 /*FUNCTION Echo{{{2*/ 99 57 58 /*Object virtual functions definitions:*/ 59 /*FUNCTION Echo{{{1*/ 100 60 void Vertex::Echo(void){ 101 61 … … 113 73 } 114 74 /*}}}*/ 115 /*FUNCTION Enum {{{2*/ 116 int Vertex::Enum(void){ 117 118 return VertexEnum; 119 120 } 121 /*}}}*/ 122 /*FUNCTION Id{{{2*/ 75 /*FUNCTION DeepEcho{{{1*/ 76 77 void Vertex::DeepEcho(void){ 78 this->Echo(); 79 } 80 /*}}}*/ 81 /*FUNCTION Id{{{1*/ 123 82 int Vertex::Id(void){ return id; } 124 83 /*}}}*/ 125 /*FUNCTION Sid{{{2*/ 126 int Vertex::Sid(void){ return sid; } 127 /*}}}*/ 128 /*FUNCTION Marshall {{{2*/ 84 /*FUNCTION MyRank {{{1*/ 85 int Vertex::MyRank(void){ 86 extern int my_rank; 87 return my_rank; 88 } 89 /*}}}*/ 90 /*FUNCTION Marshall {{{1*/ 129 91 void Vertex::Marshall(char** pmarshalled_dataset){ 130 92 … … 155 117 } 156 118 /*}}}*/ 157 /*FUNCTION MarshallSize {{{ 2*/119 /*FUNCTION MarshallSize {{{1*/ 158 120 int Vertex::MarshallSize(){ 159 121 … … 169 131 } 170 132 /*}}}*/ 171 /*FUNCTION MyRank {{{2*/ 172 int Vertex::MyRank(void){ 173 extern int my_rank; 174 return my_rank; 175 } 176 /*}}}*/ 177 /*FUNCTION UpdateFromDakota {{{2*/ 178 void Vertex::UpdateFromDakota(void* vinputs){ 179 180 ISSMERROR("not supported yet!"); 181 182 } 183 /*}}}*/ 184 /*FUNCTION UpdateVertexPosition {{{2*/ 185 void Vertex::UpdatePosition(double* thickness,double* bed){ 186 187 /*sigma remains constant. z=bed+sigma*thickness*/ 188 this->z=bed[dof]+sigma*thickness[this->dof]; 189 190 } 191 /*}}}*/ 192 /*}}}*/ 193 /* DofObject routines: {{{1*/ 194 /*FUNCTION Vertex DistributeDofs{{{2*/ 133 /*FUNCTION Demarshall {{{1*/ 134 void Vertex::Demarshall(char** pmarshalled_dataset){ 135 136 char* marshalled_dataset=NULL; 137 int i; 138 139 /*recover marshalled_dataset: */ 140 marshalled_dataset=*pmarshalled_dataset; 141 142 /*this time, no need to get enum type, the pointer directly points to the beginning of the 143 *object data (thanks to DataSet::Demarshall):*/ 144 145 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 146 memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid); 147 memcpy(&x,marshalled_dataset,sizeof(x));marshalled_dataset+=sizeof(x); 148 memcpy(&y,marshalled_dataset,sizeof(y));marshalled_dataset+=sizeof(y); 149 memcpy(&z,marshalled_dataset,sizeof(z));marshalled_dataset+=sizeof(z); 150 memcpy(&sigma,marshalled_dataset,sizeof(sigma));marshalled_dataset+=sizeof(sigma); 151 memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof); 152 memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone); 153 154 /*return: */ 155 *pmarshalled_dataset=marshalled_dataset; 156 return; 157 } 158 /*}}}*/ 159 /*FUNCTION Enum {{{1*/ 160 int Vertex::Enum(void){ 161 162 return VertexEnum; 163 164 } 165 /*}}}*/ 166 /*FUNCTION copy {{{1*/ 167 Object* Vertex::copy() { 168 169 return new Vertex(*this); 170 171 } 172 /*}}}*/ 173 174 /* DofObject routines: */ 175 /*FUNCTION Vertex DistributeDofs{{{1*/ 195 176 void Vertex::DistributeDofs(int* pdofcount){ 196 177 … … 215 196 } 216 197 /*}}}*/ 217 /*FUNCTION Vertex OffsetDofs{{{ 2*/198 /*FUNCTION Vertex OffsetDofs{{{1*/ 218 199 void Vertex::OffsetDofs(int dofcount){ 219 200 … … 230 211 } 231 212 /*}}}*/ 232 /*FUNCTION Vertex ShowTrueDofs{{{ 2*/213 /*FUNCTION Vertex ShowTrueDofs{{{1*/ 233 214 void Vertex::ShowTrueDofs(int* truedofs){ 234 215 … … 244 225 } 245 226 /*}}}*/ 246 /*FUNCTION Vertex UpdateCloneDofs{{{ 2*/227 /*FUNCTION Vertex UpdateCloneDofs{{{1*/ 247 228 void Vertex::UpdateCloneDofs(int* alltruedofs){ 248 229 … … 258 239 } 259 240 /*}}}*/ 260 /*FUNCTION Vertex SetClone {{{ 2*/241 /*FUNCTION Vertex SetClone {{{1*/ 261 242 void Vertex::SetClone(int* minranks){ 262 243 … … 274 255 } 275 256 /*}}}*/ 276 /*FUNCTION Vertex CreatePartition{{{ 2*/257 /*FUNCTION Vertex CreatePartition{{{1*/ 277 258 void Vertex::CreatePartition(Vec partition){ 278 259 … … 289 270 } 290 271 /*}}}*/ 291 /*}}}*/ 272 273 /*Vertex management: */ 274 /*FUNCTION Sid{{{1*/ 275 int Vertex::Sid(void){ return sid; } 276 /*}}}*/ 277 /*FUNCTION UpdateFromDakota {{{1*/ 278 void Vertex::UpdateFromDakota(void* vinputs){ 279 280 ISSMERROR("not supported yet!"); 281 282 } 283 /*}}}*/ 284 /*FUNCTION UpdateVertexPosition {{{1*/ 285 void Vertex::UpdatePosition(double* thickness,double* bed){ 286 287 /*sigma remains constant. z=bed+sigma*thickness*/ 288 this->z=bed[dof]+sigma*thickness[this->dof]; 289 290 } 291 /*}}}*/ 292 -
issm/trunk/src/c/objects/Vertex.h
r4244 r4248 32 32 int dof; //dof to recover values in a vertex indexed vector 33 33 34 /* FUNCTIONconstructors, destructors {{{1*/34 /*Vertex constructors, destructors {{{1*/ 35 35 Vertex(); 36 36 Vertex(int id, int sid,double x, double y, double z, double sigma); … … 39 39 ~Vertex(); 40 40 /*}}}*/ 41 /* FUNCTION object management {{{1*/42 Object* copy();41 /*Object virtual functions definitions:{{{1 */ 42 void Echo(); 43 43 void DeepEcho(); 44 void Demarshall(char** pmarshalled_dataset); 45 void Echo(); 46 int Enum(); 47 int Id(void); 48 int Sid(void); 44 int Id(); 45 int MyRank(); 49 46 void Marshall(char** pmarshalled_dataset); 50 47 int MarshallSize(); 51 int MyRank();52 void UpdateFromDakota(void* vinputs);53 void UpdatePosition(double* thickness,double* bed);48 void Demarshall(char** pmarshalled_dataset); 49 int Enum(); 50 Object* copy(); 54 51 /*}}}*/ 55 /* FUNCTIONDofObject routines {{{1*/52 /*DofObject routines {{{1*/ 56 53 void DistributeDofs(int* pdofcount); 57 54 void OffsetDofs(int dofcount); … … 61 58 void CreatePartition(Vec partition); 62 59 /*}}}*/ 63 60 /*Vertex management: {{{1*/ 61 int Sid(void); 62 void UpdateFromDakota(void* vinputs); 63 void UpdatePosition(double* thickness,double* bed); 64 /*}}}*/ 64 65 }; 65 66 #endif /* _VERTEX_H */
Note:
See TracChangeset
for help on using the changeset viewer.