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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.