Changeset 4248


Ignore:
Timestamp:
06/26/10 12:30:21 (15 years ago)
Author:
Eric.Larour
Message:

Better organization of header files for abstract classes and their derivatives

Location:
issm/trunk/src/c/objects
Files:
98 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Constraints/Rgb.cpp

    r4236 r4248  
    1818#include "../objects.h"
    1919
    20 /*Object constructors and destructor*/
     20/*Rgb constructors and destructor*/
    2121/*FUNCTION Rgb::constructor {{{1*/
    2222Rgb::Rgb(){
     
    4242/*}}}1*/
    4343               
    44 /*Object marshall*/
     44/*Object virtual functions definitions:*/
     45/*FUNCTION Rgb::Echo {{{1*/
     46void 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*/
     58void 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*/
     70int    Rgb::Id(void){ return id; }
     71/*}}}1*/
     72/*FUNCTION Rgb::MyRank {{{1*/
     73int    Rgb::MyRank(void){
     74        extern int my_rank;
     75        return my_rank;
     76}
     77/*}}}1*/
    4578/*FUNCTION Rgb::Marshall {{{1*/
    4679void  Rgb::Marshall(char** pmarshalled_dataset){
     
    102135}
    103136/*}}}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*/
    135137/*FUNCTION Rgb::Enum {{{1*/
    136138int Rgb::Enum(void){
     
    140142}
    141143/*}}}1*/
    142 /*FUNCTION Rgb::Id {{{1*/
    143 int    Rgb::Id(void){ return id; }
     144/*FUNCTION Rgb::copy {{{1*/
     145Object* Rgb::copy() {
     146        return new Rgb(*this);
     147}
    144148/*}}}1*/
     149
     150/*Rgb functions*/
    145151/*FUNCTION Rgb::GetNodeId1{{{1*/
    146152int   Rgb::GetNodeId1(){
     
    160166}
    161167/*}}}1*/
    162 /*FUNCTION Rgb::MyRank {{{1*/
    163 int    Rgb::MyRank(void){
    164         extern int my_rank;
    165         return my_rank;
    166 }
    167 /*}}}1*/
    168168/*FUNCTION Rgb::InAnalysis(int analysis_type){{{1*/
    169169bool Rgb::InAnalysis(int in_analysis_type){
  • issm/trunk/src/c/objects/Constraints/Rgb.h

    r4244 r4248  
    2323        public:
    2424
     25                /*Rgb constructors, destructors:{{{1*/
    2526                Rgb();
    2627                Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof,int analysis_type);
    2728                ~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*/
    3842                int    GetNodeId1();
    3943                int    GetNodeId2();
    4044                int    GetDof();
    41                 Object* copy();
    42                 bool  InAnalysis(int analysis_type);
     45                bool   InAnalysis(int analysis_type);
     46                /*}}}*/
    4347
    4448
  • issm/trunk/src/c/objects/Constraints/Spc.cpp

    r4236 r4248  
    1919
    2020               
    21 /*Object constructors and destructor*/
     21/*Spc constructors and destructor*/
    2222/*FUNCTION Spc::constructor {{{1*/
    2323Spc::Spc(){
     
    4343/*}}}1*/
    4444               
    45 /*Object marshall*/
     45/*Object virtual functions definitions:*/
     46/*FUNCTION Spc::Echo {{{1*/
     47void 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*/
     59void 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*/
     71int    Spc::Id(void){ return sid; }
     72/*}}}1*/
     73/*FUNCTION Spc::MyRank {{{1*/
     74int    Spc::MyRank(void){
     75        extern int my_rank;
     76        return my_rank;
     77}
     78/*}}}1*/
    4679/*FUNCTION Spc::Marshall {{{1*/
    4780void  Spc::Marshall(char** pmarshalled_dataset){
     
    103136}
    104137/*}}}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*/
    136138/*FUNCTION Spc::Enum {{{1*/
    137139int Spc::Enum(void){
     
    141143}
    142144/*}}}1*/
     145/*FUNCTION Spc::copy {{{1*/
     146Object* Spc::copy() {
     147        return new Spc(*this);
     148}
     149/*}}}1*/
     150
     151/*Spc functions*/
    143152/*FUNCTION Spc::GetDof {{{1*/
    144153int Spc::GetDof(){
    145154        return dof;
    146155}
    147 /*}}}1*/
    148 /*FUNCTION Spc::Id {{{1*/
    149 int    Spc::Id(void){ return sid; }
    150156/*}}}1*/
    151157/*FUNCTION Spc::GetNodeId {{{1*/
     
    160166}
    161167/*}}}1*/
    162 /*FUNCTION Spc::MyRank {{{1*/
    163 int    Spc::MyRank(void){
    164         extern int my_rank;
    165         return my_rank;
    166 }
    167 /*}}}1*/
    168168/*FUNCTION Spc::InAnalysis(int analysis_type){{{1*/
    169169bool Spc::InAnalysis(int in_analysis_type){
  • issm/trunk/src/c/objects/Constraints/Spc.h

    r4244 r4248  
    2323        public:
    2424
     25                /*Spc constructors, destructors:{{{1*/
    2526                Spc();
    2627                Spc(int sid,int nodeid, int dof,double value,int analysis_type);
    2728                ~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 */
    3742                int    GetNodeId();
    3843                int    GetDof();
    3944                double GetValue();
    40                 Object* copy();
    4145                bool    InAnalysis(int analysis_type);
    42 
    43 
     46                /*}}}*/
    4447
    4548};
  • issm/trunk/src/c/objects/DofIndexing.cpp

    r4236 r4248  
    1717#include "../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*DofIndexing constructors and destructor*/
    2020/*FUNCTION DofIndexing::DofIndexing(){{{1*/
    2121DofIndexing::DofIndexing(){
     
    6060}
    6161/*}}}*/
     62/*FUNCTION DofIndexing::Init{{{1*/
     63void DofIndexing::Init(int in_numberofdofs){
    6264
    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*/
     82void 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/*}}}*/
    6491/*FUNCTION DofIndexing::DeepEcho{{{1*/
    6592void DofIndexing::DeepEcho(void){
     
    112139}
    113140/*}}}*/
    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 /*}}}*/
    141141/*FUNCTION DofIndexing::Marshall{{{1*/
    142142void  DofIndexing::Marshall(char** pmarshalled_dataset){
  • issm/trunk/src/c/objects/DofIndexing.h

    r3969 r4248  
    2626                int     doflist[MAXDOFSPERNODE]; //dof list on which we solve
    2727
     28                /*DofIndexing constructors, destructors {{{1*/
    2829                DofIndexing();
    2930                DofIndexing(int numberofdofs);
     
    3132                DofIndexing(DofIndexing* properties);
    3233                ~DofIndexing();
    33                
     34                /*}}}*/
     35                /*Object like functionality: {{{1*/
     36                void  Echo(void);
     37                void  DeepEcho(void);
    3438                void  Marshall(char** pmarshalled_dataset);
    3539                int   MarshallSize();
    3640                void  Demarshall(char** pmarshalled_dataset);
    3741                void  copy(DofIndexing* properties);
    38                 void  Echo(void);
    39                 void  DeepEcho(void);
     42                /*}}}*/
     43                /*DofIndexing management: {{{1*/
    4044                DofIndexing* Spawn(int* indices, int numindices);
     45                /*}}}*/
    4146
    4247};
  • issm/trunk/src/c/objects/ElementResults/BeamVertexElementResult.cpp

    r4239 r4248  
    1818#include "../../include/include.h"
    1919
    20 /*Object constructors and destructor*/
     20/*BeamVertexElementResult constructors and destructor*/
    2121/*FUNCTION BeamVertexElementResult::BeamVertexElementResult(){{{1*/
    2222BeamVertexElementResult::BeamVertexElementResult(){
     
    4040/*}}}*/
    4141
    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*/
     44void BeamVertexElementResult::Echo(void){
     45        this->DeepEcho();
    4846}
    4947/*}}}*/
     
    5957}
    6058/*}}}*/
    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 the
    71          *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 /*}}}*/
    10159/*FUNCTION BeamVertexElementResult::Id{{{1*/
    10260int    BeamVertexElementResult::Id(void){ return -1; }
     61/*}}}*/
     62/*FUNCTION BeamVertexElementResult::MyRank{{{1*/
     63int    BeamVertexElementResult::MyRank(void){
     64        extern int my_rank;
     65        return my_rank;
     66}
    10367/*}}}*/
    10468/*FUNCTION BeamVertexElementResult::Marshall{{{1*/
     
    136100}
    137101/*}}}*/
    138 /*FUNCTION BeamVertexElementResult::MyRank{{{1*/
    139 int    BeamVertexElementResult::MyRank(void){
    140         extern int my_rank;
    141         return my_rank;
     102/*FUNCTION BeamVertexElementResult::Demarshall{{{1*/
     103void  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*/
     124int BeamVertexElementResult::Enum(void){
     125
     126        return BeamVertexElementResultEnum;
     127
     128}
     129/*}}}*/
     130/*FUNCTION BeamVertexElementResult::copy{{{1*/
     131Object* BeamVertexElementResult::copy() {
     132       
     133        return new BeamVertexElementResult(this->enum_type,this->values,this->step,this->time);
     134
    142135}
    143136/*}}}*/
    144137
    145 /*ElementResult functions*/
     138
     139/*ElementResult management*/
     140/*FUNCTION BeamVertexElementResult::EnumType{{{1*/
     141int BeamVertexElementResult::EnumType(void){
     142
     143        return this->enum_type;
     144
     145}
     146/*}}}*/
    146147/*FUNCTION BeamVertexElementResult::ProcessUnits(Parameters* parameters){{{1*/
    147148void BeamVertexElementResult::ProcessUnits(Parameters* parameters){
  • issm/trunk/src/c/objects/ElementResults/BeamVertexElementResult.h

    r4244 r4248  
    2323        public:
    2424
    25                 /*constructors, destructors: {{{1*/
     25                /*BeamVertexElementResult constructors, destructors: {{{1*/
    2626                BeamVertexElementResult();
    2727                BeamVertexElementResult(int enum_type,double* values,int step,double time);
    2828                ~BeamVertexElementResult();
    2929                /*}}}*/
    30                 /*object management: {{{1*/
     30                /*Object virtual functions definitions:{{{1 */
     31                void  Echo();
    3132                void  DeepEcho();
    32                 void  Echo();
    3333                int   Id();
     34                int   MyRank();
    3435                void  Marshall(char** pmarshalled_dataset);
    3536                int   MarshallSize();
    3637                void  Demarshall(char** pmarshalled_dataset);
    3738                int   Enum();
    38                 int   MyRank();
    3939                Object* copy();
    40                 int   EnumType();
    4140                /*}}}*/
    42                 /*result virtual functions: {{{1*/
     41                /*ElementResult virtual functions definitions: {{{1*/
    4342                ElementResult* SpawnSingElementResult(int  index){ISSMERROR("Not implemented yet!");}
    4443                ElementResult* SpawnBeamElementResult(int* indices){ISSMERROR("Not implemented yet!");}
     
    4847                void    PatchFill(int row, Patch* patch);
    4948                /*}}}*/
     49                /*BeamVertexElementResult management: {{{1*/
     50                int   EnumType();
     51                /*}}}*/
    5052
    5153};
  • issm/trunk/src/c/objects/ElementResults/DoubleElementResult.cpp

    r4239 r4248  
    1818#include "../../include/include.h"
    1919
    20 /*Object constructors and destructor*/
     20/*DoubleElementResult constructors and destructor*/
    2121/*FUNCTION DoubleElementResult::DoubleElementResult(){{{1*/
    2222DoubleElementResult::DoubleElementResult(){
     
    3939/*}}}*/
    4040
    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*/
     43void DoubleElementResult::Echo(void){
     44        this->DeepEcho();
    4745}
    4846/*}}}*/
     
    5553        printf("   step: %i\n",this->step);
    5654        printf("   time: %g\n",this->time);
     55}
     56/*}}}*/
     57/*FUNCTION DoubleElementResult::Id{{{1*/
     58int    DoubleElementResult::Id(void){ return -1; }
     59/*}}}*/
     60/*FUNCTION DoubleElementResult::MyRank{{{1*/
     61int    DoubleElementResult::MyRank(void){
     62        extern int my_rank;
     63        return my_rank;
     64}
     65/*}}}*/
     66/*FUNCTION DoubleElementResult::Marshall{{{1*/
     67void  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;
    5788}
    5889/*}}}*/
     
    78109}
    79110/*}}}*/
    80 /*FUNCTION DoubleElementResult::Echo {{{1*/
    81 void DoubleElementResult::Echo(void){
    82         this->DeepEcho();
    83 }
    84 /*}}}*/
    85111/*FUNCTION DoubleElementResult::Enum{{{1*/
    86112int DoubleElementResult::Enum(void){
     
    90116}
    91117/*}}}*/
    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*/
     119Object* DoubleElementResult::copy() {
     120
     121        return new DoubleElementResult(this->enum_type,this->value,this->step,this->time);
     122
     123}
     124/*}}}*/
     125
     126/*ElementResult management*/
    126127/*FUNCTION DoubleElementResult::MarshallSize{{{1*/
    127128int   DoubleElementResult::MarshallSize(){
     
    134135}
    135136/*}}}*/
    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*/
     138int DoubleElementResult::EnumType(void){
     139
     140        return this->enum_type;
     141
     142}
     143/*}}}*/
    144144/*FUNCTION DoubleElementResult::SpawnSingElementResult{{{1*/
    145145ElementResult* DoubleElementResult::SpawnSingElementResult(int index){
  • issm/trunk/src/c/objects/ElementResults/DoubleElementResult.h

    r4244 r4248  
    2525        public:
    2626
    27                 /*constructors, destructors: {{{1*/
     27                /*DoubleElementResult constructors, destructors: {{{1*/
    2828                DoubleElementResult();
    2929                DoubleElementResult(int enum_type,double value,int step,double time);
    3030                ~DoubleElementResult();
    3131                /*}}}*/
    32                 /*object management: {{{1*/
     32                /*Object virtual functions definitions:{{{1 */
     33                void  Echo();
    3334                void  DeepEcho();
    34                 void  Echo();
    3535                int   Id();
     36                int   MyRank();
    3637                void  Marshall(char** pmarshalled_dataset);
    3738                int   MarshallSize();
    3839                void  Demarshall(char** pmarshalled_dataset);
    3940                int   Enum();
    40                 int   MyRank();
    4141                Object* copy();
    42                 int   EnumType();
    4342                /*}}}*/
    44                 /*result virtual functions: {{{1*/
     43                /*ElementResult virtual functions definitions: {{{1*/
    4544                ElementResult* SpawnSingElementResult(int  index);
    4645                ElementResult* SpawnBeamElementResult(int* indices);
     
    5049                void    PatchFill(int row, Patch* patch);
    5150                /*}}}*/
    52 
     51                /*DoubleElementResult management: {{{1*/
     52                int   EnumType();
     53                /*}}}*/
    5354};
    5455#endif  /* _DOUBLEELEMENTRESULT_H */
  • issm/trunk/src/c/objects/ElementResults/ElementResult.h

    r4239 r4248  
    1818                virtual        ~ElementResult(){};
    1919               
    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;
    2523                virtual void    ProcessUnits(Parameters* parameters)=0;
    2624                virtual int     NumberOfNodalValues(void)=0;
  • issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.cpp

    r4239 r4248  
    1818#include "../../include/include.h"
    1919
    20 /*Object constructors and destructor*/
     20/*PentaVertexElementResult constructors and destructor*/
    2121/*FUNCTION PentaVertexElementResult::PentaVertexElementResult(){{{1*/
    2222PentaVertexElementResult::PentaVertexElementResult(){
     
    4141/*}}}*/
    4242
    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*/
     45void PentaVertexElementResult::Echo(void){
     46        this->DeepEcho();
    4947}
    5048/*}}}*/
     
    5856        printf("   time: %g\n",this->time);
    5957
     58}
     59/*}}}*/
     60/*FUNCTION PentaVertexElementResult::Id{{{1*/
     61int    PentaVertexElementResult::Id(void){ return -1; }
     62/*}}}*/
     63/*FUNCTION PentaVertexElementResult::MyRank{{{1*/
     64int    PentaVertexElementResult::MyRank(void){
     65        extern int my_rank;
     66        return my_rank;
     67}
     68/*}}}*/
     69/*FUNCTION PentaVertexElementResult::Marshall{{{1*/
     70void  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*/
     94int   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
    60101}
    61102/*}}}*/
     
    81122}
    82123/*}}}*/
    83 /*FUNCTION PentaVertexElementResult::Echo {{{1*/
    84 void PentaVertexElementResult::Echo(void){
    85         this->DeepEcho();
    86 }
    87 /*}}}*/
    88124/*FUNCTION PentaVertexElementResult::Enum{{{1*/
    89125int PentaVertexElementResult::Enum(void){
     
    93129}
    94130/*}}}*/
     131/*FUNCTION PentaVertexElementResult::copy{{{1*/
     132Object* PentaVertexElementResult::copy() {
     133       
     134        return new PentaVertexElementResult(this->enum_type,this->values,this->step,this->time);
     135
     136}
     137/*}}}*/
     138
     139
     140/*ElementResult management*/
    95141/*FUNCTION PentaVertexElementResult::EnumType{{{1*/
    96142int PentaVertexElementResult::EnumType(void){
     
    100146}
    101147/*}}}*/
    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 value
    137 }
    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*/
    147148/*FUNCTION PentaVertexElementResult::SpawnSingElementResult{{{1*/
    148149ElementResult* PentaVertexElementResult::SpawnSingElementResult(int index){
  • issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.h

    r4244 r4248  
    2424        public:
    2525
    26                 /*constructors, destructors: {{{1*/
     26                /*PentaVertexElementResult constructors, destructors: {{{1*/
    2727                PentaVertexElementResult();
    2828                PentaVertexElementResult(int enum_type,double* values,int step, double time);
    2929                ~PentaVertexElementResult();
    3030                /*}}}*/
    31                 /*object management: {{{1*/
     31                /*Object virtual functions definitions:{{{1 */
     32                void  Echo();
    3233                void  DeepEcho();
    33                 void  Echo();
    3434                int   Id();
     35                int   MyRank();
    3536                void  Marshall(char** pmarshalled_dataset);
    3637                int   MarshallSize();
    3738                void  Demarshall(char** pmarshalled_dataset);
    3839                int   Enum();
    39                 int   MyRank();
    4040                Object* copy();
    41                 int   EnumType();
    4241                /*}}}*/
    43                 /*result virtual functions: {{{1*/
     42                /*ElementResult virtual functions definitions: {{{1*/
    4443                ElementResult* SpawnSingElementResult(int  index);
    4544                ElementResult* SpawnBeamElementResult(int* indices);
     
    4948                void    PatchFill(int row, Patch* patch);
    5049                /*}}}*/
     50                /*PentaVertexElementResult management: {{{1*/
     51                int   EnumType();
     52                /*}}}*/
    5153
    5254};
  • issm/trunk/src/c/objects/ElementResults/SingVertexElementResult.cpp

    r4239 r4248  
    1818#include "../../include/include.h"
    1919
    20 /*Object constructors and destructor*/
     20/*SingVertexElementResult constructors and destructor*/
    2121/*FUNCTION SingVertexElementResult::SingVertexElementResult(){{{1*/
    2222SingVertexElementResult::SingVertexElementResult(){
     
    3939/*}}}*/
    4040
    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*/
     43void SingVertexElementResult::Echo(void){
     44        this->DeepEcho();
    4745}
    4846/*}}}*/
     
    5856}
    5957/*}}}*/
    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 the
    70          *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 /*}}}*/
    10058/*FUNCTION SingVertexElementResult::Id{{{1*/
    10159int    SingVertexElementResult::Id(void){ return -1; }
     60/*}}}*/
     61/*FUNCTION SingVertexElementResult::MyRank{{{1*/
     62int    SingVertexElementResult::MyRank(void){
     63        extern int my_rank;
     64        return my_rank;
     65}
    10266/*}}}*/
    10367/*FUNCTION SingVertexElementResult::Marshall{{{1*/
     
    13599}
    136100/*}}}*/
    137 /*FUNCTION SingVertexElementResult::MyRank{{{1*/
    138 int    SingVertexElementResult::MyRank(void){
    139         extern int my_rank;
    140         return my_rank;
     101/*FUNCTION SingVertexElementResult::Demarshall{{{1*/
     102void  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*/
     123int SingVertexElementResult::Enum(void){
     124
     125        return SingVertexElementResultEnum;
     126
     127}
     128/*}}}*/
     129/*FUNCTION SingVertexElementResult::copy{{{1*/
     130Object* SingVertexElementResult::copy() {
     131       
     132        return new SingVertexElementResult(this->enum_type,this->value,this->step,this->time);
     133
    141134}
    142135/*}}}*/
    143136
    144 /*ElementResult functions*/
     137/*ElementResult virtual functions definitions*/
    145138/*FUNCTION SingVertexElementResult::ProcessUnits(Parameters* parameters){{{1*/
    146139void SingVertexElementResult::ProcessUnits(Parameters* parameters){
     
    165158}
    166159/*}}}*/
     160
     161/*SingVertexElementResult management:*/
     162/*FUNCTION SingVertexElementResult::EnumType{{{1*/
     163int SingVertexElementResult::EnumType(void){
     164
     165        return this->enum_type;
     166
     167}
     168/*}}}*/
  • issm/trunk/src/c/objects/ElementResults/SingVertexElementResult.h

    r4244 r4248  
    2323        public:
    2424
    25                 /*constructors, destructors: {{{1*/
     25                /*SingVertexElementResult constructors, destructors: {{{1*/
    2626                SingVertexElementResult();
    2727                SingVertexElementResult(int enum_type,double value,int step,double time);
    2828                ~SingVertexElementResult();
    2929                /*}}}*/
    30                 /*object management: {{{1*/
     30                /*Object virtual functions definitions:{{{1 */
     31                void  Echo();
    3132                void  DeepEcho();
    32                 void  Echo();
    3333                int   Id();
     34                int   MyRank();
    3435                void  Marshall(char** pmarshalled_dataset);
    3536                int   MarshallSize();
    3637                void  Demarshall(char** pmarshalled_dataset);
    3738                int   Enum();
    38                 int   MyRank();
    3939                Object* copy();
    40                 int   EnumType();
    4140                /*}}}*/
    42                 /*result virtual functions: {{{1*/
     41                /*ElementResult virtual functions definitions: {{{1*/
    4342                ElementResult* SpawnSingElementResult(int  index){ISSMERROR("Not implemented yet!");}
    4443                ElementResult* SpawnBeamElementResult(int* indices){ISSMERROR("Not implemented yet!");}
     
    4847                void    PatchFill(int row, Patch* patch);
    4948                /*}}}*/
     49                /*SingVertexElementResult management: {{{1*/
     50                int   EnumType();
     51                /*}}}*/
    5052
    5153};
  • issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.cpp

    r4239 r4248  
    1818#include "../../include/include.h"
    1919
    20 /*Object constructors and destructor*/
     20/*TriaVertexElementResult constructors and destructor*/
    2121/*FUNCTION TriaVertexElementResult::TriaVertexElementResult(){{{1*/
    2222TriaVertexElementResult::TriaVertexElementResult(){
     
    4141/*}}}*/
    4242
    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*/
     45void TriaVertexElementResult::Echo(void){
     46        this->DeepEcho();
    4947}
    5048/*}}}*/
     
    5957}
    6058/*}}}*/
     59/*FUNCTION TriaVertexElementResult::Id{{{1*/
     60int    TriaVertexElementResult::Id(void){ return -1; }
     61/*}}}*/
     62/*FUNCTION TriaVertexElementResult::MyRank{{{1*/
     63int    TriaVertexElementResult::MyRank(void){
     64        extern int my_rank;
     65        return my_rank;
     66}
     67/*}}}*/
     68/*FUNCTION TriaVertexElementResult::Marshall{{{1*/
     69void  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*/
     94int   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/*}}}*/
    61103/*FUNCTION TriaVertexElementResult::Demarshall{{{1*/
    62104void  TriaVertexElementResult::Demarshall(char** pmarshalled_dataset){
     
    80122}
    81123/*}}}*/
    82 /*FUNCTION TriaVertexElementResult::Echo {{{1*/
    83 void TriaVertexElementResult::Echo(void){
    84         this->DeepEcho();
    85 }
    86 /*}}}*/
    87124/*FUNCTION TriaVertexElementResult::Enum{{{1*/
    88125int TriaVertexElementResult::Enum(void){
     
    92129}
    93130/*}}}*/
     131/*FUNCTION TriaVertexElementResult::copy{{{1*/
     132Object* TriaVertexElementResult::copy() {
     133       
     134        return new TriaVertexElementResult(this->enum_type,this->values,this->step,this->time);
     135
     136}
     137/*}}}*/
     138
     139
     140/*ElementResult management*/
    94141/*FUNCTION TriaVertexElementResult::EnumType{{{1*/
    95142int TriaVertexElementResult::EnumType(void){
     
    99146}
    100147/*}}}*/
    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 value
    137 }
    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*/
    147148/*FUNCTION TriaVertexElementResult::SpawnSingElementResult{{{1*/
    148149ElementResult* TriaVertexElementResult::SpawnSingElementResult(int index){
  • issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.h

    r4244 r4248  
    2323        public:
    2424
    25                 /*constructors, destructors: {{{1*/
     25                /*TriaVertexElementResult constructors, destructors: {{{1*/
    2626                TriaVertexElementResult();
    2727                TriaVertexElementResult(int enum_type,double* values,int step,double time);
    2828                ~TriaVertexElementResult();
    2929                /*}}}*/
    30                 /*object management: {{{1*/
     30                /*Object virtual functions definitions:{{{1 */
     31                void  Echo();
    3132                void  DeepEcho();
    32                 void  Echo();
    3333                int   Id();
     34                int   MyRank();
    3435                void  Marshall(char** pmarshalled_dataset);
    3536                int   MarshallSize();
    3637                void  Demarshall(char** pmarshalled_dataset);
    3738                int   Enum();
    38                 int   MyRank();
    3939                Object* copy();
    40                 int   EnumType();
    4140                /*}}}*/
    42                 /*result virtual functions: {{{1*/
     41                /*ElementResult virtual functions definitions: {{{1*/
    4342                ElementResult* SpawnSingElementResult(int  index);
    4443                ElementResult* SpawnBeamElementResult(int* indices);
     
    4847                void    PatchFill(int row, Patch* patch);
    4948                /*}}}*/
     49                /*TriaVertexElementResult management: {{{1*/
     50                int   EnumType();
     51                /*}}}*/
    5052
    5153};
  • issm/trunk/src/c/objects/Elements/Beam.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*Beam constructors and destructor*/
    2020/*FUNCTION Beam::Beam(){{{1*/
    2121Beam::Beam(){
     
    3737/*}}}*/
    3838
    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: */
    7540/*FUNCTION Beam::DeepEcho{{{1*/
    7641void Beam::DeepEcho(void){
     
    9358}
    9459/*}}}*/
     60/*FUNCTION Beam::Id{{{1*/
     61int    Beam::Id(void){ return id; }
     62/*}}}*/
     63/*FUNCTION Beam::MyRank{{{1*/
     64int    Beam::MyRank(void){
     65        extern int my_rank;
     66        return my_rank;
     67}
     68/*}}}*/
     69/*FUNCTION Beam::Marshall{{{1*/
     70void  Beam::Marshall(char** pmarshalled_dataset){
     71        ISSMERROR("not supported yet!");
     72}
     73/*}}}*/
     74/*FUNCTION Beam::MarshallSize{{{1*/
     75int   Beam::MarshallSize(){
     76        ISSMERROR("not supported yet!");
     77}
     78/*}}}*/
    9579/*FUNCTION Beam::Demarshall{{{1*/
    9680void  Beam::Demarshall(char** pmarshalled_dataset){
    9781        ISSMERROR("not supported yet!");
     82}
     83/*}}}*/
     84/*FUNCTION Beam::Enum{{{1*/
     85int Beam::Enum(void){
     86
     87        return BeamEnum;
     88
     89}
     90/*}}}*/
     91/*FUNCTION Beam::copy{{{1*/
     92Object* 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*/
     122void  Beam::Configure(Elements* elementsin,Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){
     123
     124        ISSMERROR(" not supported yet!");
     125
    98126}
    99127/*}}}*/
     
    125153        }
    126154        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!");
    137155}
    138156/*}}}*/
     
    442460}
    443461/*}}}*/
    444 /*FUNCTION Beam::Enum{{{1*/
    445 int Beam::Enum(void){
    446 
    447         return BeamEnum;
    448 
    449 }
    450 /*}}}*/
    451462/*FUNCTION Beam::GetBedList{{{1*/
    452463void  Beam::GetBedList(double*){
     
    483494}
    484495/*}}}*/
    485 /*FUNCTION Beam::Id{{{1*/
    486 int    Beam::Id(void){ return id; }
    487 /*}}}*/
    488496/*FUNCTION Beam::GetJacobianDeterminant{{{1*/
    489497void Beam::GetJacobianDeterminant(double* pJdet,double* z_list, double gauss_coord){
     
    580588double Beam::Misfit(void){
    581589        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;
    588590}
    589591/*}}}*/
  • issm/trunk/src/c/objects/Elements/Beam.h

    r4244 r4248  
    3737       
    3838
    39                 /*constructors, destructors: {{{1*/
     39                /*Beam constructors and destructor: {{{1*/
    4040                Beam();
    4141                ~Beam();
     
    4343                void  UpdateGeometry(void){ISSMERROR("not implemented yet");};
    4444                /*}}}*/
    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*/
    4746                void  Echo();
    4847                void  DeepEcho();
     48                int   Id();
     49                int   MyRank();
    4950                void  Marshall(char** pmarshalled_dataset);
    5051                int   MarshallSize();
    5152                void  Demarshall(char** pmarshalled_dataset);
    5253                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);
    5458                bool  IsInput(int name);
    55                 int   MyRank();
    56                 Object* copy();
    5759                void  SetClone(int* minranks);
    5860                void  InputDepthAverageAtBase(int enum_type,int average_enum_type){ISSMERROR("not implemented yet");};
  • issm/trunk/src/c/objects/Elements/Element.h

    r4244 r4248  
    2525               
    2626                virtual        ~Element(){};
     27       
    2728                virtual void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
    28                
    2929                virtual void   CreateKMatrix(Mat Kgg)=0;
    3030                virtual void   CreatePVector(Vec pg)=0;
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*Penta constructors and destructor*/
    2323/*FUNCTION Penta::Penta(){{{1*/
    2424Penta::Penta(){
     
    229229}
    230230/*}}}*/
    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
     235void Penta::Echo(void){
     236        this->DeepEcho();
    345237}
    346238/*}}}*/
     
    372264}
    373265/*}}}*/
    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*/
     267int    Penta::Id(void){
     268        return id;
     269}
     270/*}}}*/
     271/*FUNCTION Penta::MyRank {{{1*/
     272int    Penta::MyRank(void){
     273        extern int my_rank;
     274        return my_rank;
    385275}
    386276/*}}}*/
     
    455345                +numanalyses*sizeof(bool)
    456346                +sizeof(int); //sizeof(int) for enum type
     347}
     348/*}}}*/
     349/*FUNCTION Penta::Demarshall {{{1*/
     350void  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*/
     396int Penta::Enum(void){
     397
     398        return PentaEnum;
     399
     400}
     401/*}}}*/
     402/*FUNCTION Penta::copy {{{1*/
     403Object* 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*/
     449void  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;
    457471}
    458472/*}}}*/
     
    38203834        }
    38213835
    3822 }
    3823 /*}}}*/
    3824 /*FUNCTION Penta::Id {{{1*/
    3825 int    Penta::Id(void){
    3826         return id;
    38273836}
    38283837/*}}}*/
     
    46434652}
    46444653/*}}}*/
    4645 /*FUNCTION Penta::MyRank {{{1*/
    4646 int    Penta::MyRank(void){
    4647         extern int my_rank;
    4648         return my_rank;
    4649 }
    4650 /*}}}*/
    46514654/*FUNCTION Penta::ReduceMatrixStokes {{{1*/
    46524655void Penta::ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp){
  • issm/trunk/src/c/objects/Elements/Penta.h

    r4244 r4248  
    4141                bool        *collapse; //collapse elements, depending on analysis_type
    4242
    43                 /*FUNCTION constructors, destructors {{{1*/
     43                /*Penta constructors and destructor: {{{1*/
    4444                Penta();
    4545                Penta(int penta_id,int i, IoModel* iomodel,int nummodels);
     
    4848                ~Penta();
    4949                /*}}}*/
    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*/
    5162                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();
    5863                bool  IsInput(int name);
    5964                bool  IsOnSurface(void);
    6065                Penta* GetUpperElement(void);
    61                 void  Marshall(char** pmarshalled_dataset);
    62                 int   MarshallSize();
    63                 int   MyRank();
    6466                void* SpawnSing(int g0);
    6567                void* SpawnBeam(int g0, int g1);
  • issm/trunk/src/c/objects/Elements/Sing.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*Sing constructors and destructor*/
    2020/*FUNCTION Sing::Sing(){{{1*/
    2121Sing::Sing(){
     
    3737/*}}}*/
    3838
    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
     42void 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();
    7253}
    7354/*}}}*/
     
    8869}
    8970/*}}}*/
     71/*FUNCTION Sing::Id {{{1*/
     72int    Sing::Id(void){ return id; }
     73/*}}}*/
     74/*FUNCTION Sing::MyRank {{{1*/
     75int    Sing::MyRank(void){
     76        extern int my_rank;
     77        return my_rank;
     78}
     79/*}}}*/
     80/*FUNCTION Sing::Marshall {{{1*/
     81void  Sing::Marshall(char** pmarshalled_dataset){
     82        ISSMERROR(" not supported yet!");
     83}
     84/*}}}*/
     85/*FUNCTION Sing::MashallSize {{{1*/
     86int   Sing::MarshallSize(){
     87        ISSMERROR(" not supported yet!");
     88}
     89/*}}}*/
    9090/*FUNCTION Sing::Demarshall {{{1*/
    9191void  Sing::Demarshall(char** pmarshalled_dataset){
     
    9393}
    9494/*}}}*/
    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*/
     96int Sing::Enum(void){
     97
     98        return SingEnum;
     99
     100}
     101/*}}}*/
     102/*FUNCTION Sing::copy {{{1*/
     103Object* 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*/
     132void  Sing::Configure(Elements* elementsin,Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){
     133
     134        ISSMERROR(" not supported yet!");
     135
    108136}
    109137/*}}}*/
     
    117145}
    118146/*}}}*/
    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 /*}}}*/
    129147/*FUNCTION Sing::InputUpdateFromSolution {{{1*/
    130148void  Sing::InputUpdateFromSolution(double* solution){
     
    148166/*}}}*/
    149167               
    150 /*Object functions*/
     168/*Sing functions*/
    151169/*FUNCTION Sing::ComputeBasalStress {{{1*/
    152170void  Sing::ComputeBasalStress(Vec p_g){
     
    304322}
    305323/*}}}*/
    306 /*FUNCTION Sing::Enum {{{1*/
    307 int Sing::Enum(void){
    308 
    309         return SingEnum;
    310 
    311 }
    312 /*}}}*/
    313324/*FUNCTION Sing::GetBedList {{{1*/
    314325void  Sing::GetBedList(double*){
     
    341352}
    342353/*}}}*/
    343 /*FUNCTION Sing::Id {{{1*/
    344 int    Sing::Id(void){ return id; }
    345 /*}}}*/
    346354/*FUNCTION Sing::GetMatPar {{{1*/
    347355void* Sing::GetMatPar(){
     
    399407double Sing::Misfit(void){
    400408        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;
    407409}
    408410/*}}}*/
  • issm/trunk/src/c/objects/Elements/Sing.h

    r4244 r4248  
    3737
    3838
    39                 /*constructors, destructors: {{{1*/
     39                /*Sing constructors, destructors: {{{1*/
    4040                Sing();
    4141                ~Sing();
     
    4343                void  UpdateGeometry(void){ISSMERROR("not implemented yet");};
    4444                /*}}}*/
    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();
    4847                void  DeepEcho();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 void  Echo();
    51                 int   Enum();
    5248                int   Id();
    53                 bool  IsInput(int name);
     49                int   MyRank();
    5450                void  Marshall(char** pmarshalled_dataset);
    5551                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);
    5659                void  SetClone(int* minranks);
    57                 int   MyRank();
    5860                void  InputDepthAverageAtBase(int enum_type,int average_enum_type){ISSMERROR("not implemented yet");};
    5961                void  InputToResult(int enum_type,int step,double time);
     
    6971                void  InputUpdateFromSolution(double* solutiong);
    7072                /*}}}*/
    71 
    7273                /*numerics: {{{1*/
    7374                void  CreateKMatrix(Mat Kggg);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*Tria constructors and destructor*/
    2323/*FUNCTION Tria::Tria(){{{1*/
    2424Tria::Tria(){
     
    212212}
    213213/*}}}*/
    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:*/
    353216/*FUNCTION Tria::Echo{{{1*/
    354217void Tria::Echo(void){
     
    378241        if (results) results->Echo();
    379242        else printf("results=NULL\n");
     243}
     244/*}}}*/
     245/*FUNCTION Tria::DeepEcho{{{1*/
     246void 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*/
     278int    Tria::Id(){ return id; }
     279/*}}}*/
     280/*FUNCTION Tria::MyRank {{{1*/
     281int    Tria::MyRank(void){
     282        extern int my_rank;
     283        return my_rank;
    380284}
    381285/*}}}*/
     
    448352                +results->MarshallSize()
    449353                +sizeof(int); //sizeof(int) for enum type
     354}
     355/*}}}*/
     356/*FUNCTION Tria::Demarshall {{{1*/
     357void  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*/
     397int Tria::Enum(void){
     398
     399        return TriaEnum;
     400
     401}
     402/*}}}*/
     403/*FUNCTION Tria::copy {{{1*/
     404Object* 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*/
     447void  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
    450468}
    451469/*}}}*/
     
    36253643}
    36263644/*}}}*/
    3627 /*FUNCTION Tria::Enum {{{1*/
    3628 int Tria::Enum(void){
    3629 
    3630         return TriaEnum;
    3631 
    3632 }
    3633 /*}}}*/
    36343645/*FUNCTION Tria::GetArea {{{1*/
    36353646double Tria::GetArea(void){
     
    38613872
    38623873}
    3863 /*}}}*/
    3864 /*FUNCTION Tria::Id {{{1*/
    3865 int    Tria::Id(){ return id; }
    38663874/*}}}*/
    38673875/*FUNCTION Tria::GetJacobian {{{1*/
     
    49214929}
    49224930/*}}}*/
    4923 /*FUNCTION Tria::MyRank {{{1*/
    4924 int    Tria::MyRank(void){
    4925         extern int my_rank;
    4926         return my_rank;
    4927 }
    4928 /*}}}*/
    49294931/*FUNCTION Tria::Tria::SetClone {{{1*/
    49304932void  Tria::SetClone(int* minranks){
  • issm/trunk/src/c/objects/Elements/Tria.h

    r4244 r4248  
    3636                Results*  results;
    3737
    38                 /*FUNCTION constructors, destructors {{{1*/
     38                /*Tria constructors, destructors {{{1*/
    3939                Tria();
    4040                Tria(int tria_id,int i, IoModel* iomodel,int nummodels);
     
    4343                ~Tria();
    4444                /*}}}*/
    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*/
    4657                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);
    5358                bool  IsInput(int name);
    54                 void  Marshall(char** pmarshalled_dataset);
    55                 int   MarshallSize(void);
    56                 int   MyRank(void);
    5759                void  SetClone(int* minranks);
    5860                void  InputDepthAverageAtBase(int enum_type,int average_enum_type);
  • issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*BoolExternalResult constructors and destructor*/
    2323/*FUNCTION BoolExternalResult::BoolExternalResult(){{{1*/
    2424BoolExternalResult::BoolExternalResult(){
     
    4242/*}}}*/
    4343
    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*/
     46void BoolExternalResult::Echo(void){
     47        this->DeepEcho();
    5048}
    5149/*}}}*/
     
    5957        printf("   step: %i\n",this->step);
    6058        printf("   time: %g\n",this->time);
     59}
     60/*}}}*/
     61/*FUNCTION BoolExternalResult::Id{{{1*/
     62int    BoolExternalResult::Id(void){ return -1; }
     63/*}}}*/
     64/*FUNCTION BoolExternalResult::MyRank{{{1*/
     65int    BoolExternalResult::MyRank(void){
     66        extern int my_rank;
     67        return my_rank;
     68}
     69/*}}}*/
     70/*FUNCTION BoolExternalResult::Marshall{{{1*/
     71void  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*/
     96int   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
    61104}
    62105/*}}}*/
     
    83126}
    84127/*}}}*/
    85 /*FUNCTION BoolExternalResult::Echo {{{1*/
    86 void BoolExternalResult::Echo(void){
    87         this->DeepEcho();
    88 }
    89 /*}}}*/
    90128/*FUNCTION BoolExternalResult::Enum{{{1*/
    91129int BoolExternalResult::Enum(void){
     
    95133}
    96134/*}}}*/
    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*/
     136Object* 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: */
    144144/*FUNCTION BoolExternalResult::WriteData(FILE* fid) {{{1*/
    145145void   BoolExternalResult::WriteData(FILE* fid){
  • issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.h

    r4244 r4248  
    3737                double time;
    3838
    39 
    40                 /*constructors, destructors: {{{1*/
     39                /*BoolExternalResult constructors, destructors: {{{1*/
    4140                BoolExternalResult();
    4241                BoolExternalResult(int id, int enum_type,bool value,int step,double time);
    4342                ~BoolExternalResult();
    44 
    4543                /*}}}*/
    46                 /*Object methods: {{{1*/
    47                 Object* copy();
     44                /*Object virtual functions definitions:{{{1 */
     45                void  Echo();
    4846                void  DeepEcho();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 void  Echo();
    51                 int   Enum();
    52                 int   Id();
     47                int   Id();
     48                int   MyRank();
    5349                void  Marshall(char** pmarshalled_dataset);
    5450                int   MarshallSize();
    55                 int   MyRank();
     51                void  Demarshall(char** pmarshalled_dataset);
     52                int   Enum();
     53                Object* copy();
    5654                /*}}}*/
    57                 /*ExternalResult methods: {{{1*/
     55                /*ExternalResult management: {{{1*/
    5856                int   EnumType(){return enum_type;}
    5957                void  WriteData(FILE* fid);
  • issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*DoubleExternalResult constructors and destructor*/
    2323/*FUNCTION DoubleExternalResult::DoubleExternalResult(){{{1*/
    2424DoubleExternalResult::DoubleExternalResult(){
     
    4242/*}}}*/
    4343
    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*/
     46void DoubleExternalResult::Echo(void){
     47        this->DeepEcho();
    5048}
    5149/*}}}*/
     
    6159}
    6260/*}}}*/
    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 the
    73          *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 /*}}}*/
    9761/*FUNCTION DoubleExternalResult::Id{{{1*/
    9862int    DoubleExternalResult::Id(void){ return -1; }
     63/*}}}*/
     64/*FUNCTION DoubleExternalResult::MyRank{{{1*/
     65int    DoubleExternalResult::MyRank(void){
     66        extern int my_rank;
     67        return my_rank;
     68}
    9969/*}}}*/
    10070/*FUNCTION DoubleExternalResult::Marshall{{{1*/
     
    134104}
    135105/*}}}*/
    136 /*FUNCTION DoubleExternalResult::MyRank{{{1*/
    137 int    DoubleExternalResult::MyRank(void){
    138         extern int my_rank;
    139         return my_rank;
     106/*FUNCTION DoubleExternalResult::Demarshall{{{1*/
     107void  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*/
     129int DoubleExternalResult::Enum(void){
     130
     131        return DoubleExternalResultEnum;
     132
     133}
     134/*}}}*/
     135/*FUNCTION DoubleExternalResult::copy{{{1*/
     136Object* DoubleExternalResult::copy() {
     137       
     138        return new DoubleExternalResult(this->id,this->enum_type,this->value,this->step,this->time);
     139
    140140}
    141141/*}}}*/
    142142
    143 /*Numerics: */
     143/*DoubleExternalResult management: */
    144144/*FUNCTION DoubleExternalResult::WriteData(FILE* fid) {{{1*/
    145145void   DoubleExternalResult::WriteData(FILE* fid){
  • issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.h

    r4244 r4248  
    3838
    3939
    40                 /*constructors, destructors: {{{1*/
     40                /*DoubleExternalResult constructors, destructors: {{{1*/
    4141                DoubleExternalResult();
    4242                DoubleExternalResult(int id,int enum_type,double value,int step,double time);
    4343                ~DoubleExternalResult();
    44 
    4544                /*}}}*/
    46                 /*Object methods: {{{1*/
    47                 Object* copy();
     45                /*Object virtual functions definitions:{{{1 */
     46                void  Echo();
    4847                void  DeepEcho();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 void  Echo();
    51                 int   Enum();
    52                 int   Id();
     48                int   Id();
     49                int   MyRank();
    5350                void  Marshall(char** pmarshalled_dataset);
    5451                int   MarshallSize();
    55                 int   MyRank();
     52                void  Demarshall(char** pmarshalled_dataset);
     53                int   Enum();
     54                Object* copy();
    5655                /*}}}*/
    57                 /*ExternalResult methods: {{{1*/
     56                /*ExternalResult management: {{{1*/
    5857                int   EnumType(){return enum_type;}
    5958                void  WriteData(FILE* fid);
  • issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*DoubleMatExternalResult constructors and destructor*/
    2323/*FUNCTION DoubleMatExternalResult::DoubleMatExternalResult(){{{1*/
    2424DoubleMatExternalResult::DoubleMatExternalResult(){
     
    5353/*}}}*/
    5454
    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*/
     66void 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);
    6073
    6174}
     
    8396}
    8497/*}}}*/
    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 the
    95          *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 /*}}}*/
    13098/*FUNCTION DoubleMatExternalResult::Id{{{1*/
    13199int    DoubleMatExternalResult::Id(void){ return -1; }
     100/*}}}*/
     101/*FUNCTION DoubleMatExternalResult::MyRank{{{1*/
     102int    DoubleMatExternalResult::MyRank(void){
     103        extern int my_rank;
     104        return my_rank;
     105}
    132106/*}}}*/
    133107/*FUNCTION DoubleMatExternalResult::Marshall{{{1*/
     
    171145}
    172146/*}}}*/
    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*/
     148void  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*/
     175int DoubleMatExternalResult::Enum(void){
     176
     177        return DoubleMatExternalResultEnum;
     178
     179}
     180/*}}}*/
     181/*FUNCTION DoubleMatExternalResult::copy{{{1*/
     182Object* 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: */
    181190/*FUNCTION DoubleMatExternalResult::WriteData(FILE* fid) {{{1*/
    182191void   DoubleMatExternalResult::WriteData(FILE* fid){
  • issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.h

    r4244 r4248  
    3939
    4040        public:
    41                 /*constructors, destructors: {{{1*/
     41                /*DoubleMatExternalResult constructors, destructors: {{{1*/
    4242                DoubleMatExternalResult();
    4343                DoubleMatExternalResult(int id,int enum_type,double* values,int M,int N,int step, double time);
    4444                ~DoubleMatExternalResult();
    4545                /*}}}*/
    46                 /*Object methods: {{{1*/
    47                 Object* copy();
     46                /*Object virtual functions definitions:{{{1 */
     47                void  Echo();
    4848                void  DeepEcho();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 void  Echo();
    51                 int   Enum();
    52                 int   Id();
     49                int   Id();
     50                int   MyRank();
    5351                void  Marshall(char** pmarshalled_dataset);
    5452                int   MarshallSize();
    55                 int   MyRank();
     53                void  Demarshall(char** pmarshalled_dataset);
     54                int   Enum();
     55                Object* copy();
    5656                /*}}}*/
    57                 /*ExternalResult methods: {{{1*/
     57                /*ExternalResult managemnet: {{{1*/
    5858                int   EnumType(){return enum_type;}
    5959                void  WriteData(FILE* fid);
  • issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*DoubleVecExternalResult constructors and destructor*/
    2323/*FUNCTION DoubleVecExternalResult::DoubleVecExternalResult(){{{1*/
    2424DoubleVecExternalResult::DoubleVecExternalResult(){
     
    5050/*}}}*/
    5151
    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*/
     54void 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);
    5761
    5862}
     
    7478}
    7579/*}}}*/
    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 the
    86          *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 /*}}}*/
    12080/*FUNCTION DoubleVecExternalResult::Id{{{1*/
    12181int    DoubleVecExternalResult::Id(void){ return -1; }
     82/*}}}*/
     83/*FUNCTION DoubleVecExternalResult::MyRank{{{1*/
     84int    DoubleVecExternalResult::MyRank(void){
     85        extern int my_rank;
     86        return my_rank;
     87}
    12288/*}}}*/
    12389/*FUNCTION DoubleVecExternalResult::Marshall{{{1*/
     
    159125}
    160126/*}}}*/
    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*/
     128void  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*/
     154int DoubleVecExternalResult::Enum(void){
     155
     156        return DoubleVecExternalResultEnum;
     157
     158}
     159/*}}}*/
     160/*FUNCTION DoubleVecExternalResult::copy{{{1*/
     161Object* 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: */
    169169/*FUNCTION DoubleVecExternalResult::WriteData(FILE* fid) {{{1*/
    170170void   DoubleVecExternalResult::WriteData(FILE* fid){
  • issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.h

    r4244 r4248  
    3838
    3939        public:
    40                 /*constructors, destructors: {{{1*/
     40                /*DoubleVecExternalResult constructors, destructors: {{{1*/
    4141                DoubleVecExternalResult();
    4242                DoubleVecExternalResult(int id,int enum_type,double* values,int M,int step, double time);
    4343                ~DoubleVecExternalResult();
    4444                /*}}}*/
    45                 /*Object methods: {{{1*/
    46                 Object* copy();
     45                /*Object virtual functions definitions:{{{1 */
     46                void  Echo();
    4747                void  DeepEcho();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 void  Echo();
    50                 int   Enum();
    51                 int   Id();
     48                int   Id();
     49                int   MyRank();
    5250                void  Marshall(char** pmarshalled_dataset);
    5351                int   MarshallSize();
    54                 int   MyRank();
     52                void  Demarshall(char** pmarshalled_dataset);
     53                int   Enum();
     54                Object* copy();
    5555                /*}}}*/
    56                 /*ExternalResult methods: {{{1*/
     56                /*ExternalResult management: {{{1*/
    5757                int   EnumType(){return enum_type;}
    5858                void  WriteData(FILE* fid);
  • issm/trunk/src/c/objects/ExternalResults/ExternalResult.h

    r4182 r4248  
    2929               
    3030                virtual        ~ExternalResult(){};
    31 
    32                 /*methods:{{{1*/
     31                /*Virtual functions:{{{1*/
    3332                virtual int   EnumType()=0;
    3433                virtual void  WriteData(FILE* fid)=0;
  • issm/trunk/src/c/objects/ExternalResults/IntExternalResult.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*IntExternalResult constructors and destructor*/
    2323/*FUNCTION IntExternalResult::IntExternalResult(){{{1*/
    2424IntExternalResult::IntExternalResult(){
     
    4242/*}}}*/
    4343
    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*/
     55void IntExternalResult::Echo(void){
     56        this->DeepEcho();
    5057}
    5158/*}}}*/
     
    5966        printf("   step: %i\n",this->step);
    6067        printf("   time: %g\n",this->time);
     68}
     69/*}}}*/
     70/*FUNCTION IntExternalResult::Id{{{1*/
     71int    IntExternalResult::Id(void){ return -1; }
     72/*}}}*/
     73/*FUNCTION IntExternalResult::MyRank{{{1*/
     74int    IntExternalResult::MyRank(void){
     75        extern int my_rank;
     76        return my_rank;
     77}
     78/*}}}*/
     79/*FUNCTION IntExternalResult::Marshall{{{1*/
     80void  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*/
     105int   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
    61113}
    62114/*}}}*/
     
    83135}
    84136/*}}}*/
    85 /*FUNCTION IntExternalResult::Echo {{{1*/
    86 void IntExternalResult::Echo(void){
    87         this->DeepEcho();
    88 }
    89 /*}}}*/
    90137/*FUNCTION IntExternalResult::Enum{{{1*/
    91138int IntExternalResult::Enum(void){
     
    95142}
    96143/*}}}*/
    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*/
     145Object* 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: */
    144153/*FUNCTION IntExternalResult::WriteData(FILE* fid) {{{1*/
    145154void   IntExternalResult::WriteData(FILE* fid){
  • issm/trunk/src/c/objects/ExternalResults/IntExternalResult.h

    r4244 r4248  
    3838
    3939
    40                 /*constructors, destructors: {{{1*/
     40                /*IntExternalResult constructors, destructors: {{{1*/
    4141                IntExternalResult();
    4242                IntExternalResult(int id,int enum_type,int value,int step,double time);
     
    4444
    4545                /*}}}*/
    46                 /*Object methods: {{{1*/
    47                 Object* copy();
     46                /*Object virtual functions definitions:{{{1 */
     47                void  Echo();
    4848                void  DeepEcho();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 void  Echo();
    51                 int   Enum();
    52                 int   Id();
     49                int   Id();
     50                int   MyRank();
    5351                void  Marshall(char** pmarshalled_dataset);
    5452                int   MarshallSize();
    55                 int   MyRank();
     53                void  Demarshall(char** pmarshalled_dataset);
     54                int   Enum();
     55                Object* copy();
    5656                /*}}}*/
    57                 /*ExternalResult methods: {{{1*/
     57                /*ExternalResult managemnet: {{{1*/
    5858                int   EnumType(){return enum_type;}
    5959                void  WriteData(FILE* fid);
  • issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*PetscVecExternalResult constructors and destructor*/
    2323/*FUNCTION PetscVecExternalResult::PetscVecExternalResult(){{{1*/
    2424PetscVecExternalResult::PetscVecExternalResult(){
     
    5050/*}}}*/
    5151
    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*/
     54void PetscVecExternalResult::Echo(void){
     55
     56        printf("PetscVecExternalResult:\n");
     57        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5758
    5859}
     
    7071}
    7172/*}}}*/
    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 the
    85          *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 /*}}}*/
    13573/*FUNCTION PetscVecExternalResult::Id{{{1*/
    13674int    PetscVecExternalResult::Id(void){ return -1; }
     75/*}}}*/
     76/*FUNCTION PetscVecExternalResult::MyRank{{{1*/
     77int    PetscVecExternalResult::MyRank(void){
     78        extern int my_rank;
     79        return my_rank;
     80}
    13781/*}}}*/
    13882/*FUNCTION PetscVecExternalResult::Marshall{{{1*/
     
    190134}
    191135/*}}}*/
    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*/
     137void  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*/
     185int PetscVecExternalResult::Enum(void){
     186
     187        return PetscVecExternalResultEnum;
     188
     189}
     190/*}}}*/
     191/*FUNCTION PetscVecExternalResult::copy{{{1*/
     192Object* 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: */
    200200/*FUNCTION PetscVecExternalResult::WriteData(FILE* fid) {{{1*/
    201201void   PetscVecExternalResult::WriteData(FILE* fid){
  • issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.h

    r4244 r4248  
    3838
    3939        public:
    40                 /*constructors, destructors: {{{1*/
     40                /*PetscVecExternalResult constructors, destructors: {{{1*/
    4141                PetscVecExternalResult();
    4242                PetscVecExternalResult(int id,int enum_type,Vec value, int step, double time);
    4343                ~PetscVecExternalResult();
    4444                /*}}}*/
    45                 /*Object methods: {{{1*/
    46                 Object* copy();
     45                /*Object virtual functions definitions:{{{1 */
     46                void  Echo();
    4747                void  DeepEcho();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 void  Echo();
    50                 int   Enum();
    51                 int   Id();
     48                int   Id();
     49                int   MyRank();
    5250                void  Marshall(char** pmarshalled_dataset);
    5351                int   MarshallSize();
    54                 int   MyRank();
     52                void  Demarshall(char** pmarshalled_dataset);
     53                int   Enum();
     54                Object* copy();
    5555                /*}}}*/
    56                 /*ExternalResult methods: {{{1*/
     56                /*ExternalResult management: {{{1*/
    5757                int   EnumType(){return enum_type;}
    5858                void  WriteData(FILE* fid);
  • issm/trunk/src/c/objects/ExternalResults/StringExternalResult.cpp

    r4236 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*StringExternalResult constructors and destructor*/
    2323/*FUNCTION StringExternalResult::StringExternalResult(){{{1*/
    2424StringExternalResult::StringExternalResult(){
     
    4444/*}}}*/
    4545
    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*/
     48void StringExternalResult::Echo(void){
     49        this->DeepEcho();
    5250}
    5351/*}}}*/
     
    6361}
    6462/*}}}*/
    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 the
    76          *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 /*}}}*/
    10463/*FUNCTION StringExternalResult::Id{{{1*/
    10564int    StringExternalResult::Id(void){ return -1; }
     65/*}}}*/
     66/*FUNCTION StringExternalResult::MyRank{{{1*/
     67int    StringExternalResult::MyRank(void){
     68        extern int my_rank;
     69        return my_rank;
     70}
    10671/*}}}*/
    10772/*FUNCTION StringExternalResult::Marshall{{{1*/
     
    149114}
    150115/*}}}*/
    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*/
     117void  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*/
     144int StringExternalResult::Enum(void){
     145
     146        return StringExternalResultEnum;
     147
     148}
     149/*}}}*/
     150/*FUNCTION StringExternalResult::copy{{{1*/
     151Object* 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: */
    159159/*FUNCTION StringExternalResult::WriteData(FILE* fid) {{{1*/
    160160void   StringExternalResult::WriteData(FILE* fid){
  • issm/trunk/src/c/objects/ExternalResults/StringExternalResult.h

    r4244 r4248  
    3838
    3939        public:
    40                 /*constructors, destructors: {{{1*/
     40                /*StringExternalResult constructors, destructors: {{{1*/
    4141                StringExternalResult();
    4242                StringExternalResult(int id,int enum_type,char* value,int step, double time);
    4343                ~StringExternalResult();
    4444                /*}}}*/
    45                 /*Object methods: {{{1*/
    46                 Object* copy();
     45                /*Object virtual functions definitions:{{{1 */
     46                void  Echo();
    4747                void  DeepEcho();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 void  Echo();
    50                 int   Enum();
    51                 int   Id();
     48                int   Id();
     49                int   MyRank();
    5250                void  Marshall(char** pmarshalled_dataset);
    5351                int   MarshallSize();
    54                 int   MyRank();
     52                void  Demarshall(char** pmarshalled_dataset);
     53                int   Enum();
     54                Object* copy();
    5555                /*}}}*/
    56                 /*ExternalResult methods: {{{1*/
     56                /*ExternalResult management: {{{1*/
    5757                int   EnumType(){return enum_type;}
    5858                void  WriteData(FILE* fid);
  • issm/trunk/src/c/objects/Hook.cpp

    r4236 r4248  
    104104}
    105105/*}}}*/
    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 /*}}}*/
    134106/*FUNCTION Hook::~Hook(){{{1*/
    135107Hook::~Hook(){
     
    142114/*}}}*/
    143115
    144 /*Object marshalling*/
     116/*Some of the Object functionality: */
     117/*FUNCTION Hook::Echo{{{1*/
     118void 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*/
     141void 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/*}}}*/
    145171/*FUNCTION Hook::Marshall{{{1*/
    146172void Hook::Marshall(char** pmarshalled_dataset){
     
    226252}
    227253/*}}}*/
    228 
    229 /*Object processing: */
     254/*FUNCTION Hook::copy(Hook* input) {{{1*/
     255void 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: */
    230284/*FUNCTION Hook::configure{{{1*/
    231285void Hook::configure(DataSet* dataset){
     
    270324}
    271325/*}}}*/
    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*/
    328326/*FUNCTION Hook::delivers{{{1*/
    329327Object* Hook::delivers(void){
  • issm/trunk/src/c/objects/Hook.h

    r3791 r4248  
    2626        public:
    2727
     28                /*Hook constructors, destructors: {{{*/
    2829                Hook();
    2930                Hook(int* ids, int num);
     
    3132                Hook(Object** objects, int* ids, int* offsets,int num);
    3233                Hook(Hook* hook);
    33                 void copy(Hook* hook);
    3434                ~Hook();
     35                /*}}}*/
     36                /*Object like functionality:{{{1*/
     37                void       Echo(void);
     38                void       DeepEcho(void);
    3539                void       Marshall(char** pmarshalled_dataset);
    3640                int        MarshallSize();
    3741                void       Demarshall(char** pmarshalled_dataset);
     42                void       copy(Hook* hook);
     43                /*}}}*/
     44                /*Hook management: {{{1*/
    3845                Object*    delivers(void); //single object deliver
    3946                Object**   deliverp(void); //deliver all objects
    4047                void       configure(DataSet* dataset);
    41                 void       Echo(void);
    42                 void       DeepEcho(void);
    4348                Hook*      Spawn(int* indices, int numindices);
    4449                Object**   GetObjects(void);
     
    4651                int*       GetOffsets(void);
    4752                int        GetNum(void);
    48 
    49 
     53                /*}}}*/
    5054};
    5155
  • issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*BeamVertexInput constructors and destructor*/
    2020/*FUNCTION BeamVertexInput::BeamVertexInput(){{{1*/
    2121BeamVertexInput::BeamVertexInput(){
     
    3737/*}}}*/
    3838
    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*/
     41void BeamVertexInput::Echo(void){
     42        this->DeepEcho();
    4543}
    4644/*}}}*/
     
    5149        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5250        printf("   values: [%g %g]\n",this->values[0],this->values[1]);
     51}
     52/*}}}*/
     53/*FUNCTION BeamVertexInput::Id{{{1*/
     54int    BeamVertexInput::Id(void){ return -1; }
     55/*}}}*/
     56/*FUNCTION BeamVertexInput::MyRank{{{1*/
     57int    BeamVertexInput::MyRank(void){
     58        extern int my_rank;
     59        return my_rank;
     60}
     61/*}}}*/
     62/*FUNCTION BeamVertexInput::Marshall{{{1*/
     63void  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*/
     85int   BeamVertexInput::MarshallSize(){
     86       
     87        return sizeof(values)+
     88                +sizeof(enum_type)+
     89                +sizeof(int); //sizeof(int) for enum_value
    5390}
    5491/*}}}*/
     
    72109}
    73110/*}}}*/
    74 /*FUNCTION BeamVertexInput::Echo {{{1*/
    75 void BeamVertexInput::Echo(void){
    76         this->DeepEcho();
    77 }
    78 /*}}}*/
    79111/*FUNCTION BeamVertexInput::Enum{{{1*/
    80112int BeamVertexInput::Enum(void){
     
    84116}
    85117/*}}}*/
     118/*FUNCTION BeamVertexInput::copy{{{1*/
     119Object* BeamVertexInput::copy() {
     120       
     121        return new BeamVertexInput(this->enum_type,this->values);
     122
     123}
     124/*}}}*/
     125       
     126/*BeamVertexInput management*/
    86127/*FUNCTION BeamVertexInput::EnumType{{{1*/
    87128int BeamVertexInput::EnumType(void){
     
    89130        return this->enum_type;
    90131
    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_value
    124 }
    125 /*}}}*/
    126 /*FUNCTION BeamVertexInput::MyRank{{{1*/
    127 int    BeamVertexInput::MyRank(void){
    128         extern int my_rank;
    129         return my_rank;
    130132}
    131133/*}}}*/
  • issm/trunk/src/c/objects/Inputs/BeamVertexInput.h

    r4244 r4248  
    2020                double values[2];
    2121
    22                 /*constructors, destructors: {{{1*/
     22                /*BeamVertexInput constructors, destructors: {{{1*/
    2323                BeamVertexInput();
    2424                BeamVertexInput(int enum_type,double* values);
    2525                ~BeamVertexInput();
    2626                /*}}}*/
    27                 /*object management: {{{1*/
     27                /*Object virtual functions definitions:{{{1 */
     28                void  Echo();
    2829                void  DeepEcho();
    29                 void  Echo();
    3030                int   Id();
     31                int   MyRank();
    3132                void  Marshall(char** pmarshalled_dataset);
    3233                int   MarshallSize();
    3334                void  Demarshall(char** pmarshalled_dataset);
    3435                int   Enum();
    35                 int   MyRank();
    3636                Object* copy();
     37                /*}}}*/
     38                /*BeamVertexInput management: {{{1*/
    3739                int   EnumType();
    38 
    3940                Input* SpawnSingInput(int  index);
    4041                Input* SpawnBeamInput(int* indices);
    4142                Input* SpawnTriaInput(int* indices);
    4243                ElementResult* SpawnResult(int step, double time);
    43 
    4444                /*}}}*/
    4545                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/BoolInput.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*BoolInput constructors and destructor*/
    2020/*FUNCTION BoolInput::BoolInput(){{{1*/
    2121BoolInput::BoolInput(){
     
    3636/*}}}*/
    3737
    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*/
     40void BoolInput::Echo(void){
     41        this->DeepEcho();
    4442}
    4543/*}}}*/
     
    5048        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5149        printf("   value: %s\n",value?"true":"false");
     50}
     51/*}}}*/
     52/*FUNCTION BoolInput::Id{{{1*/
     53int    BoolInput::Id(void){ return -1; }
     54/*}}}*/
     55/*FUNCTION BoolInput::MyRank{{{1*/
     56int    BoolInput::MyRank(void){
     57        extern int my_rank;
     58        return my_rank;
     59}
     60/*}}}*/
     61/*FUNCTION BoolInput::Marshall{{{1*/
     62void  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*/
     84int   BoolInput::MarshallSize(){
     85       
     86        return sizeof(value)+
     87                +sizeof(enum_type)+
     88                +sizeof(int); //sizeof(int) for enum value
    5289}
    5390/*}}}*/
     
    71108}
    72109/*}}}*/
    73 /*FUNCTION BoolInput::Echo {{{1*/
    74 void BoolInput::Echo(void){
    75         this->DeepEcho();
    76 }
    77 /*}}}*/
    78110/*FUNCTION BoolInput::Enum{{{1*/
    79111int BoolInput::Enum(void){
     
    83115}
    84116/*}}}*/
     117/*FUNCTION BoolInput::copy{{{1*/
     118Object* BoolInput::copy() {
     119       
     120        return new BoolInput(this->enum_type,this->value);
     121
     122}
     123/*}}}*/
     124       
     125/*BoolInput management*/
    85126/*FUNCTION BoolInput::EnumType{{{1*/
    86127int BoolInput::EnumType(void){
     
    88129        return this->enum_type;
    89130
    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 value
    123 }
    124 /*}}}*/
    125 /*FUNCTION BoolInput::MyRank{{{1*/
    126 int    BoolInput::MyRank(void){
    127         extern int my_rank;
    128         return my_rank;
    129131}
    130132/*}}}*/
  • issm/trunk/src/c/objects/Inputs/BoolInput.h

    r4244 r4248  
    2020                IssmBool value;
    2121
    22                 /*constructors, destructors: {{{1*/
     22                /*BoolInput constructors, destructors: {{{1*/
    2323                BoolInput();
    2424                BoolInput(int enum_type,IssmBool value);
    2525                ~BoolInput();
    2626                /*}}}*/
    27                 /*object management: {{{1*/
     27                /*Object virtual functions definitions:{{{1 */
     28                void  Echo();
    2829                void  DeepEcho();
    29                 void  Echo();
    3030                int   Id();
     31                int   MyRank();
    3132                void  Marshall(char** pmarshalled_dataset);
    3233                int   MarshallSize();
    3334                void  Demarshall(char** pmarshalled_dataset);
    3435                int   Enum();
    35                 int   MyRank();
    3636                Object* copy();
     37                /*}}}*/
     38                /*BoolInput management: {{{1*/
    3739                int   EnumType();
    38 
    3940                Input* SpawnSingInput(int  index);
    4041                Input* SpawnBeamInput(int* indices);
    4142                Input* SpawnTriaInput(int* indices);
    4243                ElementResult* SpawnResult(int step, double time);
    43 
    4444                /*}}}*/
    4545                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/DoubleInput.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*DoubleInput constructors and destructor*/
    2020/*FUNCTION DoubleInput::DoubleInput(){{{1*/
    2121DoubleInput::DoubleInput(){
     
    3636/*}}}*/
    3737
    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*/
     40void DoubleInput::Echo(void){
     41        this->DeepEcho();
    4442}
    4543/*}}}*/
     
    5048        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5149        printf("   value: %g\n",this->value);
     50}
     51/*}}}*/
     52/*FUNCTION DoubleInput::Id{{{1*/
     53int    DoubleInput::Id(void){ return -1; }
     54/*}}}*/
     55/*FUNCTION DoubleInput::MyRank{{{1*/
     56int    DoubleInput::MyRank(void){
     57        extern int my_rank;
     58        return my_rank;
     59}
     60/*}}}*/
     61/*FUNCTION DoubleInput::Marshall{{{1*/
     62void  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*/
     84int   DoubleInput::MarshallSize(){
     85       
     86        return sizeof(value)+
     87                +sizeof(enum_type)+
     88                +sizeof(int); //sizeof(int) for enum value
    5289}
    5390/*}}}*/
     
    71108}
    72109/*}}}*/
    73 /*FUNCTION DoubleInput::Echo {{{1*/
    74 void DoubleInput::Echo(void){
    75         this->DeepEcho();
    76 }
    77 /*}}}*/
    78110/*FUNCTION DoubleInput::Enum{{{1*/
    79111int DoubleInput::Enum(void){
     
    83115}
    84116/*}}}*/
     117/*FUNCTION DoubleInput::copy{{{1*/
     118Object* DoubleInput::copy() {
     119       
     120        return new DoubleInput(this->enum_type,this->value);
     121
     122}
     123/*}}}*/
     124       
     125/*DoubleInput management*/
    85126/*FUNCTION DoubleInput::EnumType{{{1*/
    86127int DoubleInput::EnumType(void){
     
    88129        return this->enum_type;
    89130
    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 value
    123 }
    124 /*}}}*/
    125 /*FUNCTION DoubleInput::MyRank{{{1*/
    126 int    DoubleInput::MyRank(void){
    127         extern int my_rank;
    128         return my_rank;
    129131}
    130132/*}}}*/
  • issm/trunk/src/c/objects/Inputs/DoubleInput.h

    r4244 r4248  
    1919                double value;
    2020
    21                 /*constructors, destructors: {{{1*/
     21                /*DoubleInput constructors, destructors: {{{1*/
    2222                DoubleInput();
    2323                DoubleInput(int enum_type,IssmDouble value);
    2424                ~DoubleInput();
    2525                /*}}}*/
    26                 /*object management: {{{1*/
     26                /*Object virtual functions definitions:{{{1 */
     27                void  Echo();
    2728                void  DeepEcho();
    28                 void  Echo();
    2929                int   Id();
     30                int   MyRank();
    3031                void  Marshall(char** pmarshalled_dataset);
    3132                int   MarshallSize();
    3233                void  Demarshall(char** pmarshalled_dataset);
    3334                int   Enum();
    34                 int   MyRank();
    3535                Object* copy();
     36                /*}}}*/
     37                /*DoubleInput management: {{{1*/
    3638                int   EnumType();
    37 
    3839                Input* SpawnSingInput(int  index);
    3940                Input* SpawnBeamInput(int* indices);
    4041                Input* SpawnTriaInput(int* indices);
    4142                ElementResult* SpawnResult(int step, double time);
    42 
    4343                /*}}}*/
    4444                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/Input.h

    r4057 r4248  
    2020               
    2121                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;
    2624                virtual void GetParameterValue(bool* pvalue)=0;
    2725                virtual void GetParameterValue(int* pvalue)=0;
  • issm/trunk/src/c/objects/Inputs/IntInput.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*IntInput constructors and destructor*/
    2020/*FUNCTION IntInput::IntInput(){{{1*/
    2121IntInput::IntInput(){
     
    3636/*}}}*/
    3737
    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:*/
    4639/*FUNCTION IntInput::DeepEcho{{{1*/
    4740void IntInput::DeepEcho(void){
     
    5043        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5144        printf("   value: %i\n",this->value);
     45}
     46/*}}}*/
     47/*FUNCTION IntInput::Id{{{1*/
     48int    IntInput::Id(void){ return -1; }
     49/*}}}*/
     50/*FUNCTION IntInput::MyRank{{{1*/
     51int    IntInput::MyRank(void){
     52        extern int my_rank;
     53        return my_rank;
     54}
     55/*}}}*/
     56/*FUNCTION IntInput::Marshall{{{1*/
     57void  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*/
     79int   IntInput::MarshallSize(){
     80       
     81        return sizeof(value)+
     82                +sizeof(enum_type)+
     83                +sizeof(int); //sizeof(int) for enum value
    5284}
    5385/*}}}*/
     
    71103}
    72104/*}}}*/
     105/*FUNCTION IntInput::Enum{{{1*/
     106int IntInput::Enum(void){
     107
     108        return IntInputEnum;
     109
     110}
     111/*}}}*/
     112/*FUNCTION IntInput::copy{{{1*/
     113Object* IntInput::copy() {
     114       
     115        return new IntInput(this->enum_type,this->value);
     116
     117}
     118/*}}}*/
     119
     120/*IntInput management*/
    73121/*FUNCTION IntInput::Echo {{{1*/
    74122void IntInput::Echo(void){
     
    76124}
    77125/*}}}*/
    78 /*FUNCTION IntInput::Enum{{{1*/
    79 int IntInput::Enum(void){
    80 
    81         return IntInputEnum;
    82 
    83 }
    84 /*}}}*/
    85126/*FUNCTION IntInput::EnumType{{{1*/
    86127int IntInput::EnumType(void){
     
    88129        return this->enum_type;
    89130
    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 value
    123 }
    124 /*}}}*/
    125 /*FUNCTION IntInput::MyRank{{{1*/
    126 int    IntInput::MyRank(void){
    127         extern int my_rank;
    128         return my_rank;
    129131}
    130132/*}}}*/
  • issm/trunk/src/c/objects/Inputs/IntInput.h

    r4244 r4248  
    2020                IssmInt value;
    2121
    22                 /*constructors, destructors: {{{1*/
     22                /*IntInput constructors, destructors: {{{1*/
    2323                IntInput();
    2424                IntInput(int enum_type,IssmInt value);
    2525                ~IntInput();
    2626                /*}}}*/
    27                 /*object management: {{{1*/
     27                /*Object virtual functions definitions:{{{1 */
     28                void  Echo();
    2829                void  DeepEcho();
    29                 void  Echo();
    3030                int   Id();
     31                int   MyRank();
    3132                void  Marshall(char** pmarshalled_dataset);
    3233                int   MarshallSize();
    3334                void  Demarshall(char** pmarshalled_dataset);
    3435                int   Enum();
    35                 int   MyRank();
    3636                Object* copy();
     37                /*}}}*/
     38                /*IntInput management: {{{1*/
    3739                int   EnumType();
    38 
    3940                Input* SpawnSingInput(int  index);
    4041                Input* SpawnBeamInput(int* indices);
    4142                Input* SpawnTriaInput(int* indices);
    4243                ElementResult* SpawnResult(int step, double time);
    43 
    4444                /*}}}*/
    4545                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*PentaVertexInput constructors and destructor*/
    2020/*FUNCTION PentaVertexInput::PentaVertexInput(){{{1*/
    2121PentaVertexInput::PentaVertexInput(){
     
    4141/*}}}*/
    4242
    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*/
     45void PentaVertexInput::Echo(void){
     46        this->DeepEcho();
    4947}
    5048/*}}}*/
     
    5755}
    5856/*}}}*/
    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 the
    69          *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 /*}}}*/
    9757/*FUNCTION PentaVertexInput::Id{{{1*/
    9858int    PentaVertexInput::Id(void){ return -1; }
     59/*}}}*/
     60/*FUNCTION PentaVertexInput::MyRank{{{1*/
     61int    PentaVertexInput::MyRank(void){
     62        extern int my_rank;
     63        return my_rank;
     64}
    9965/*}}}*/
    10066/*FUNCTION PentaVertexInput::Marshall{{{1*/
     
    12894}
    12995/*}}}*/
    130 /*FUNCTION PentaVertexInput::MyRank{{{1*/
    131 int    PentaVertexInput::MyRank(void){
    132         extern int my_rank;
    133         return my_rank;
     96/*FUNCTION PentaVertexInput::Demarshall{{{1*/
     97void  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*/
     116int PentaVertexInput::Enum(void){
     117
     118        return PentaVertexInputEnum;
     119
     120}
     121/*}}}*/
     122       
     123/*PentaVertexInput management*/
     124/*FUNCTION PentaVertexInput::copy{{{1*/
     125Object* PentaVertexInput::copy() {
     126       
     127        return new PentaVertexInput(this->enum_type,this->values);
     128
     129}
     130/*}}}*/
     131/*FUNCTION PentaVertexInput::EnumType{{{1*/
     132int PentaVertexInput::EnumType(void){
     133
     134        return this->enum_type;
     135
    134136}
    135137/*}}}*/
  • issm/trunk/src/c/objects/Inputs/PentaVertexInput.h

    r4244 r4248  
    1919                double values[6];
    2020
    21                 /*constructors, destructors: {{{1*/
     21                /*PentaVertexInput constructors, destructors: {{{1*/
    2222                PentaVertexInput();
    2323                PentaVertexInput(int enum_type,double* values);
    2424                ~PentaVertexInput();
    2525                /*}}}*/
    26                 /*object management: {{{1*/
     26                /*Object virtual functions definitions:{{{1 */
     27                void  Echo();
    2728                void  DeepEcho();
    28                 void  Echo();
    2929                int   Id();
     30                int   MyRank();
    3031                void  Marshall(char** pmarshalled_dataset);
    3132                int   MarshallSize();
    3233                void  Demarshall(char** pmarshalled_dataset);
    3334                int   Enum();
    34                 int   MyRank();
    3535                Object* copy();
     36                /*}}}*/
     37                /*PentaVertexInput management: {{{1*/
    3638                int   EnumType();
    37 
    3839                Input* SpawnSingInput(int  index);
    3940                Input* SpawnBeamInput(int* indices);
    4041                Input* SpawnTriaInput(int* indices);
    4142                ElementResult* SpawnResult(int step, double time);
    42 
    4343                /*}}}*/
    4444                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*SingVertexInput constructors and destructor*/
    2020/*FUNCTION SingVertexInput::SingVertexInput(){{{1*/
    2121SingVertexInput::SingVertexInput(){
     
    3636/*}}}*/
    3737
    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*/
     40void SingVertexInput::Echo(void){
     41        this->DeepEcho();
    4442}
    4543/*}}}*/
     
    5048        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5149        printf("   value: %g\n",this->value);
     50}
     51/*}}}*/
     52/*FUNCTION SingVertexInput::Id{{{1*/
     53int    SingVertexInput::Id(void){ return -1; }
     54/*}}}*/
     55/*FUNCTION SingVertexInput::MyRank{{{1*/
     56int    SingVertexInput::MyRank(void){
     57        extern int my_rank;
     58        return my_rank;
     59}
     60/*}}}*/
     61/*FUNCTION SingVertexInput::Marshall{{{1*/
     62void  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*/
     84int   SingVertexInput::MarshallSize(){
     85       
     86        return sizeof(value)+
     87                +sizeof(enum_type)+
     88                +sizeof(int); //sizeof(int) for enum value
    5289}
    5390/*}}}*/
     
    71108}
    72109/*}}}*/
    73 /*FUNCTION SingVertexInput::Echo {{{1*/
    74 void SingVertexInput::Echo(void){
    75         this->DeepEcho();
    76 }
    77 /*}}}*/
    78110/*FUNCTION SingVertexInput::Enum{{{1*/
    79111int SingVertexInput::Enum(void){
     
    83115}
    84116/*}}}*/
     117/*FUNCTION SingVertexInput::copy{{{1*/
     118Object* SingVertexInput::copy() {
     119       
     120        return new SingVertexInput(this->enum_type,this->value);
     121
     122}
     123/*}}}*/
     124
     125/*SingVertexInput management*/
    85126/*FUNCTION SingVertexInput::EnumType{{{1*/
    86127int SingVertexInput::EnumType(void){
     
    88129        return this->enum_type;
    89130
    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 value
    123 }
    124 /*}}}*/
    125 /*FUNCTION SingVertexInput::MyRank{{{1*/
    126 int    SingVertexInput::MyRank(void){
    127         extern int my_rank;
    128         return my_rank;
    129131}
    130132/*}}}*/
  • issm/trunk/src/c/objects/Inputs/SingVertexInput.h

    r4244 r4248  
    1919                double value;
    2020
    21                 /*constructors, destructors: {{{1*/
     21                /*SingVertexInput constructors, destructors: {{{1*/
    2222                SingVertexInput();
    2323                SingVertexInput(int enum_type,double value);
    2424                ~SingVertexInput();
    2525                /*}}}*/
    26                 /*object management: {{{1*/
     26                /*Object virtual functions definitions:{{{1 */
     27                void  Echo();
    2728                void  DeepEcho();
    28                 void  Echo();
    2929                int   Id();
     30                int   MyRank();
    3031                void  Marshall(char** pmarshalled_dataset);
    3132                int   MarshallSize();
    3233                void  Demarshall(char** pmarshalled_dataset);
    3334                int   Enum();
    34                 int   MyRank();
    3535                Object* copy();
     36                /*}}}*/
     37                /*SingVertexInput management: {{{1*/
    3638                int   EnumType();
    37 
    3839                Input* SpawnSingInput(int  index);
    3940                Input* SpawnBeamInput(int* indices);
    4041                Input* SpawnTriaInput(int* indices);
    4142                ElementResult* SpawnResult(int step, double time);
    42 
    4343                /*}}}*/
    4444                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp

    r4236 r4248  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*TriaVertexInput constructors and destructor*/
    2020/*FUNCTION TriaVertexInput::TriaVertexInput(){{{1*/
    2121TriaVertexInput::TriaVertexInput(){
     
    3838/*}}}*/
    3939
    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*/
     42void TriaVertexInput::Echo(void){
     43        this->DeepEcho();
    4644}
    4745/*}}}*/
     
    5250        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5351        printf("   values: [%g %g %g]\n",this->values[0],this->values[1],this->values[2]);
     52}
     53/*}}}*/
     54/*FUNCTION TriaVertexInput::Id{{{1*/
     55int    TriaVertexInput::Id(void){ return -1; }
     56/*}}}*/
     57/*FUNCTION TriaVertexInput::MyRank{{{1*/
     58int    TriaVertexInput::MyRank(void){
     59        extern int my_rank;
     60        return my_rank;
     61}
     62/*}}}*/
     63/*FUNCTION TriaVertexInput::Marshall{{{1*/
     64void  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*/
     86int   TriaVertexInput::MarshallSize(){
     87       
     88        return sizeof(values)+
     89                +sizeof(enum_type)+
     90                +sizeof(int); //sizeof(int) for enum value
    5491}
    5592/*}}}*/
     
    73110}
    74111/*}}}*/
    75 /*FUNCTION TriaVertexInput::Echo {{{1*/
    76 void TriaVertexInput::Echo(void){
    77         this->DeepEcho();
    78 }
    79 /*}}}*/
    80112/*FUNCTION TriaVertexInput::Enum{{{1*/
    81113int TriaVertexInput::Enum(void){
     
    85117}
    86118/*}}}*/
     119/*FUNCTION TriaVertexInput::copy{{{1*/
     120Object* TriaVertexInput::copy() {
     121       
     122        return new TriaVertexInput(this->enum_type,this->values);
     123
     124}
     125/*}}}*/
     126       
     127/*TriaVertexInput management*/
    87128/*FUNCTION TriaVertexInput::EnumType{{{1*/
    88129int TriaVertexInput::EnumType(void){
     
    90131        return this->enum_type;
    91132
    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 value
    125 }
    126 /*}}}*/
    127 /*FUNCTION TriaVertexInput::MyRank{{{1*/
    128 int    TriaVertexInput::MyRank(void){
    129         extern int my_rank;
    130         return my_rank;
    131133}
    132134/*}}}*/
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.h

    r4244 r4248  
    2020                double values[3];
    2121
    22                 /*constructors, destructors: {{{1*/
     22                /*TriaVertexInput constructors, destructors: {{{1*/
    2323                TriaVertexInput();
    2424                TriaVertexInput(int enum_type,double* values);
    2525                ~TriaVertexInput();
    2626                /*}}}*/
    27                 /*object management: {{{1*/
     27                /*Object virtual functions definitions:{{{1 */
     28                void  Echo();
    2829                void  DeepEcho();
    29                 void  Echo();
    3030                int   Id();
     31                int   MyRank();
    3132                void  Marshall(char** pmarshalled_dataset);
    3233                int   MarshallSize();
    3334                void  Demarshall(char** pmarshalled_dataset);
    3435                int   Enum();
    35                 int   MyRank();
    3636                Object* copy();
     37                /*}}}*/
     38                /*TriaVertexInput management: {{{1*/
    3739                int   EnumType();
    38 
    3940                Input* SpawnSingInput(int  index);
    4041                Input* SpawnBeamInput(int* indices);
    4142                Input* SpawnTriaInput(int* indices);
    4243                ElementResult* SpawnResult(int step, double time);
    43 
    4444                /*}}}*/
    4545                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Loads/Icefront.cpp

    r4232 r4248  
    1919/*}}}*/
    2020
    21 /*Object constructors and destructor*/
     21/*Icefront constructors and destructor*/
    2222/*FUNCTION Icefront::Icefront() {{{1*/
    2323Icefront::Icefront(){
     
    9999
    100100/*}}}*/
    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 /*}}}*/
    129101/*FUNCTION Icefront::~Icefront() {{{1*/
    130102Icefront::~Icefront(){
     
    134106/*}}}*/
    135107
    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:*/
    195109/*FUNCTION Icefront::Echo {{{1*/
    196110void Icefront::Echo(void){
     
    207121}
    208122/*}}}*/
    209 /*FUNCTION Icefront::Enum {{{1*/
    210 int Icefront::Enum(void){
    211 
    212         return IcefrontEnum;
    213 
     123/*FUNCTION Icefront::DeepEcho{{{1*/
     124void 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();
    214136}
    215137/*}}}*/
    216138/*FUNCTION Icefront::Id {{{1*/
    217139int    Icefront::Id(void){ return id; }
     140/*}}}*/
     141/*FUNCTION Icefront::MyRank {{{1*/
     142int    Icefront::MyRank(void){
     143        extern int my_rank;
     144        return my_rank;
     145}
    218146/*}}}*/
    219147/*FUNCTION Icefront::Marshall {{{1*/
     
    268196}
    269197/*}}}*/
    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*/
     199void  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*/
     229int Icefront::Enum(void){
     230
     231        return IcefrontEnum;
     232
     233}
     234/*}}}*/
     235/*FUNCTION Icefront::copy {{{1*/
     236Object* 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*/
     266void  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/*}}}*/
    278278/*FUNCTION Icefront::CreateKMatrix {{{1*/
    279279void  Icefront::CreateKMatrix(Mat Kgg){
     
    307307}
    308308/*}}}*/
     309/*FUNCTION Icefront::PenaltyCreateKMatrix {{{1*/
     310void  Icefront::PenaltyCreateKMatrix(Mat Kgg,double kmax){
     311        /*do nothing: */
     312}
     313/*}}}*/
     314/*FUNCTION Icefront::PenaltyCreatePVector{{{1*/
     315void  Icefront::PenaltyCreatePVector(Vec pg,double kmax){
     316        /*do nothing: */
     317}
     318/*}}}*/
     319/*FUNCTION Icefront::InAnalysis(int analysis_type){{{1*/
     320bool 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*/
     328void  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*/
     333void  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*/
     338void  Icefront::InputUpdateFromVector(bool* vector, int name, int type){
     339        /*Nothing updated yet*/
     340}
     341/*}}}*/
     342/*FUNCTION Icefront::InputUpdateFromConstant(double constant, int name) {{{1*/
     343void  Icefront::InputUpdateFromConstant(double constant, int name){
     344        /*Nothing updated yet*/
     345}
     346/*}}}*/
     347/*FUNCTION Icefront::InputUpdateFromConstant(int constant, int name) {{{1*/
     348void  Icefront::InputUpdateFromConstant(int constant, int name){
     349        /*Nothing updated yet*/
     350}
     351/*}}}*/
     352/*FUNCTION Icefront::InputUpdateFromConstant(bool constant, int name) {{{1*/
     353void  Icefront::InputUpdateFromConstant(bool constant, int name){
     354        /*Nothing updated yet*/
     355}
     356/*}}}*/
     357/*FUNCTION Icefront::InputUpdateFromSolution(double* solution) {{{1*/
     358void  Icefront::InputUpdateFromSolution(double* solution){
     359        /*Nothing updated yet*/
     360}
     361/*}}}*/
     362
     363/*Icefront numerics: */
    309364/*FUNCTION Icefront::CreatePVectorDiagnosticHoriz {{{1*/
    310365void Icefront::CreatePVectorDiagnosticHoriz( Vec pg){
     
    725780        *pnumberofdofspernode=numberofdofspernode;
    726781
    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: */
    737782}
    738783/*}}}*/
     
    13321377}
    13331378/*}}}*/
    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  
    3333                Parameters* parameters;
    3434
    35                 /*constructors: {{{1*/
     35                /*Icefront constructors, destructors: {{{1*/
    3636                Icefront();
    3737                Icefront(int icefront_id,int i, IoModel* iomodel,int analysis_type);
    3838                ~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();
    3949                Object* copy();
    4050                /*}}}*/
    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*/
    5352                void  InputUpdateFromVector(double* vector, int name, int type);
    5453                void  InputUpdateFromVector(int* vector, int name, int type);
     
    5857                void  InputUpdateFromConstant(bool constant, int name);
    5958                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);
    6066                bool  InAnalysis(int analysis_type);
    6167                /*}}}*/
    62                 /*numerics: {{{1*/
    63                 void  CreateKMatrix(Mat Kgg);
    64                 void  CreatePVector(Vec pg);
     68                /*Load management: {{{1*/
    6569                void  CreatePVectorDiagnosticHoriz( Vec pg);
    6670                void  CreatePVectorDiagnosticHorizSegment( Vec pg);
     
    7377                void  QuadPressureLoadStokes(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list,
    7478                                              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);
    7779                /*}}}*/
    7880};
  • issm/trunk/src/c/objects/Loads/Load.h

    r4244 r4248  
    2121
    2222        public:
     23
    2324                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;
    3227                virtual void  CreateKMatrix(Mat Kgg)=0;
    3328                virtual void  CreatePVector(Vec pg)=0;
     
    3530                virtual void  PenaltyCreatePVector(Vec pg,double kmax)=0;
    3631                virtual bool  InAnalysis(int analysis_type)=0;
     32                /*}}}*/
    3733};
    3834#endif
  • issm/trunk/src/c/objects/Loads/Numericalflux.cpp

    r4232 r4248  
    1818extern int my_rank;
    1919
    20 /*Object constructors and destructor*/
     20/*Numericalflux constructors and destructor*/
    2121/*FUNCTION Numericalflux::Numericalflux(){{{1*/
    2222Numericalflux::Numericalflux(){
     
    120120}
    121121/*}}}*/
    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 /*}}}*/
    149122/*FUNCTION Numericalflux::~Numericalflux(){{{1*/
    150123Numericalflux::~Numericalflux(){
     
    154127/*}}}*/
    155128
    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*/
     131void Numericalflux::Echo(void){
     132        this->DeepEcho();
    168133}
    169134/*}}}*/
     
    183148}               
    184149/*}}}*/
     150/*FUNCTION Numericalflux::Id {{{1*/
     151int    Numericalflux::Id(void){
     152        return id;
     153}
     154/*}}}*/
     155/*FUNCTION Numericalflux::MyRank {{{1*/
     156int    Numericalflux::MyRank(void){
     157        extern int my_rank;
     158        return my_rank;
     159}
     160/*}}}*/
     161/*FUNCTION Numericalflux::Marshall {{{1*/
     162void  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*/
     201int   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/*}}}*/
    185211/*FUNCTION Numericalflux::Demarshall {{{1*/
    186212void  Numericalflux::Demarshall(char** pmarshalled_dataset){
     
    212238}
    213239/*}}}*/
    214 /*FUNCTION Numericalflux::Echo {{{1*/
    215 void Numericalflux::Echo(void){
    216         this->DeepEcho();
    217 }
    218 /*}}}*/
    219240/*FUNCTION Numericalflux::Enum {{{1*/
    220241int Numericalflux::Enum(void){
     
    224245}
    225246/*}}}*/
    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*/
     248Object* 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*/
     277void  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/*}}}*/
    284289/*FUNCTION Numericalflux::CreateKMatrix {{{1*/
    285290void  Numericalflux::CreateKMatrix(Mat Kgg){
     
    300305}
    301306/*}}}*/
     307/*FUNCTION Numericalflux::CreatePVector {{{1*/
     308void  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*/
     326void  Numericalflux::PenaltyCreateKMatrix(Mat Kgg,double kmax){
     327
     328        /*No stiffness loads applied, do nothing: */
     329        return;
     330
     331}
     332/*}}}*/
     333/*FUNCTION Numericalflux::PenaltyCreatePVector{{{1*/
     334void  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*/
     342bool 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*/
    302349/*FUNCTION Numericalflux::CreateKMatrixInternal {{{1*/
    303350void  Numericalflux::CreateKMatrixInternal(Mat Kgg){
     
    541588}
    542589/*}}}*/
    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 /*}}}*/
    561590/*FUNCTION Numericalflux::CreatePVectorInternal{{{1*/
    562591void  Numericalflux::CreatePVectorInternal(Vec pg){
     
    684713}
    685714/*}}}*/
    686 /*}}}*/
    687715/*FUNCTION Numericalflux::GetB {{{1*/
    688716void Numericalflux::GetB(double* B, double gauss_coord){
     
    741769}
    742770/*}}}*/
    743 /*FUNCTION Numericalflux::Id {{{1*/
    744 int    Numericalflux::Id(void){
    745         return id;
    746 }
    747 /*}}}*/
    748771/*FUNCTION Numericalflux::GetJacobianDeterminant{{{1*/
    749772void Numericalflux::GetJacobianDeterminant(double* pJdet,double xyz_list[4][3], double gauss_coord){
     
    831854}
    832855/*}}}*/
    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  
    2828
    2929
    30                 /*Constructors {{{1*/
     30                /*Numericalflux constructors,destructors {{{1*/
    3131                Numericalflux();
    3232                Numericalflux(int numericalflux_id,int i, IoModel* iomodel,int analysis_type);
    3333                ~Numericalflux();
    34                 Object* copy();
    3534                /*}}}*/
    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();
    3837                void  DeepEcho();
    39                 void  Demarshall(char** pmarshalled_dataset);
    40                 void  Echo();
    41                 int   Enum();
    4238                int   Id();
     39                int   MyRank();
    4340                void  Marshall(char** pmarshalled_dataset);
    4441                int   MarshallSize();
    45                 int   MyRank();
     42                void  Demarshall(char** pmarshalled_dataset);
     43                int   Enum();
     44                Object* copy();
    4645                /*}}}*/
    4746                /*Update virtual functions resolution: {{{1*/
     
    5453                void    InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");}
    5554                /*}}}*/
    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);
    5761                bool  InAnalysis(int analysis_type);
     62                /*}}}*/
     63                /*Numericalflux management:{{{1*/
    5864                void  GetJacobianDeterminant(double* pJdet,double xyz_list[4][3], double gauss_coord);
    5965                void  GetNodalFunctions(double* l1l4, double gauss_coord);
     
    6369                void  GetNormal(double* normal,double xyz_list[4][3]);
    6470                void  GetParameterValue(double* pp, double* plist, double gauss_coord);
    65                
    66                 void  CreateKMatrix(Mat Kgg);
    6771                void  CreateKMatrixInternal(Mat Kgg);
    6872                void  CreateKMatrixBoundary(Mat Kgg);
    69                 void  CreatePVector(Vec pg);
    7073                void  CreatePVectorInternal(Vec pg);
    7174                void  CreatePVectorBoundary(Vec pg);
    72                 void  PenaltyCreateKMatrix(Mat Kgg,double kmax);
    73                 void  PenaltyCreatePVector(Vec pg,double kmax);
    7475                /*}}}*/
    7576
  • issm/trunk/src/c/objects/Loads/Pengrid.cpp

    r4236 r4248  
    1818#include "../../Container/Container.h"
    1919       
    20 /*Object constructors and destructor*/
     20/*Pengrid constructors and destructor*/
    2121/*FUNCTION Pengrid::constructor {{{1*/
    2222Pengrid::Pengrid(){
     
    6767}
    6868/*}}}*/
    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 internals
    94         pengrid->active=this->active=0;
    95         pengrid->zigzag_counter=this->zigzag_counter=0;
    96 
    97         return pengrid;
    98 
    99 }
    100 /*}}}*/
    10169/*FUNCTION Pengrid::destructor {{{1*/
    10270Pengrid::~Pengrid(){
     
    10472}
    10573/*}}}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*/
     77void Pengrid::Echo(void){
     78        this->DeepEcho();
    11979}
    12080/*}}}1*/
     
    13696}
    13797/*}}}*/
    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 the
    148          *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*/
    18298/*FUNCTION Pengrid::Id {{{1*/
    18399int    Pengrid::Id(void){ return id; }
     100/*}}}1*/
     101/*FUNCTION Pengrid::MyRank {{{1*/
     102int    Pengrid::MyRank(void){
     103        extern int my_rank;
     104        return my_rank;
     105}
    184106/*}}}1*/
    185107/*FUNCTION Pengrid::Marshall {{{1*/
     
    239161}
    240162/*}}}*/
    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*/
     164void  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*/
     197int Pengrid::Enum(void){
     198
     199        return PengridEnum;
     200}
     201/*}}}1*/
     202/*FUNCTION Icefront::copy {{{1*/
     203Object* 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*/
     237void  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*/
    249249/*FUNCTION Pengrid::CreateKMatrix {{{1*/
    250250void  Pengrid::CreateKMatrix(Mat Kgg){
     
    263263}
    264264/*}}}1*/
     265/*FUNCTION Pengrid::PenaltyCreateMatrix {{{1*/
     266void  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*/
     289void  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*/
     315bool 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*/
     323void  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*/
     328void  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*/
     333void  Pengrid::InputUpdateFromVector(bool* vector, int name, int type){
     334        /*Nothing updated yet*/
     335}
     336/*}}}*/
     337/*FUNCTION Pengrid::InputUpdateFromConstant(double constant, int name) {{{1*/
     338void  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*/
     349void  Pengrid::InputUpdateFromConstant(int constant, int name){
     350        /*Nothing updated yet*/
     351}
     352/*}}}*/
     353/*FUNCTION Pengrid::InputUpdateFromConstant(bool constant, int name) {{{1*/
     354void  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*/
     366void  Pengrid::InputUpdateFromSolution(double* solution){
     367        /*Nothing updated yet*/
     368}
     369/*}}}*/         
     370
     371/*Pengrid management:*/
    265372/*FUNCTION Pengrid::GetDofList {{{1*/
    266373void  Pengrid::GetDofList(int* doflist,int* pnumberofdofspernode){
     
    402509}
    403510/*}}}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*/
    427511/*FUNCTION Pengrid::PenaltyCreateKMatrixDiagnosticStokes {{{1*/
    428512void  Pengrid::PenaltyCreateKMatrixDiagnosticStokes(Mat Kgg,double kmax){
     
    552636        /*Add Ke to global matrix Kgg: */
    553637        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 
    580638}
    581639/*}}}1*/
     
    709767}
    710768/*}}}1*/
    711 
    712 /*Updates: */
    713769/*FUNCTION Pengrid::UpdateFromDakota {{{1*/
    714770void  Pengrid::UpdateFromDakota(void* inputs){
     
    721777}
    722778/*}}}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  
    3434        public:
    3535
    36                 /*FUNCTION constructors, destructors {{{1*/
     36                /*Pengrid constructors, destructors {{{1*/
    3737                Pengrid();
    3838                Pengrid(int index, int id, IoModel* iomodel,int analysis_type);
    3939                ~Pengrid();
    40                 Object* copy();
    4140                /*}}}*/
    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();
    4443                void  DeepEcho();
    45                 void  Demarshall(char** pmarshalled_dataset);
    46                 void  Echo();
    47                 int   Enum();
    4844                int   Id();
     45                int   MyRank();
    4946                void  Marshall(char** pmarshalled_dataset);
    5047                int   MarshallSize();
    51                 int   MyRank();
     48                void  Demarshall(char** pmarshalled_dataset);
     49                int   Enum();
     50                Object* copy();
    5251                /*}}}*/
    5352                /*Update virtual functions resolution: {{{1*/
     
    6059                void  InputUpdateFromSolution(double* solution);
    6160                /*}}}*/
    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);
    6463                void  CreateKMatrix(Mat Kgg);
    6564                void  CreatePVector(Vec pg);
    6665                void  PenaltyCreateKMatrix(Mat Kgg,double kmax);
    6766                void  PenaltyCreatePVector(Vec pg,double kmax);
     67                bool  InAnalysis(int analysis_type);
     68                /*}}}*/
     69                /*Pengrid management {{{1*/
    6870                void  PenaltyCreateKMatrixDiagnosticStokes(Mat Kgg,double kmax);
    6971                void  GetDofList(int* doflist,int* pnumberofdofspernode);
     
    7476                void  PenaltyConstrain(int* punstable);
    7577                void  PenaltyConstrainThermal(int* punstable);
    76                
    77                 /*updates:*/
    7878                void  UpdateFromDakota(void* inputs);
    7979                void  UpdateInputs(double* solution);
  • issm/trunk/src/c/objects/Loads/Penpair.cpp

    r4232 r4248  
    1717#include "../../shared/shared.h"
    1818               
    19 /*Object constructors and destructor*/
     19/*Penpair constructors and destructor*/
    2020/*FUNCTION Penpair::constructor {{{1*/
    2121Penpair::Penpair(){
     
    4747}
    4848/*}}}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 /*}}}*/
    6749/*FUNCTION Penpair::destructor {{{1*/
    6850Penpair::~Penpair(){
     
    7052}
    7153/*}}}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*/
     57void 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;
    8167}
    8268/*}}}1*/
     
    9278}               
    9379/*}}}1*/
     80/*FUNCTION Penpair::Id {{{1*/
     81int    Penpair::Id(void){ return id; }
     82/*}}}1*/
     83/*FUNCTION Penpair::MyRank {{{1*/
     84int    Penpair::MyRank(void){
     85        extern int my_rank;
     86        return my_rank;
     87}
     88/*}}}1*/
     89/*FUNCTION Penpair::Marshall {{{1*/
     90void  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*/
     116int   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*/
    94124/*FUNCTION Penpair::Demarshall {{{1*/
    95125void  Penpair::Demarshall(char** pmarshalled_dataset){
     
    114144}
    115145/*}}}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*/
    129146/*FUNCTION Penpair::Enum {{{1*/
    130147int Penpair::Enum(void){
     
    133150}
    134151/*}}}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*/
     153Object* 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*/
     173void  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*/
    181181/*FUNCTION Penpair::CreateKMatrix {{{1*/
    182182void  Penpair::CreateKMatrix(Mat Kgg){
  • issm/trunk/src/c/objects/Loads/Penpair.h

    r4244 r4248  
    2424        public:
    2525
    26                 /*constructors: {{{1*/
     26                /*Penpair constructors, destructors: {{{1*/
    2727                Penpair();
    2828                Penpair(int penpair_id,int* penpair_node_ids,int analysis_type);
    2929                Penpair(int penpair_id,Hook* penpair_hnodes,int analysis_type);
    3030                ~Penpair();
    31                 Object* copy();
    3231                /*}}}*/
    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();
    3534                void  DeepEcho();
    36                 void  Demarshall(char** pmarshalled_dataset);
    37                 void  Echo();
    38                 int   Enum();
    3935                int   Id();
     36                int   MyRank();
    4037                void  Marshall(char** pmarshalled_dataset);
    4138                int   MarshallSize();
    42                 int   MyRank();
     39                void  Demarshall(char** pmarshalled_dataset);
     40                int   Enum();
     41                Object* copy();
    4342                /*}}}*/
    4443                /*Update virtual functions resolution: {{{1*/
     
    5150                void  InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");}
    5251                /*}}}*/
    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);
    5554                void  CreateKMatrix(Mat Kgg);
    5655                void  CreatePVector(Vec pg);
    5756                void  PenaltyCreateKMatrix(Mat Kgg,double kmax);
    5857                void  PenaltyCreatePVector(Vec pg,double kmax);
     58                bool  InAnalysis(int analysis_type);
    5959                /*}}}*/
    6060};
  • issm/trunk/src/c/objects/Loads/Riftfront.cpp

    r4232 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*Riftfront constructors and destructor*/
    2323/*FUNCTION Riftfront::Riftfront(){{{1*/
    2424Riftfront::Riftfront(){
     
    9494}
    9595/*}}}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 /*}}}*/
    12496/*FUNCTION Riftfront::~Riftfront(){{{1*/
    12597Riftfront::~Riftfront(){
     
    129101/*}}}*/
    130102
    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*/
     105void Riftfront::Echo(void){
     106        this->DeepEcho();
     107}
     108/*}}}1*/
    145109/*FUNCTION Riftfront::DeepEcho{{{1*/
    146110void Riftfront::DeepEcho(void){
     
    157121}
    158122/*}}}*/
    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 the
    169          *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*/
    210123/*FUNCTION Riftfront::Id {{{1*/
    211124int    Riftfront::Id(void){ return id; }
     125/*}}}1*/
     126/*FUNCTION Riftfront::MyRank {{{1*/
     127int    Riftfront::MyRank(void){
     128        extern int my_rank;
     129        return my_rank;
     130}
    212131/*}}}1*/
    213132/*FUNCTION Riftfront::Marshall {{{1*/
     
    279198}
    280199/*}}}*/
    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*/
     201void  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*/
     240int Riftfront::Enum(void){
     241
     242        return RiftfrontEnum;
     243
     244}
     245/*}}}1*/
     246/*FUNCTION Riftfront::copy {{{1*/
     247Object* 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();
    360258        }
    361259        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*/
     277void  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/*}}}*/
    375289/*FUNCTION Riftfront::CreateKMatrix {{{1*/
    376290void  Riftfront::CreateKMatrix(Mat Kgg){
     
    381295void  Riftfront::CreatePVector(Vec pg){
    382296        /*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 keep
    433                  * constraining the rift front. If it was not, and this is the first time the material
    434                  * 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 indexed
    501         value=(double)this->fraction;
    502 
    503         /*Plug id and fraction  into riftproperties matrix: */
    504         VecSetValues(riftproperties,1,&row_id,&value,INSERT_VALUES);
    505297}
    506298/*}}}1*/
     
    744536}
    745537/*}}}1*/
     538/*FUNCTION Riftfront::InAnalysis(int analysis_type){{{1*/
     539bool 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
     549int   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*/
     633void   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
     642void  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*/
     663bool   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*/
     671int   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*/
     689int   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*/
     741void  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*/
    746754/*FUNCTION Riftfront::Penetration {{{1*/
    747755int   Riftfront::Penetration(double* ppenetration){
     
    929937}
    930938/*}}}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  
    4343
    4444
    45                 /*constructors,destructors: {{{1*/
     45                /*Riftfrontconstructors,destructors: {{{1*/
    4646                Riftfront();
    4747                Riftfront(int riftfront_id,int i, IoModel* iomodel,int analysis_type);
    4848                ~Riftfront();
    4949                /*}}}*/
    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();
    5352                void  DeepEcho();
    54                 void  Demarshall(char** pmarshalled_dataset);
    55                 void  Echo();
    56                 int   Enum();
    5753                int   Id();
     54                int   MyRank();
    5855                void  Marshall(char** pmarshalled_dataset);
    5956                int   MarshallSize();
    60                 int   MyRank();
     57                void  Demarshall(char** pmarshalled_dataset);
     58                int   Enum();
     59                Object* copy();
    6160                /*}}}*/
    6261                /*Update virtual functions resolution: {{{1*/
     
    6968                void    InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");}
    7069                /*}}}*/
    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);
    7472                void  CreateKMatrix(Mat Kgg);
    7573                void  CreatePVector(Vec pg);
    7674                void  PenaltyCreateKMatrix(Mat Kgg,double kmax);
    7775                void  PenaltyCreatePVector(Vec pg,double kmax);
     76                bool  InAnalysis(int analysis_type);
     77                /*}}}*/
     78                /*Riftfront management: {{{1*/
     79                void  GetDofList(int* doflist,int* pnumberofdofs);
    7880                bool  PreStable();
    7981                void  SetPreStable();
  • issm/trunk/src/c/objects/Materials/Material.h

    r4244 r4248  
    1818        public:
    1919                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;
    2720};
    2821#endif
  • issm/trunk/src/c/objects/Materials/Matice.cpp

    r4244 r4248  
    1616#include "../../include/include.h"
    1717               
    18 /*Object constructors and destructor*/
     18/*Matice constructors and destructor*/
    1919/*FUNCTION Matice::Matice(){{{1*/
    2020Matice::Matice(){
     
    7979/*}}}*/
    8080
    81 /*Object marshall*/
     81/*Object virtual functions definitions:*/
     82/*FUNCTION Matice::Echo {{{1*/
     83void 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*/
     93void 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*/
     103int    Matice::Id(void){ return mid; }
     104/*}}}*/
     105/*FUNCTION Matice::MyRank {{{1*/
     106int    Matice::MyRank(void){
     107        extern int my_rank;
     108        return my_rank;
     109}
     110/*}}}*/
    82111/*FUNCTION Matice::Marshall {{{1*/
    83112void  Matice::Marshall(char** pmarshalled_dataset){
     
    130159}
    131160/*}}}*/
    132 
    133 /*Object functions*/
     161/*FUNCTION Matice::Enum {{{1*/
     162int Matice::Enum(void){
     163
     164        return MaticeEnum;
     165
     166}
     167/*}}}*/
    134168/*FUNCTION Matice::copy {{{1*/
    135169Object* Matice::copy() {
     
    137171}
    138172/*}}}*/
    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*/
    166175/*FUNCTION Matice::GetB {{{1*/
    167176double Matice::GetB(){
    168177        return B;
    169178}
    170 /*}}}*/
    171 /*FUNCTION Matice::Id {{{1*/
    172 int    Matice::Id(void){ return mid; }
    173179/*}}}*/
    174180/*FUNCTION Matice::GetN {{{1*/
     
    430436}
    431437/*}}}*/
    432 /*FUNCTION Matice::MyRank {{{1*/
    433 int    Matice::MyRank(void){
    434         extern int my_rank;
    435         return my_rank;
    436 }
    437 /*}}}*/
    438438/*FUNCTION Matice::SetB {{{1*/
    439439void  Matice::SetB(double B_param){
  • issm/trunk/src/c/objects/Materials/Matice.h

    r4244 r4248  
    2121        public:
    2222
     23                /*Matice constructors, destructors: {{{1*/
    2324                Matice();
    2425                Matice(int mid,double B,double n);
     
    2627                void Init(int mid,double B,double n);
    2728                ~Matice();
    28 
    29                 /*Object virtual functions resolution: {{{1*/
     29                /*}}}*/
     30                /*Object virtual functions definitions:{{{1 */
    3031                void  Echo();
    31                 Object* copy();
    3232                void  DeepEcho();
     33                int   Id();
     34                int   MyRank();
    3335                void  Marshall(char** pmarshalled_dataset);
    3436                int   MarshallSize();
    3537                void  Demarshall(char** pmarshalled_dataset);
    3638                int   Enum();
    37                 int   Id();
    38                 int   MyRank();
     39                Object* copy();
    3940                /*}}}*/
    40                 /*Update virtual functions resolution: {{{1*/
     41                /*Update virtual functions definitions: {{{1*/
    4142                void  InputUpdateFromVector(double* vector, int name, int type);
    4243                void  InputUpdateFromVector(int* vector, int name, int type);
     
    4748                void  InputUpdateFromSolution(double* solution);
    4849                /*}}}*/
    49                 /*Numerics: {{{1*/
     50                /*Matice Numerics: {{{1*/
    5051                void   SetB(double B_param);
    5152                void   GetViscosity2d(double* pviscosity, double* pepsilon);
  • issm/trunk/src/c/objects/Materials/Matpar.cpp

    r4244 r4248  
    1818
    1919               
    20 /*Object constructors and destructor*/
     20/*Matpar constructors and destructor*/
    2121/*FUNCTION Matpar::Matpar() {{{1*/
    2222Matpar::Matpar(){
     
    8484/*}}}1*/
    8585
    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*/
     88void 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*/
     106void 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*/
     124int    Matpar::Id(void){ return mid; }
     125/*}}}1*/
     126/*FUNCTION Matpar::MyRank {{{1*/
     127int    Matpar::MyRank(void){
     128        extern int my_rank;
     129        return my_rank;
    113130}
    114131/*}}}1*/
     
    162179}
    163180/*}}}1*/
    164 
    165 /*Object functions*/
     181/*FUNCTION Matpar::Demarshall {{{1*/
     182void  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*/
     210int Matpar::Enum(void){
     211
     212        return MatparEnum;
     213
     214}
     215/*}}}1*/
    166216/*FUNCTION Matpar::copy {{{1*/
    167217Object* Matpar::copy() {
     
    169219}
    170220/*}}}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: */
    214223/*FUNCTION Matpar::GetBeta {{{1*/
    215224double Matpar::GetBeta(){
     
    226235        return heatcapacity;
    227236}
    228 /*}}}1*/
    229 /*FUNCTION Matpar::Id {{{1*/
    230 int    Matpar::Id(void){ return mid; }
    231237/*}}}1*/
    232238/*FUNCTION Matpar::GetLatentHeat {{{1*/
     
    266272}
    267273/*}}}1*/
    268 /*FUNCTION Matpar::MyRank {{{1*/
    269 int    Matpar::MyRank(void){
    270         extern int my_rank;
    271         return my_rank;
    272 }
    273 /*}}}1*/
    274274/*FUNCTION Matpar::InputUpdateFromVector(double* vector, int name, int type) {{{1*/
    275275void   Matpar::InputUpdateFromVector(double* vector, int name, int type){
  • issm/trunk/src/c/objects/Materials/Matpar.h

    r4244 r4248  
    3636                ~Matpar();
    3737
    38                 /*Object virtual functions resolution: {{{1*/
     38                /*Object virtual functions definitions:{{{1 */
    3939                void  Echo();
    4040                void  DeepEcho();
     41                int   Id();
     42                int   MyRank();
    4143                void  Marshall(char** pmarshalled_dataset);
    4244                int   MarshallSize();
    4345                void  Demarshall(char** pmarshalled_dataset);
    4446                int   Enum();
    45                 int   Id();
    4647                Object* copy();
    47                 int   MyRank();
    4848                /*}}}*/
    4949                /*Update virtual functions resolution: {{{1*/
  • issm/trunk/src/c/objects/Node.cpp

    r4244 r4248  
    1818#include "../include/include.h"
    1919/*}}}*/
    20 
    21 /*Object constructors and destructors: {{{1*/
     20/*Node constructors and destructors: {{{1*/
    2221/*FUNCTION Node::Node() default constructor {{{2*/
    2322Node::Node(){
     
    176175/*}}}*/
    177176/*}}}*/
    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*/
     179void 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}
    197192/*}}}*/
    198193/*FUNCTION Node::DeepEcho{{{2*/
     
    214209}
    215210/*}}}*/
    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 the
    225          *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 /*}}}*/
    294211/*FUNCTION Node::Id{{{2*/
    295212int    Node::Id(void){ return id; }
    296213/*}}}*/
    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*/
     215int    Node::MyRank(void){
     216        extern int my_rank;
     217
     218        return my_rank;
    316219}
    317220/*}}}*/
     
    369272}
    370273/*}}}*/
     274/*FUNCTION Node::Demarshall{{{2*/
     275void  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*/
     303int Node::Enum(void){
     304
     305        return NodeEnum;
     306
     307}
     308/*}}}*/
     309/*FUNCTION Node::copy {{{2*/
     310Object* 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*/
     320void  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*/
     331int   Node::GetDof(int dofindex){
     332
     333        return indexing.doflist[dofindex];
     334
     335}
     336/*}}}*/
     337/*FUNCTION Node::GetDofList1{{{2*/
     338int  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*/
     348void  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*/
     359int    Node::Sid(void){ return sid; }
     360/*}}}*/
     361/*FUNCTION Node::GetVertexId {{{2*/
     362int   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*/
     371int   Node::GetVertexDof(void){
     372
     373        Vertex*  vertex=NULL;
     374
     375        vertex=(Vertex*)hvertex.delivers();
     376        return vertex->dof;
     377}
     378/*}}}*/
    371379/*FUNCTION Node::SetVertexDof {{{2*/
    372380void   Node::SetVertexDof(int in_dof){
     
    386394/*}}}*/
    387395/*}}}*/
    388 /*Object numerics: {{{1*/
     396/*Node numerics: {{{1*/
    389397/*FUNCTION Node::ApplyConstraints{{{2*/
    390398void  Node::ApplyConstraint(Vec yg,int dof,double value){
     
    783791}
    784792/*}}}*/
    785 /*FUNCTION Node::MyRank{{{2*/
    786 int    Node::MyRank(void){
    787         extern int my_rank;
    788 
    789         return my_rank;
    790 }
    791 /*}}}*/
    792793/*FUNCTION Node::InputUpdateFromVector(double* vector, int name, int type){{{2*/
    793794void  Node::InputUpdateFromVector(double* vector, int name, int type){
  • issm/trunk/src/c/objects/Node.h

    r4244 r4248  
    3434        public:
    3535
    36                 /*FUNCTION constructors, destructors {{{1*/
     36                /*Node constructors, destructors {{{1*/
    3737                Node();
    3838                Node(int id,int sid, int vertex_id, int upper_node_id, int numberofdofs);
     
    4141                ~Node();
    4242                /*}}}*/
    43                 /*Object virtual functions resolution: {{{1*/
    44                 void  Configure(DataSet* nodes,Vertices* vertices);
     43                /*Object virtual functions definitions:{{{1 */
     44                void  Echo();
    4545                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();
    5148                void  Marshall(char** pmarshalled_dataset);
    5249                int   MarshallSize();
    53                 int   MyRank(void);
     50                void  Demarshall(char** pmarshalled_dataset);
     51                int   Enum();
     52                Object* copy();
    5453                /*}}}*/
    55                 /*Update virtual functions resolution: {{{1*/
     54                /*Update virtual functions definitions: {{{1*/
    5655                void  InputUpdateFromVector(double* vector, int name, int type);
    5756                void  InputUpdateFromVector(int* vector, int name, int type);
     
    6261                void  InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");}
    6362                /*}}}*/
    64                 /*FUNCTION numerical routines {{{1*/
     63                /*Node numerical routines {{{1*/
     64                void  Configure(DataSet* nodes,Vertices* vertices);
     65                int   Sid(void);
    6566                int   GetVertexDof(void);
    6667                int   GetVertexId(void);
     
    8283                double GetZ();
    8384                double GetSigma();
    84                 Object* copy();
    8585                Node* GetUpperNode();
    8686                int   IsOnBed();
     
    9393                void  VecExtrude(Vec vector,double* vector_serial);
    9494                /*}}}*/
    95                 /*FUNCTION DofObject routines {{{1*/
     95                /*Dof Object routines {{{1*/
    9696                void  DistributeDofs(int* pdofcount);
    9797                void  OffsetDofs(int dofcount);
  • issm/trunk/src/c/objects/Object.h

    r4244 r4248  
    1515
    1616        public:
     17
    1718                virtual       ~Object() {};
    1819                virtual void  Echo()=0;
     
    2526                virtual int   Enum()=0;
    2627                virtual Object* copy()=0;
     28
    2729};
    2830#endif
  • issm/trunk/src/c/objects/Params/BoolParam.cpp

    r4244 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*BoolParam constructors and destructor*/
    2323/*FUNCTION BoolParam::BoolParam(){{{1*/
    2424BoolParam::BoolParam(){
     
    3939/*}}}*/
    4040
    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*/
     43void BoolParam::Echo(void){
     44        this->DeepEcho();
    4745}
    4846/*}}}*/
     
    5553}
    5654/*}}}*/
    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 the
    67          *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 /*}}}*/
    8855/*FUNCTION BoolParam::Id{{{1*/
    8956int    BoolParam::Id(void){ return -1; }
     57/*}}}*/
     58/*FUNCTION BoolParam::MyRank{{{1*/
     59int    BoolParam::MyRank(void){
     60        extern int my_rank;
     61        return my_rank;
     62}
    9063/*}}}*/
    9164/*FUNCTION BoolParam::Marshall{{{1*/
     
    11992}
    12093/*}}}*/
    121 /*FUNCTION BoolParam::MyRank{{{1*/
    122 int    BoolParam::MyRank(void){
    123         extern int my_rank;
    124         return my_rank;
     94/*FUNCTION BoolParam::Demarshall{{{1*/
     95void  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;
    125111}
    126112/*}}}*/
     113/*FUNCTION BoolParam::Enum{{{1*/
     114int BoolParam::Enum(void){
     115
     116        return BoolParamEnum;
     117
     118}
     119/*}}}*/
     120/*FUNCTION BoolParam::copy{{{1*/
     121Object* BoolParam::copy() {
     122       
     123        return new BoolParam(this->enum_type,this->value);
     124
     125}
     126/*}}}*/
     127
     128/*BoolParam virtual functions definitions: */
    127129/*FUNCTION BoolParam::GetParameterName(void); {{{1*/
    128130char* BoolParam::GetParameterName(void){
  • issm/trunk/src/c/objects/Params/BoolParam.h

    r4244 r4248  
    3535                IssmBool value;
    3636
    37                 /*constructors, destructors: {{{1*/
     37                /*BoolParam constructors, destructors: {{{1*/
    3838                BoolParam();
    3939                BoolParam(int enum_type,IssmBool value);
    4040                ~BoolParam();
    4141                /*}}}*/
    42                 /*Object methods: {{{1*/
    43                 Object* copy();
     42                /*Object virtual functions definitions:{{{1 */
     43                void  Echo();
    4444                void  DeepEcho();
    45                 void  Demarshall(char** pmarshalled_dataset);
    46                 void  Echo();
    47                 int   Enum();
    48                 int   Id();
     45                int   Id();
     46                int   MyRank();
    4947                void  Marshall(char** pmarshalled_dataset);
    5048                int   MarshallSize();
    51                 int   MyRank();
     49                void  Demarshall(char** pmarshalled_dataset);
     50                int   Enum();
     51                Object* copy();
    5252                /*}}}*/
    53                 /*Param methods: {{{1*/
     53                /*Param vritual function definitions: {{{1*/
    5454                int   EnumType(){return enum_type;}
    5555                void  GetParameterValue(bool* pbool){*pbool=value;}
  • issm/trunk/src/c/objects/Params/DoubleMatParam.cpp

    r4244 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*DoubleMatParam constructors and destructor*/
    2323/*FUNCTION DoubleMatParam::DoubleMatParam(){{{1*/
    2424DoubleMatParam::DoubleMatParam(){
     
    4444/*}}}*/
    4545
    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*/
     48void 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);
    5153
    5254}
     
    6769}
    6870/*}}}*/
     71/*FUNCTION DoubleMatParam::Id{{{1*/
     72int    DoubleMatParam::Id(void){ return -1; }
     73/*}}}*/
     74/*FUNCTION DoubleMatParam::MyRank{{{1*/
     75int    DoubleMatParam::MyRank(void){
     76        extern int my_rank;
     77        return my_rank;
     78}
     79/*}}}*/
     80/*FUNCTION DoubleMatParam::Marshall{{{1*/
     81void  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*/
     105int   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/*}}}*/
    69114/*FUNCTION DoubleMatParam::Demarshall{{{1*/
    70115void  DoubleMatParam::Demarshall(char** pmarshalled_dataset){
     
    91136}
    92137/*}}}*/
    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 /*}}}*/
    102138/*FUNCTION DoubleMatParam::Enum{{{1*/
    103139int DoubleMatParam::Enum(void){
     
    107143}
    108144/*}}}*/
    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*/
     146Object* 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: */
    152154/*FUNCTION DoubleMatParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){{{1*/
    153155void  DoubleMatParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){
  • issm/trunk/src/c/objects/Params/DoubleMatParam.h

    r4244 r4248  
    3838
    3939        public:
    40                 /*constructors, destructors: {{{1*/
     40                /*DoubleMatParam constructors, destructors: {{{1*/
    4141                DoubleMatParam();
    4242                DoubleMatParam(int enum_type,IssmDouble* value,int M,int N);
    4343                ~DoubleMatParam();
    4444                /*}}}*/
    45                 /*Object methods: {{{1*/
    46                 Object* copy();
     45                /*Object virtual functions definitions:{{{1 */
     46                void  Echo();
    4747                void  DeepEcho();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 void  Echo();
    50                 int   Enum();
    51                 int   Id();
     48                int   Id();
     49                int   MyRank();
    5250                void  Marshall(char** pmarshalled_dataset);
    5351                int   MarshallSize();
    54                 int   MyRank();
     52                void  Demarshall(char** pmarshalled_dataset);
     53                int   Enum();
     54                Object* copy();
    5555                /*}}}*/
    56                 /*Param methods: {{{1*/
     56                /*Param vritual function definitions: {{{1*/
    5757                int   EnumType(){return enum_type;}
    5858                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  
    1717#include "../../include/include.h"
    1818
    19 /*Object constructors and destructor*/
     19/*DoubleParam constructors and destructor*/
    2020/*FUNCTION DoubleParam::DoubleParam(){{{1*/
    2121DoubleParam::DoubleParam(){
     
    3636/*}}}*/
    3737
    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*/
     40void DoubleParam::Echo(void){
     41        this->DeepEcho();
    4442}
    4543/*}}}*/
     
    5250}
    5351/*}}}*/
    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 the
    64          *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 /*}}}*/
    8552/*FUNCTION DoubleParam::Id{{{1*/
    8653int    DoubleParam::Id(void){ return -1; }
     54/*}}}*/
     55/*FUNCTION DoubleParam::MyRank{{{1*/
     56int    DoubleParam::MyRank(void){
     57        extern int my_rank;
     58        return my_rank;
     59}
    8760/*}}}*/
    8861/*FUNCTION DoubleParam::Marshall{{{1*/
     
    11689}
    11790/*}}}*/
    118 /*FUNCTION DoubleParam::MyRank{{{1*/
    119 int    DoubleParam::MyRank(void){
    120         extern int my_rank;
    121         return my_rank;
     91/*FUNCTION DoubleParam::Demarshall{{{1*/
     92void  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;
    122108}
    123109/*}}}*/
     110/*FUNCTION DoubleParam::Enum{{{1*/
     111int DoubleParam::Enum(void){
     112
     113        return DoubleParamEnum;
     114
     115}
     116/*}}}*/
     117/*FUNCTION DoubleParam::copy{{{1*/
     118Object* DoubleParam::copy() {
     119       
     120        return new DoubleParam(this->enum_type,this->value);
     121
     122}
     123/*}}}*/
     124
     125/*DoubleParam virtual functions definitions: */
    124126/*FUNCTION DoubleParam::GetParameterName(void); {{{1*/
    125127char* DoubleParam::GetParameterName(void){
  • issm/trunk/src/c/objects/Params/DoubleParam.h

    r4244 r4248  
    3636
    3737        public:
    38                 /*constructors, destructors: {{{1*/
     38                /*DoubleParam constructors, destructors: {{{1*/
    3939                DoubleParam();
    4040                DoubleParam(int enum_type,IssmDouble value);
    4141                ~DoubleParam();
    4242                /*}}}*/
    43                 /*Object methods: {{{1*/
    44                 Object* copy();
     43                /*Object virtual functions definitions:{{{1 */
     44                void  Echo();
    4545                void  DeepEcho();
    46                 void  Demarshall(char** pmarshalled_dataset);
    47                 void  Echo();
    48                 int   Enum();
    49                 int   Id();
     46                int   Id();
     47                int   MyRank();
    5048                void  Marshall(char** pmarshalled_dataset);
    5149                int   MarshallSize();
    52                 int   MyRank();
     50                void  Demarshall(char** pmarshalled_dataset);
     51                int   Enum();
     52                Object* copy();
    5353                /*}}}*/
    54                 /*Param methods: {{{1*/
     54                /*Param vritual function definitions: {{{1*/
    5555                int   EnumType(){return enum_type;}
    5656                void  GetParameterValue(bool* pbool);
  • issm/trunk/src/c/objects/Params/DoubleVecParam.cpp

    r4244 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*DoubleVecParam constructors and destructor*/
    2323/*FUNCTION DoubleVecParam::DoubleVecParam(){{{1*/
    2424DoubleVecParam::DoubleVecParam(){
     
    4343/*}}}*/
    4444
    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*/
     47void 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);
    5052
    5153}
     
    6466}
    6567/*}}}*/
     68/*FUNCTION DoubleVecParam::Id{{{1*/
     69int    DoubleVecParam::Id(void){ return -1; }
     70/*}}}*/
     71/*FUNCTION DoubleVecParam::MyRank{{{1*/
     72int    DoubleVecParam::MyRank(void){
     73        extern int my_rank;
     74        return my_rank;
     75}
     76/*}}}*/
     77/*FUNCTION DoubleVecParam::Marshall{{{1*/
     78void  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*/
     101int   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/*}}}*/
    66109/*FUNCTION DoubleVecParam::Demarshall{{{1*/
    67110void  DoubleVecParam::Demarshall(char** pmarshalled_dataset){
     
    87130}
    88131/*}}}*/
    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 /*}}}*/
    98132/*FUNCTION DoubleVecParam::Enum{{{1*/
    99133int DoubleVecParam::Enum(void){
     
    103137}
    104138/*}}}*/
    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*/
     140Object* DoubleVecParam::copy() {
     141       
     142        return new DoubleVecParam(this->enum_type,this->values,this->M);
     143
     144}
     145/*}}}*/
     146
     147/*DoubleVecParam virtual functions definitions: */
    146148/*FUNCTION DoubleVecParam::GetParameterValue(double** pdoublearray,int* pM){{{1*/
    147149void  DoubleVecParam::GetParameterValue(double** pdoublearray,int* pM){
  • issm/trunk/src/c/objects/Params/DoubleVecParam.h

    r4244 r4248  
    3636
    3737        public:
    38                 /*constructors, destructors: {{{1*/
     38                /*DoubleVecParam constructors, destructors: {{{1*/
    3939                DoubleVecParam();
    4040                DoubleVecParam(int enum_type,IssmDouble* values,int M);
    4141                ~DoubleVecParam();
    4242                /*}}}*/
    43                 /*Object methods: {{{1*/
    44                 Object* copy();
     43                /*              /*Object virtual functions definitions:{{{1 */
     44                void  Echo();
    4545                void  DeepEcho();
    46                 void  Demarshall(char** pmarshalled_dataset);
    47                 void  Echo();
    48                 int   Enum();
    49                 int   Id();
     46                int   Id();
     47                int   MyRank();
    5048                void  Marshall(char** pmarshalled_dataset);
    5149                int   MarshallSize();
    52                 int   MyRank();
     50                void  Demarshall(char** pmarshalled_dataset);
     51                int   Enum();
     52                Object* copy();
    5353                /*}}}*/
    54                 /*Param methods: {{{1*/
     54                /*Param virtual functions definitions: {{{1*/
    5555                int   EnumType(){return enum_type;}
    5656                void  GetParameterValue(bool* pbool){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));}
     
    7373                void  SetValue(Vec vec){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7474                void  SetValue(Mat mat){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
    75 
     75               
    7676                char* GetParameterName(void);
    7777                #ifdef _SERIAL_
    7878                void  SetMatlabField(mxArray* dataref);
    7979                #endif
    80 
    8180                /*}}}*/
    8281};
  • issm/trunk/src/c/objects/Params/IntParam.cpp

    r4244 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*IntParam constructors and destructor*/
    2323/*FUNCTION IntParam::IntParam(){{{1*/
    2424IntParam::IntParam(){
     
    3939/*}}}*/
    4040
    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*/
     43void IntParam::Echo(void){
     44        this->DeepEcho();
    4745}
    4846/*}}}*/
     
    5553}
    5654/*}}}*/
    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 the
    67          *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 /*}}}*/
    8855/*FUNCTION IntParam::Id{{{1*/
    8956int    IntParam::Id(void){ return -1; }
     57/*}}}*/
     58/*FUNCTION IntParam::MyRank{{{1*/
     59int    IntParam::MyRank(void){
     60        extern int my_rank;
     61        return my_rank;
     62}
    9063/*}}}*/
    9164/*FUNCTION IntParam::Marshall{{{1*/
     
    11992}
    12093/*}}}*/
    121 /*FUNCTION IntParam::MyRank{{{1*/
    122 int    IntParam::MyRank(void){
    123         extern int my_rank;
    124         return my_rank;
     94/*FUNCTION IntParam::Demarshall{{{1*/
     95void  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;
    125111}
    126112/*}}}*/
     113/*FUNCTION IntParam::Enum{{{1*/
     114int IntParam::Enum(void){
     115
     116        return IntParamEnum;
     117
     118}
     119/*}}}*/
     120/*FUNCTION IntParam::copy{{{1*/
     121Object* IntParam::copy() {
     122       
     123        return new IntParam(this->enum_type,this->value);
     124
     125}
     126/*}}}*/
     127
     128/*IntParam virtual functions definitions: */
    127129/*FUNCTION IntParam::GetParameterName(void); {{{1*/
    128130char* IntParam::GetParameterName(void){
  • issm/trunk/src/c/objects/Params/IntParam.h

    r4244 r4248  
    3535
    3636        public:
    37                 /*constructors, destructors: {{{1*/
     37                /*IntParam constructors, destructors: {{{1*/
    3838                IntParam();
    3939                IntParam(int enum_type,IssmInt value);
    4040                ~IntParam();
    4141                /*}}}*/
    42                 /*Object methods: {{{1*/
    43                 Object* copy();
     42                /*Object virtual functions definitions:{{{1 */
     43                void  Echo();
    4444                void  DeepEcho();
    45                 void  Demarshall(char** pmarshalled_dataset);
    46                 void  Echo();
    47                 int   Enum();
    48                 int   Id();
     45                int   Id();
     46                int   MyRank();
    4947                void  Marshall(char** pmarshalled_dataset);
    5048                int   MarshallSize();
    51                 int   MyRank();
     49                void  Demarshall(char** pmarshalled_dataset);
     50                int   Enum();
     51                Object* copy();
    5252                /*}}}*/
    53                 /*Param methods: {{{1*/
     53                /*Param vritual function definitions: {{{1*/
    5454                int   EnumType(){return enum_type;}
    5555                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  
    3030                virtual        ~Param(){};
    3131
    32                 /*methods:{{{1*/
     32                /*Virtual functions:{{{1*/
    3333                virtual int   EnumType()=0;
    3434                virtual void  GetParameterValue(bool* pbool)=0;
     
    5656                virtual void  SetMatlabField(mxArray* dataref)=0;
    5757                #endif
    58 
    5958                /*}}}*/
    6059
  • issm/trunk/src/c/objects/Params/PetscMatParam.cpp

    r4244 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*PetscMatParam constructors and destructor*/
    2323/*FUNCTION PetscMatParam::PetscMatParam(){{{1*/
    2424PetscMatParam::PetscMatParam(){
     
    4444/*}}}*/
    4545
    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*/
     48void PetscMatParam::Echo(void){
     49
     50        printf("PetscMatParam:\n");
     51        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5152
    5253}
     
    5960        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    6061        MatView(value,PETSC_VIEWER_STDOUT_WORLD);
     62}
     63/*}}}*/
     64/*FUNCTION PetscMatParam::Id{{{1*/
     65int    PetscMatParam::Id(void){ return -1; }
     66/*}}}*/
     67/*FUNCTION PetscMatParam::MyRank{{{1*/
     68int    PetscMatParam::MyRank(void){
     69        extern int my_rank;
     70        return my_rank;
     71}
     72/*}}}*/
     73/*FUNCTION PetscMatParam::Marshall{{{1*/
     74void  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*/
     114int   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
    61125}
    62126/*}}}*/
     
    108172}
    109173/*}}}*/
    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 /*}}}*/
    118174/*FUNCTION PetscMatParam::Enum{{{1*/
    119175int PetscMatParam::Enum(void){
     
    123179}
    124180/*}}}*/
    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*/
     182Object* PetscMatParam::copy() {
     183       
     184        return new PetscMatParam(this->enum_type,this->value);
     185
     186}
     187/*}}}*/
     188
     189/*PetscMatParam virtual functions definitions: */
    188190/*FUNCTION PetscMatParam::GetParameterValue(Mat* pvalue){{{1*/
    189191void  PetscMatParam::GetParameterValue(Mat* poutput){
  • issm/trunk/src/c/objects/Params/PetscMatParam.h

    r4244 r4248  
    3636
    3737        public:
    38                 /*constructors, destructors: {{{1*/
     38                /*PetscMatParam constructors, destructors: {{{1*/
    3939                PetscMatParam();
    4040                PetscMatParam(int enum_type,Mat value);
    4141                ~PetscMatParam();
    4242                /*}}}*/
    43                 /*Object methods: {{{1*/
    44                 Object* copy();
     43                /*Object virtual functions definitions:{{{1 */
     44                void  Echo();
    4545                void  DeepEcho();
    46                 void  Demarshall(char** pmarshalled_dataset);
    47                 void  Echo();
    48                 int   Enum();
    49                 int   Id();
     46                int   Id();
     47                int   MyRank();
    5048                void  Marshall(char** pmarshalled_dataset);
    5149                int   MarshallSize();
    52                 int   MyRank();
     50                void  Demarshall(char** pmarshalled_dataset);
     51                int   Enum();
     52                Object* copy();
    5353                /*}}}*/
    54                 /*Param methods: {{{1*/
     54                /*Param vritual function definitions: {{{1*/
    5555                int   EnumType(){return enum_type;}
    5656                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  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*PetscVecParam constructors and destructor*/
    2323/*FUNCTION PetscVecParam::PetscVecParam(){{{1*/
    2424PetscVecParam::PetscVecParam(){
     
    4545/*}}}*/
    4646
    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*/
     49void PetscVecParam::Echo(void){
     50
     51        printf("PetscVecParam:\n");
     52        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    5253
    5354}
     
    6263}
    6364/*}}}*/
    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 the
    77          *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 /*}}}*/
    12465/*FUNCTION PetscVecParam::Id{{{1*/
    12566int    PetscVecParam::Id(void){ return -1; }
     67/*}}}*/
     68/*FUNCTION PetscVecParam::MyRank{{{1*/
     69int    PetscVecParam::MyRank(void){
     70        extern int my_rank;
     71        return my_rank;
     72}
    12673/*}}}*/
    12774/*FUNCTION PetscVecParam::Marshall{{{1*/
     
    172119}
    173120/*}}}*/
    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*/
     122void  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*/
     167int PetscVecParam::Enum(void){
     168
     169        return PetscVecParamEnum;
     170
     171}
     172/*}}}*/
     173/*FUNCTION PetscVecParam::copy{{{1*/
     174Object* PetscVecParam::copy() {
     175       
     176        return new PetscVecParam(this->enum_type,this->value);
     177
     178}
     179/*}}}*/
     180
     181/*PetscVecParam virtual functions definitions: */
    180182/*FUNCTION PetscVecParam::GetParameterValue(Vec* pvalue){{{1*/
    181183void  PetscVecParam::GetParameterValue(Vec* poutput){
  • issm/trunk/src/c/objects/Params/PetscVecParam.h

    r4244 r4248  
    3636
    3737        public:
    38                 /*constructors, destructors: {{{1*/
     38                /*PetscVecParam constructors, destructors: {{{1*/
    3939                PetscVecParam();
    4040                PetscVecParam(int enum_type,Vec value);
    4141                ~PetscVecParam();
    4242                /*}}}*/
    43                 /*Object methods: {{{1*/
    44                 Object* copy();
     43                /*Object virtual functions definitions:{{{1 */
     44                void  Echo();
    4545                void  DeepEcho();
    46                 void  Demarshall(char** pmarshalled_dataset);
    47                 void  Echo();
    48                 int   Enum();
    49                 int   Id();
     46                int   Id();
     47                int   MyRank();
    5048                void  Marshall(char** pmarshalled_dataset);
    5149                int   MarshallSize();
    52                 int   MyRank();
     50                void  Demarshall(char** pmarshalled_dataset);
     51                int   Enum();
     52                Object* copy();
    5353                /*}}}*/
    54                 /*Param methods: {{{1*/
     54                /*Param vritual function definitions: {{{1*/
    5555                int   EnumType(){return enum_type;}
    5656                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  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*StringArrayParam constructors and destructor*/
    2323/*FUNCTION StringArrayParam::StringArrayParam(){{{1*/
    2424StringArrayParam::StringArrayParam(){
     
    6060/*}}}*/
    6161
    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:*/
    11663/*FUNCTION StringArrayParam::Echo {{{1*/
    11764void StringArrayParam::Echo(void){
     
    11966}
    12067/*}}}*/
    121 /*FUNCTION StringArrayParam::Enum{{{1*/
    122 int StringArrayParam::Enum(void){
    123 
    124         return StringArrayParamEnum;
    125 
     68/*FUNCTION StringArrayParam::DeepEcho{{{1*/
     69void 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        }
    12680}
    12781/*}}}*/
    12882/*FUNCTION StringArrayParam::Id{{{1*/
    12983int    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 value
    182 
    183         return marshallsize;
    184 }
    18584/*}}}*/
    18685/*FUNCTION StringArrayParam::MyRank{{{1*/
     
    19089}
    19190/*}}}*/
     91/*FUNCTION StringArrayParam::Marshall{{{1*/
     92void  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*/
     124int   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*/
     147void  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*/
     179int StringArrayParam::Enum(void){
     180
     181        return StringArrayParamEnum;
     182
     183}
     184/*}}}*/
     185/*FUNCTION StringArrayParam::copy{{{1*/
     186Object* StringArrayParam::copy() {
     187       
     188        return new StringArrayParam(this->enum_type,this->value,this->numstrings);
     189
     190}
     191/*}}}*/
     192
     193/*StringArrayParam virtual functions definitions: */
    192194/*FUNCTION StringArrayParam::GetParameterValue(char*** pstringarray, int* pnumstrings){{{1*/
    193195void  StringArrayParam::GetParameterValue(char*** pstringarray,int* pM){
  • issm/trunk/src/c/objects/Params/StringArrayParam.h

    r4244 r4248  
    3838
    3939        public:
    40                 /*constructors, destructors: {{{1*/
     40                /*StringArrayParam constructors, destructors: {{{1*/
    4141                StringArrayParam();
    4242                StringArrayParam(int enum_type,char** values, int numstrings);
    4343                ~StringArrayParam();
    4444                /*}}}*/
    45                 /*Object methods: {{{1*/
    46                 Object* copy();
     45                /*Object virtual functions definitions:{{{1 */
     46                void  Echo();
    4747                void  DeepEcho();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 void  Echo();
    50                 int   Enum();
    51                 int   Id();
     48                int   Id();
     49                int   MyRank();
    5250                void  Marshall(char** pmarshalled_dataset);
    5351                int   MarshallSize();
    54                 int   MyRank();
     52                void  Demarshall(char** pmarshalled_dataset);
     53                int   Enum();
     54                Object* copy();
    5555                /*}}}*/
    56                 /*Param methods: {{{1*/
     56                /*Param vritual function definitions: {{{1*/
    5757                int   EnumType(){return enum_type;}
    5858                void  GetParameterValue(bool* pbool){ISSMERROR("StringArray param of enum %i (%s) cannot return a bool",enum_type,EnumAsString(enum_type));}
     
    8080                void  SetMatlabField(mxArray* dataref);
    8181                #endif
    82 
    8382                /*}}}*/
    8483};
  • issm/trunk/src/c/objects/Params/StringParam.cpp

    r4244 r4248  
    2020/*}}}*/
    2121
    22 /*Object constructors and destructor*/
     22/*StringParam constructors and destructor*/
    2323/*FUNCTION StringParam::StringParam(){{{1*/
    2424StringParam::StringParam(){
     
    4141/*}}}*/
    4242
    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*/
     45void StringParam::Echo(void){
     46        this->DeepEcho();
    4947}
    5048/*}}}*/
     
    5755}
    5856/*}}}*/
    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 the
    70          *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 /*}}}*/
    9557/*FUNCTION StringParam::Id{{{1*/
    9658int    StringParam::Id(void){ return -1; }
     59/*}}}*/
     60/*FUNCTION StringParam::MyRank{{{1*/
     61int    StringParam::MyRank(void){
     62        extern int my_rank;
     63        return my_rank;
     64}
    9765/*}}}*/
    9866/*FUNCTION StringParam::Marshall{{{1*/
     
    134102}
    135103/*}}}*/
    136 /*FUNCTION StringParam::MyRank{{{1*/
    137 int    StringParam::MyRank(void){
    138         extern int my_rank;
    139         return my_rank;
     104/*FUNCTION StringParam::Demarshall{{{1*/
     105void  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;
    140126}
    141127/*}}}*/
     128/*FUNCTION StringParam::Enum{{{1*/
     129int StringParam::Enum(void){
     130
     131        return StringParamEnum;
     132
     133}
     134/*}}}*/
     135/*FUNCTION StringParam::copy{{{1*/
     136Object* StringParam::copy() {
     137       
     138        return new StringParam(this->enum_type,this->value);
     139
     140}
     141/*}}}*/
     142
     143/*StringParam virtual functions definitions: */
    142144/*FUNCTION StringParam::GetParameterValue(char** pstring){{{1*/
    143145void  StringParam::GetParameterValue(char** pstring){
  • issm/trunk/src/c/objects/Params/StringParam.h

    r4244 r4248  
    3636
    3737        public:
    38                 /*constructors, destructors: {{{1*/
     38                /*StringParam constructors, destructors: {{{1*/
    3939                StringParam();
    4040                StringParam(int enum_type,char* value);
    4141                ~StringParam();
    4242                /*}}}*/
    43                 /*Object methods: {{{1*/
    44                 Object* copy();
     43                /*Object virtual functions definitions:{{{1 */
     44                void  Echo();
    4545                void  DeepEcho();
    46                 void  Demarshall(char** pmarshalled_dataset);
    47                 void  Echo();
    48                 int   Enum();
    49                 int   Id();
     46                int   Id();
     47                int   MyRank();
    5048                void  Marshall(char** pmarshalled_dataset);
    5149                int   MarshallSize();
    52                 int   MyRank();
     50                void  Demarshall(char** pmarshalled_dataset);
     51                int   Enum();
     52                Object* copy();
    5353                /*}}}*/
    54                 /*Param methods: {{{1*/
     54                /*Param vritual function definitions: {{{1*/
    5555                int   EnumType(){return enum_type;}
    5656                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  
    1717/*}}}*/
    1818
    19 /*Object constructors and destructor{{{1*/
    20 /*FUNCTION Vertex::Vertex() {{{2*/
     19/*Vertex constructors and destructor:*/
     20/*FUNCTION Vertex::Vertex() {{{1*/
    2121Vertex::Vertex(){
    2222        return;
    2323}
    2424/*}}}*/
    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*/
    2626Vertex::Vertex(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){
    2727        this->Init(vertex_id, vertex_sid,vertex_x, vertex_y, vertex_z, vertex_sigma);
    2828}
    2929/*}}}*/
    30 /*FUNCTION Vertex::Init{{{2*/
     30/*FUNCTION Vertex::Init{{{1*/
    3131void Vertex::Init(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){
    3232
     
    4343}
    4444/*}}}*/
    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*/
    4646Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel){
    4747
     
    5050}
    5151/*}}}*/
    52 /*FUNCTION Vertex::~Vertex() {{{2*/
     52/*FUNCTION Vertex::~Vertex() {{{1*/
    5353Vertex::~Vertex(){
    5454        return;
    5555}
    5656/*}}}*/
    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*/
    10060void Vertex::Echo(void){
    10161
     
    11373}
    11474/*}}}*/
    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
     77void Vertex::DeepEcho(void){
     78        this->Echo();
     79}
     80/*}}}*/
     81/*FUNCTION Id{{{1*/
    12382int    Vertex::Id(void){ return id; }
    12483/*}}}*/
    125 /*FUNCTION Sid{{{2*/
    126 int    Vertex::Sid(void){ return sid; }
    127 /*}}}*/
    128 /*FUNCTION Marshall {{{2*/
     84/*FUNCTION MyRank {{{1*/
     85int    Vertex::MyRank(void){
     86        extern int my_rank;
     87        return my_rank;
     88}
     89/*}}}*/
     90/*FUNCTION Marshall {{{1*/
    12991void  Vertex::Marshall(char** pmarshalled_dataset){
    13092
     
    155117}
    156118/*}}}*/
    157 /*FUNCTION MarshallSize {{{2*/
     119/*FUNCTION MarshallSize {{{1*/
    158120int   Vertex::MarshallSize(){
    159121       
     
    169131}
    170132/*}}}*/
    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*/
     134void  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*/
     160int Vertex::Enum(void){
     161
     162        return VertexEnum;
     163
     164}
     165/*}}}*/
     166/*FUNCTION copy {{{1*/
     167Object* Vertex::copy() {
     168
     169        return new Vertex(*this);
     170
     171}
     172/*}}}*/
     173
     174/* DofObject routines: */
     175/*FUNCTION Vertex DistributeDofs{{{1*/
    195176void  Vertex::DistributeDofs(int* pdofcount){
    196177
     
    215196}
    216197/*}}}*/
    217 /*FUNCTION Vertex OffsetDofs{{{2*/
     198/*FUNCTION Vertex OffsetDofs{{{1*/
    218199void  Vertex::OffsetDofs(int dofcount){
    219200       
     
    230211}
    231212/*}}}*/
    232 /*FUNCTION Vertex ShowTrueDofs{{{2*/
     213/*FUNCTION Vertex ShowTrueDofs{{{1*/
    233214void  Vertex::ShowTrueDofs(int* truedofs){
    234215
     
    244225}
    245226/*}}}*/
    246 /*FUNCTION Vertex UpdateCloneDofs{{{2*/
     227/*FUNCTION Vertex UpdateCloneDofs{{{1*/
    247228void  Vertex::UpdateCloneDofs(int* alltruedofs){
    248229
     
    258239}
    259240/*}}}*/
    260 /*FUNCTION Vertex SetClone {{{2*/
     241/*FUNCTION Vertex SetClone {{{1*/
    261242void  Vertex::SetClone(int* minranks){
    262243
     
    274255}
    275256/*}}}*/
    276 /*FUNCTION Vertex CreatePartition{{{2*/
     257/*FUNCTION Vertex CreatePartition{{{1*/
    277258void  Vertex::CreatePartition(Vec partition){
    278259
     
    289270}
    290271/*}}}*/
    291 /*}}}*/
     272
     273/*Vertex management: */
     274/*FUNCTION Sid{{{1*/
     275int    Vertex::Sid(void){ return sid; }
     276/*}}}*/
     277/*FUNCTION UpdateFromDakota {{{1*/
     278void  Vertex::UpdateFromDakota(void* vinputs){
     279
     280        ISSMERROR("not supported yet!");
     281       
     282}
     283/*}}}*/
     284/*FUNCTION UpdateVertexPosition {{{1*/
     285void  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  
    3232                int    dof; //dof to recover values in a vertex indexed vector
    3333
    34                 /*FUNCTION constructors, destructors {{{1*/
     34                /*Vertex constructors, destructors {{{1*/
    3535                Vertex();
    3636                Vertex(int id, int sid,double x, double y, double z, double sigma);
     
    3939                ~Vertex();
    4040                /*}}}*/
    41                 /*FUNCTION object management {{{1*/
    42                 Object* copy();
     41                /*Object virtual functions definitions:{{{1 */
     42                void  Echo();
    4343                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();
    4946                void  Marshall(char** pmarshalled_dataset);
    5047                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();
    5451                /*}}}*/
    55                 /*FUNCTION DofObject routines {{{1*/
     52                /*DofObject routines {{{1*/
    5653                void  DistributeDofs(int* pdofcount);
    5754                void  OffsetDofs(int dofcount);
     
    6158                void  CreatePartition(Vec partition);
    6259                /*}}}*/
    63 
     60                /*Vertex management: {{{1*/
     61                int   Sid(void);
     62                void  UpdateFromDakota(void* vinputs);
     63                void  UpdatePosition(double* thickness,double* bed);
     64                /*}}}*/
    6465};
    6566#endif  /* _VERTEX_H */
Note: See TracChangeset for help on using the changeset viewer.