Changeset 12330 for issm/trunk


Ignore:
Timestamp:
06/01/12 17:26:03 (13 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 12326M

Location:
issm/trunk/src/c
Files:
13 deleted
248 edited
57 copied

Legend:

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

    r10522 r12330  
    4848
    4949        /*figure out total number of constraints combining all the cpus (no clones here)*/
    50         #ifdef _PARALLEL_
    51         MPI_Reduce(&localconstraints,&numberofconstraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    52         MPI_Bcast(&numberofconstraints,1,MPI_INT,0,MPI_COMM_WORLD);
     50        #ifdef _HAVE_MPI_
     51                MPI_Reduce(&localconstraints,&numberofconstraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
     52                MPI_Bcast(&numberofconstraints,1,MPI_INT,0,MPI_COMM_WORLD);
    5353        #else
    54         numberofconstraints=localconstraints;
     54                numberofconstraints=localconstraints;
    5555        #endif
     56       
    5657
    5758        return numberofconstraints;
  • issm/trunk/src/c/Container/DataSet.cpp

    r11995 r12330  
    1111#endif
    1212
     13#include <cstring>
    1314#include <vector>
    1415#include <functional>
     
    8485/*}}}*/
    8586
    86 /*I/O*/
    87 #ifdef _SERIAL_
    88 /*FUNCTION DataSet::Marshall{{{1*/
    89 char* DataSet::Marshall(){
    90 
    91         vector<Object*>::iterator object;
    92         int                       object_size;
    93         int                       marshalled_dataset_size=0;
    94         char*                     marshalled_dataset=NULL;
    95         char*                     old_marshalled_dataset=NULL;
    96 
    97         /*First get size of marshalled dataset: */
    98         object_size=(int)objects.size();
    99 
    100         marshalled_dataset_size=MarshallSize();
    101        
    102         /*Allocate marshalled dataset: */
    103         marshalled_dataset=(char*)xmalloc(marshalled_dataset_size*sizeof(char));
    104 
    105         /*Keep track of old_marshalled_dataset: */
    106         old_marshalled_dataset=marshalled_dataset;
    107 
    108         /*Store internals of dataset first: */
    109         memcpy(marshalled_dataset,&object_size,sizeof(int)); marshalled_dataset+=sizeof(int);
    110         memcpy(marshalled_dataset,&sorted,sizeof(int)); marshalled_dataset+=sizeof(int);
    111         if(sorted){
    112                 if(object_size)memcpy(marshalled_dataset,sorted_ids,object_size*sizeof(int)); marshalled_dataset+=object_size*sizeof(int);
    113                 if(object_size)memcpy(marshalled_dataset,id_offsets,object_size*sizeof(int)); marshalled_dataset+=object_size*sizeof(int);
    114         }
    115 
    116         for ( object=objects.begin() ; object < objects.end(); object++ ){
    117                 (*object)->Marshall(&marshalled_dataset);
    118         }
    119 
    120         /* Ok, marshalled_dataset now points to the end of the original marshalled_dataset pointer
    121          * before  we started the loop on objects. Get object to point right again: */
    122         marshalled_dataset-=marshalled_dataset_size;
    123 
    124         /*We should be back to old_marshalled_dataset: check and abort if that's not the case,
    125          * because this is a nasty error: */
    126         if (marshalled_dataset!=old_marshalled_dataset){
    127                 _error_("final marshalled dataset \"%s\" is different from initial one!",EnumToStringx(enum_type));
    128                 abort();
    129         }
    130 
    131         /*Return: */
    132         return marshalled_dataset;
    133 }
    134 /*}}}*/
    135 /*FUNCTION DataSet::MarshallSize{{{1*/
    136 int DataSet::MarshallSize(){
    137 
    138         vector<Object*>::iterator object;
    139         int                      marshalled_dataset_size=0;
    140 
    141 
    142         for ( object=objects.begin() ; object < objects.end(); object++ ){
    143                 marshalled_dataset_size+= (*object)->MarshallSize();
    144         }
    145 
    146         marshalled_dataset_size+=sizeof(int); //objects size
    147         marshalled_dataset_size+=sizeof(int); //sorted size
    148         if(sorted){
    149                 marshalled_dataset_size+=(int)objects.size()*sizeof(int); //sorted ids
    150                 marshalled_dataset_size+=(int)objects.size()*sizeof(int); //id offsets
    151         }
    152 
    153         return marshalled_dataset_size;
    154 }
    155 /*}}}*/
    156 /*FUNCTION DataSet::Demarshall{{{1*/
    157 DataSet* DataSetDemarshall(char* marshalled_dataset){
    158 
    159         return DataSetDemarshallRaw(&marshalled_dataset);
    160 
    161 }
    162 /*}}}*/
    163 /*FUNCTION DataSet::DemarshallRaw{{{1*/
    164 DataSet* DataSetDemarshallRaw(char** pmarshalled_dataset){
    165 
    166         int i;
    167 
    168         DataSet* dataset=NULL;
    169         int      numobjects=0;
    170         int      enum_type;
    171         Object*  object=NULL;
    172         int      sorted;
    173         int*     sorted_ids=NULL;
    174         int*     id_offsets=NULL;
    175         char*    marshalled_dataset=NULL;
    176 
    177         /*recover marshalled_dataset pointer: */
    178         marshalled_dataset=*pmarshalled_dataset;
    179 
    180         /*initialize dataset: */
    181         dataset=new DataSet();
    182 
    183         /*Get internals first: */
    184         memcpy(&numobjects,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    185         memcpy(&sorted,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    186         if(sorted){
    187                 if(numobjects){
    188                         sorted_ids=(int*)xmalloc(numobjects*sizeof(int));
    189                         id_offsets=(int*)xmalloc(numobjects*sizeof(int));
    190                         memcpy(sorted_ids,marshalled_dataset,numobjects*sizeof(int)); marshalled_dataset+=numobjects*sizeof(int);
    191                         memcpy(id_offsets,marshalled_dataset,numobjects*sizeof(int)); marshalled_dataset+=numobjects*sizeof(int);
    192                 }
    193                 dataset->SetSorting(sorted_ids,id_offsets);
    194         }
    195 
    196         for(i=0;i<numobjects;i++){
    197 
    198                 /*get enum type of object: */
    199                 memcpy(&enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    200 
    201                 switch(enum_type){
    202                         case NodeEnum:{
    203                                 Node* node=NULL;
    204                                 node=new Node();
    205                                 node->Demarshall(&marshalled_dataset);
    206                                 dataset->AddObject(node);}
    207                                 break;
    208                         case VertexEnum:{
    209                                 Vertex* vertex=NULL;
    210                                 vertex=new Vertex();
    211                                 vertex->Demarshall(&marshalled_dataset);
    212                                 dataset->AddObject(vertex);}
    213                                 break;
    214                         case DoubleParamEnum:{
    215                                 DoubleParam* doubleparam=NULL;
    216                                 doubleparam=new DoubleParam();
    217                                 doubleparam->Demarshall(&marshalled_dataset);
    218                                 dataset->AddObject(doubleparam);}
    219                                 break;
    220                         case TriaEnum:{
    221                                 Tria* tria=NULL;
    222                                 tria=new Tria();
    223                                 tria->Demarshall(&marshalled_dataset);
    224                                 dataset->AddObject(tria);}
    225                                 break;
    226                         case TriaP1InputEnum:{
    227                                 TriaP1Input* triavertexinput=NULL;
    228                                 triavertexinput=new TriaP1Input();
    229                                 triavertexinput->Demarshall(&marshalled_dataset);
    230                                 dataset->AddObject(triavertexinput);}
    231                                 break;
    232                         #ifdef _HAVE_3D_
    233                         case PentaP1InputEnum:{
    234                                 PentaP1Input* pentavertexinput=NULL;
    235                                 pentavertexinput=new PentaP1Input();
    236                                 pentavertexinput->Demarshall(&marshalled_dataset);
    237                                 dataset->AddObject(pentavertexinput);}
    238                                 break;
    239                         #endif
    240                         case TransientInputEnum:{
    241                                 TransientInput* transientinput=NULL;
    242                                 transientinput=new TransientInput();
    243                                 transientinput->Demarshall(&marshalled_dataset);
    244                                 dataset->AddObject(transientinput);}
    245                                 break;
    246                         #ifdef _HAVE_CONTROL_
    247                         case ControlInputEnum:{
    248                            ControlInput* controlinputinput=NULL;
    249                                 controlinputinput=new ControlInput();
    250                                 controlinputinput->Demarshall(&marshalled_dataset);
    251                                 dataset->AddObject(controlinputinput);}
    252                                 break;
    253                         #endif
    254                         case DatasetInputEnum:{
    255                                 DatasetInput* datasetinputinput=NULL;
    256                                 datasetinputinput=new DatasetInput();
    257                                 datasetinputinput->Demarshall(&marshalled_dataset);
    258                                 dataset->AddObject(datasetinputinput);}
    259                                 break;
    260                         case TriaP1ElementResultEnum:{
    261                                 TriaP1ElementResult* triavertexelementresult=NULL;
    262                                 triavertexelementresult=new TriaP1ElementResult();
    263                                 triavertexelementresult->Demarshall(&marshalled_dataset);
    264                                 dataset->AddObject(triavertexelementresult);}
    265                                 break;
    266                          #ifdef _HAVE_3D_
    267                         case PentaP1ElementResultEnum:{
    268                                 PentaP1ElementResult* pentavertexelementresult=NULL;
    269                                 pentavertexelementresult=new PentaP1ElementResult();
    270                                 pentavertexelementresult->Demarshall(&marshalled_dataset);
    271                                 dataset->AddObject(pentavertexelementresult);}
    272                                 break;
    273                         case PentaEnum:{
    274                                 Penta* penta=NULL;
    275                                 penta=new Penta();
    276                                 penta->Demarshall(&marshalled_dataset);
    277                                 dataset->AddObject(penta);}
    278                                 break;
    279                         #endif
    280                         case MaticeEnum:{
    281                                 Matice* matice=NULL;
    282                                 matice=new Matice();
    283                                 matice->Demarshall(&marshalled_dataset);
    284                                 dataset->AddObject(matice);}
    285                                 break;
    286                         case MatparEnum:{
    287                                 Matpar* matpar=NULL;
    288                                 matpar=new Matpar();
    289                                 matpar->Demarshall(&marshalled_dataset);
    290                                 dataset->AddObject(matpar);}
    291                                 break;
    292                         case SpcStaticEnum:{
    293                                 SpcStatic* spcstatic=NULL;
    294                                 spcstatic=new SpcStatic();
    295                                 spcstatic->Demarshall(&marshalled_dataset);
    296                                 dataset->AddObject(spcstatic);}
    297                                 break;
    298                         case SpcDynamicEnum:{
    299                                 SpcDynamic* spcdynamic=NULL;
    300                                 spcdynamic=new SpcDynamic();
    301                                 spcdynamic->Demarshall(&marshalled_dataset);
    302                                 dataset->AddObject(spcdynamic);}
    303                                 break;
    304                         case SpcTransientEnum:{
    305                                 SpcTransient* spctransient=NULL;
    306                                 spctransient=new SpcTransient();
    307                                 spctransient->Demarshall(&marshalled_dataset);
    308                                 dataset->AddObject(spctransient);}
    309                                 break;
    310                         case PengridEnum:{
    311                                 Pengrid* pengrid=NULL;
    312                                 pengrid=new Pengrid();
    313                                 pengrid->Demarshall(&marshalled_dataset);
    314                                 dataset->AddObject(pengrid);}
    315                                 break;
    316                         case PenpairEnum:{
    317                                 Penpair* penpair=NULL;
    318                                 penpair=new Penpair();
    319                                 penpair->Demarshall(&marshalled_dataset);
    320                                 dataset->AddObject(penpair);}
    321                                 break;
    322                         case IcefrontEnum:{
    323                                 Icefront* icefront=NULL;
    324                                 icefront=new Icefront();
    325                                 icefront->Demarshall(&marshalled_dataset);
    326                                 dataset->AddObject(icefront);}
    327                                 break;
    328                         case NumericalfluxEnum:{
    329                                 Numericalflux* numericalflux=NULL;
    330                                 numericalflux=new Numericalflux();
    331                                 numericalflux->Demarshall(&marshalled_dataset);
    332                                 dataset->AddObject(numericalflux);}
    333                                 break;
    334                         #ifdef _HAVE_RIFTS_
    335                         case RiftfrontEnum:{
    336                                 Riftfront* riftfront=NULL;
    337                                 riftfront=new Riftfront();
    338                                 riftfront->Demarshall(&marshalled_dataset);
    339                                 dataset->AddObject(riftfront);}
    340                                 break;
    341                         #endif
    342                         case DoubleInputEnum:{
    343                                 DoubleInput* doubleinput=NULL;
    344                                 doubleinput=new DoubleInput();
    345                                 doubleinput->Demarshall(&marshalled_dataset);
    346                                 dataset->AddObject(doubleinput);}
    347                                 break;
    348                         case IntInputEnum:{
    349                                 IntInput* intinput=NULL;
    350                                 intinput=new IntInput();
    351                                 intinput->Demarshall(&marshalled_dataset);
    352                                 dataset->AddObject(intinput);}
    353                                 break;
    354                         case BoolInputEnum:{
    355                                 BoolInput* boolinput=NULL;
    356                                 boolinput=new BoolInput();
    357                                 boolinput->Demarshall(&marshalled_dataset);
    358                                 dataset->AddObject(boolinput);}
    359                                 break;
    360                         case IntParamEnum:{
    361                                 IntParam* intparam=NULL;
    362                                 intparam=new IntParam();
    363                                 intparam->Demarshall(&marshalled_dataset);
    364                                 dataset->AddObject(intparam);}
    365                                 break;
    366                         case BoolParamEnum:{
    367                                 BoolParam* boolparam=NULL;
    368                                 boolparam=new BoolParam();
    369                                 boolparam->Demarshall(&marshalled_dataset);
    370                                 dataset->AddObject(boolparam);}
    371                                 break;
    372                         case StringParamEnum:{
    373                                 StringParam* stringparam=NULL;
    374                                 stringparam=new StringParam();
    375                                 stringparam->Demarshall(&marshalled_dataset);
    376                                 dataset->AddObject(stringparam);}
    377                                 break;
    378                         case DoubleVecExternalResultEnum:{
    379                                 DoubleVecExternalResult* doublevecexternalresult=NULL;
    380                                 doublevecexternalresult=new DoubleVecExternalResult();
    381                                 doublevecexternalresult->Demarshall(&marshalled_dataset);
    382                                 dataset->AddObject(doublevecexternalresult);}
    383                                 break;
    384                         case DoubleExternalResultEnum:{
    385                                 DoubleExternalResult* doubleexternalresult=NULL;
    386                                 doubleexternalresult=new DoubleExternalResult();
    387                                 doubleexternalresult->Demarshall(&marshalled_dataset);
    388                                 dataset->AddObject(doubleexternalresult);}
    389                                 break;
    390                         #ifdef _HAVE_GROUNDINGLINE_
    391                         case BoolElementResultEnum:{
    392                                 BoolElementResult* boolelementresult=NULL;
    393                                 boolelementresult=new BoolElementResult();
    394                                 boolelementresult->Demarshall(&marshalled_dataset);
    395                                 dataset->AddObject(boolelementresult);}
    396                                 break;
    397                         #endif
    398                         default:
    399                                 _error_("could not recognize enum type: %s",EnumToStringx(enum_type));
    400                 }
    401         }
    402 
    403         /*Assign output pointers:*/
    404         *pmarshalled_dataset=marshalled_dataset;
    405        
    406         return dataset;
    407 }
    408 /*}}}*/
    409 #endif
    410 
    41187/*Specific methods*/
    41288/*FUNCTION DataSet::AddObject{{{1*/
  • issm/trunk/src/c/Container/DataSet.h

    r9777 r12330  
    4949                void  Echo();
    5050                void  DeepEcho();
    51                 #ifdef _SERIAL_
    52                 char* Marshall();
    53                 int   MarshallSize();
    54                 #endif
    5551                int   AddObject(Object* object);
    5652                int   DeleteObject(int id);
     
    6965};
    7066
    71 /*This routine cannot be object oriented, but need for demarshalling: */
    72 #ifdef _SERIAL_
    73 DataSet* DataSetDemarshall(char* marshalled_dataset);
    74 DataSet* DataSetDemarshallRaw(char** pmarshalled_dataset);
    7567#endif
    76        
    77 
    78 
    79 #endif
  • issm/trunk/src/c/Container/Elements.cpp

    r11995 r12330  
    124124        }
    125125
    126         #ifdef _PARALLEL_
    127126        /*Synchronize across cluster, so as to not end up with different sizes for each patch on each cpu: */
     127        #ifdef _HAVE_MPI_
    128128        MPI_Reduce (&numvertices,&max_numvertices,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    129129        MPI_Bcast(&max_numvertices,1,MPI_INT,0,MPI_COMM_WORLD);
     
    193193
    194194                /*Get rank of first cpu that has results*/
     195                #ifdef _HAVE_MPI_
    195196                if(this->Size()) rank=my_rank;
    196197                else rank=num_procs;
    197198                MPI_Allreduce (&rank,&minrank,1,MPI_INT,MPI_MIN,MPI_COMM_WORLD);
     199                #else
     200                minrank=my_rank;
     201                #endif
    198202
    199203                /*see what the first element of this partition has in stock (this is common to all partitions)*/
     
    203207                        element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults);
    204208                }
     209                #ifdef _HAVE_MPI_
    205210                MPI_Bcast(&numberofresults,1,MPI_DOUBLE,minrank,MPI_COMM_WORLD);
     211                #endif
    206212
    207213                /*Get out if there is no results. Otherwise broadcast info*/
    208214                if(!numberofresults) return;
     215                #ifdef _HAVE_MPI_
    209216                if(my_rank!=minrank){
    210217                        resultsenums=(int*)xmalloc(numberofresults*sizeof(int));
     
    217224                MPI_Bcast(resultstimes,numberofresults,MPI_DOUBLE,minrank,MPI_COMM_WORLD);
    218225                MPI_Bcast(resultssteps,numberofresults,MPI_INT,minrank,MPI_COMM_WORLD);
     226                #endif
    219227
    220228                /*Loop over all results and get nodal vector*/
     
    250258
    251259                /*Gather onto master cpu 0, if needed: */
    252 #ifdef _PARALLEL_
    253260                if(io_gather)patch->Gather();
    254 #endif
    255261
    256262                /*create result object and add to results dataset:*/
     
    276282        int numberofelements;
    277283
    278         #ifdef _PARALLEL_
    279284        local_nelem=this->Size();
     285        #ifdef _HAVE_MPI_
    280286        MPI_Allreduce ( (void*)&local_nelem,(void*)&numberofelements,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    281287        #else
    282         numberofelements=this->Size();
     288        numberofelements=local_nelem;
    283289        #endif
    284290
  • issm/trunk/src/c/Container/Loads.cpp

    r10522 r12330  
    6363
    6464        /*figure out total number of loads combining all the cpus (no clones here)*/
    65         #ifdef _PARALLEL_
     65        #ifdef _HAVE_MPI_
    6666        MPI_Reduce(&localloads,&numberofloads,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    6767        MPI_Bcast(&numberofloads,1,MPI_INT,0,MPI_COMM_WORLD);
     
    6969        numberofloads=localloads;
    7070        #endif
     71
    7172
    7273        return numberofloads;
  • issm/trunk/src/c/Container/Nodes.cpp

    r11527 r12330  
    8383         * 0. This means the dofs between all the cpus are not unique. We now offset the dofs of eache
    8484         * cpus by the total last dofs of the previus cpu, starting from 0.
    85          * First: bet number of dofs for each cpu*/
     85         * First: get number of dofs for each cpu*/
    8686        alldofcount=(int*)xmalloc(num_procs*sizeof(int));
     87        #ifdef _HAVE_MPI_
    8788        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD);
    8889        MPI_Bcast(alldofcount,num_procs,MPI_INT,0,MPI_COMM_WORLD);
     90        #else
     91        alldofcount[0]=dofcount;
     92        #endif
    8993
    9094        /* Every cpu should start its own dof count at the end of the dofcount from cpu-1*/
     
    119123                }
    120124        }
    121         MPI_Allreduce ( (void*)truedofs,(void*)alltruedofs,numnodes*maxdofspernode,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
     125
     126        #ifdef _HAVE_MPI_
     127        MPI_Allreduce((void*)truedofs,(void*)alltruedofs,numnodes*maxdofspernode,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
     128        #else
     129        for(i=0;i<numnodes*maxdofspernode;i++)alltruedofs[i]=truedofs[i];
     130        #endif
    122131
    123132        /* Now every cpu knows the true dofs of everyone else that is not a clone*/
     
    145154        int  numnodes;
    146155
    147 
    148156        /*Figure out number of nodes for this analysis: */
    149157        numnodes=this->NumberOfNodes(analysis_type);
     
    162170         * dealt with by another cpu. We take the minimum because we are going to manage dof assignment in increasing
    163171         * order of cpu rank. This is also why we initialized this array to num_procs.*/
     172        #ifdef _HAVE_MPI_
    164173        MPI_Allreduce ( (void*)ranks,(void*)minranks,numnodes,MPI_INT,MPI_MIN,MPI_COMM_WORLD);
     174        #else
     175        for(i=0;i<numnodes;i++)minranks[i]=ranks[i];
     176        #endif
    165177
    166178        /*Now go through all objects, and use minranks to flag which objects are cloned: */
     
    204216        }
    205217
    206 #ifdef _PARALLEL_
    207218        /*Grab max of all cpus: */
     219        #ifdef _HAVE_MPI_
    208220        MPI_Allreduce ( (void*)&max,(void*)&allmax,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    209221        max=allmax;
    210 #endif
     222        #endif
    211223
    212224        return max;
     
    239251
    240252        /*Gather from all cpus: */
     253        #ifdef _HAVE_MPI_
    241254        MPI_Allreduce ( (void*)&numdofs,(void*)&allnumdofs,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
     255        #else
     256        allnumdofs=numdofs;
     257        #endif
    242258        return allnumdofs;
    243259}
     
    262278
    263279        /*Gather from all cpus: */
     280        #ifdef _HAVE_MPI_
    264281        MPI_Allreduce ( (void*)&numnodes,(void*)&allnumnodes,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
     282        #else
     283        allnumnodes=numnodes;
     284        #endif
    265285
    266286        return allnumnodes;
     
    288308        }
    289309
    290         #ifdef _PARALLEL_
    291                 MPI_Reduce (&max_sid,&node_max_sid,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    292                 MPI_Bcast(&node_max_sid,1,MPI_INT,0,MPI_COMM_WORLD);
    293                 max_sid=node_max_sid;
    294         #endif 
     310        #ifdef _HAVE_MPI_
     311        MPI_Reduce (&max_sid,&node_max_sid,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
     312        MPI_Bcast(&node_max_sid,1,MPI_INT,0,MPI_COMM_WORLD);
     313        max_sid=node_max_sid;
     314        #endif
    295315
    296316        if(max_sid==1){
  • issm/trunk/src/c/Container/Options.cpp

    r11995 r12330  
    1313#include <vector>
    1414#include <algorithm>
     15#include <cstring>
    1516
    1617#include "./DataSet.h"
     
    2021#include "../shared/shared.h"
    2122#include "../EnumDefinitions/EnumDefinitions.h"
    22 #if _SERIAL_
    2323#include "../io/io.h"
    24 #endif
    2524/*}}}*/
    2625
     
    3130}
    3231/*}}}*/
    33 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    34 /*FUNCTION Options::Options(int istart, int nrhs, const mxArray* prhs[]){{{1*/
    35 Options::Options(int istart, int nrhs, const mxArray* prhs[]){
    36 
    37         int            i;
    38         char          *name    = NULL;
    39         Option *option = NULL;
    40 
    41         /*loop over each name and value*/
    42         for (i=istart; i<nrhs; i=i+2){
    43                 if (!mxIsClass(prhs[i],"char")) _error_("Argument %d must be name of option.",i+1);
    44 
    45                 FetchData(&name,prhs[i]);
    46                 if (i+1 == nrhs) _error_("Argument %d must exist and be value of option \"%s\".",i+2,name);
    47 
    48                 //_printf_(true,"  Processing option \"%s\" of class \"%s\".\n",name,mxGetClassName(prhs[i+1]));
    49                 option=(Option*)OptionParse(name,&prhs[i+1]);
    50                 this->AddOption(option);
    51                 option=NULL;
    52         }
    53 
    54         /*echo the dataset  */
    55         //if (this->Size()) for(i=0;i<this->Size();i++) ((Option*)this->GetObjectByOffset(i))->Echo();
    56 }
    57 /*}}}*/
    58 #endif
    5932/*FUNCTION Options::~Options(){{{1*/
    6033Options::~Options(){
     
    9366
    9467        return 1;
     68}
     69/*}}}*/
     70/*FUNCTION Options::Get(int* pvalue, char* name){{{1*/
     71void Options::Get(int* pvalue,const char* name){
     72
     73        vector<Object*>::iterator object;
     74        Option* option=NULL;
     75
     76        /*Get option*/
     77        option=GetOption(name);
     78
     79        /*If the pointer is not NULL, the option has been found*/
     80        if(option){
     81                option->Get(pvalue);
     82        }
     83        /*Else, the Option does not exist, no default provided*/
     84        else{
     85                _error_("option of name \"%s\" not found, and no default value has been provided",name);
     86        }
     87}
     88/*}}}*/
     89/*FUNCTION Options::Get(int* pvalue, char* name,int default_value){{{1*/
     90void Options::Get(int* pvalue,const char* name,int default_value){
     91
     92        vector<Object*>::iterator object;
     93        Option* option=NULL;
     94
     95        /*Get option*/
     96        option=GetOption(name);
     97
     98        /*If the pointer is not NULL, the option has been found*/
     99        if(option){
     100                option->Get(pvalue);
     101        }
     102        /*Else, the Option does not exist, a default is provided here*/
     103        else{
     104                *pvalue=default_value;
     105        }
    95106}
    96107/*}}}*/
  • issm/trunk/src/c/Container/Options.h

    r11995 r12330  
    1515                /*constructors, destructors*/
    1616                Options();
    17                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18                 Options(int istart, int nrhs, const mxArray* prhs[]);
    19                 #endif
    2017                ~Options();
    2118
     
    2522                void Get(double*  pvalue,const char* name);
    2623                void Get(double*  pvalue,const char* name,double default_value);
     24                void Get(int*  pvalue,const char* name);
     25                void Get(int*  pvalue,const char* name,int default_value);
    2726                void Get(bool*    pvalue,const char* name);
    2827                void Get(bool*    pvalue,const char* name,bool default_value);
  • issm/trunk/src/c/Container/Parameters.h

    r11995 r12330  
    55#ifndef _CONTAINER_PARAMETERS_H_
    66#define  _CONTAINER_PARAMETERS_H_
     7#include <stdio.h>
    78
    89/*forward declarations */
  • issm/trunk/src/c/Container/Results.cpp

    r11995 r12330  
    6565/*}}}*/
    6666/*FUNCTION Results::Write{{{1*/
    67 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    68 void Results::Write(mxArray** pdataref){
    69 
    70         int i,j;
    71         int count;
    72 
    73         /*output: */
    74         mxArray* dataref=NULL;
    75         mxArray* processeddataref=NULL;
    76         mwSize nfields;
    77         mwSize maxfields;
    78         mwSize nsteps;
    79         mwSize step;
    80         const char **fnames      = NULL;
    81         int         *enums       = NULL;
    82         int          baseenum;
    83         mwSize       onebyone[2] = {1,1};
    84         mwSize       ndim        = 2;
    85 
    86         /*How many time steps do we have? : */
    87         nsteps=0;
    88         for(i=0;i<this->Size();i++){
    89                 ExternalResult* result=(ExternalResult*)this->GetObjectByOffset(i);
    90                 step=result->GetStep();
    91                 if(step>nsteps)nsteps=step;
    92         }
    93         onebyone[0]=nsteps;
    94 
    95         /*How many field names do we have. First, figure out how many result types we have: */
    96         maxfields=(mwSize)this->Size();
    97         enums=(int*)xmalloc(maxfields*sizeof(int));
    98         for(i=0;i<maxfields;i++){
    99                 ExternalResult* result=(ExternalResult*)this->GetObjectByOffset(i);
    100                 enums[i]=result->InstanceEnum();
    101         }
    102         /*Now, make result types unique: */
    103         for(i=0;i<maxfields;i++){
    104                 if(enums[i]>=0){//if <0, it means this enum was found to replicate another one previously
    105                         baseenum=enums[i];             
    106                         /*is the baseenum repeated later on?:*/
    107                         for(j=i+1;j<maxfields;j++){
    108                                 if (enums[j]==baseenum)enums[j]=-1;
    109                         }
    110                 }
    111                 else continue;
    112         }
    113 
    114         /*Now, go through enums, and whatever is not null is a non repeated field name: */
    115         nfields=0;
    116         for(i=0;i<maxfields;i++)if(enums[i]>0)nfields++;
    117 
    118         /*Add 2 fields for time and step: */
    119         nfields=nfields+2;
    120        
    121         /*Fill the names of the structure field: */
    122         fnames=(const char**)xmalloc(nfields*sizeof(char*));
    123         count=0;
    124         for(i=0;i<maxfields;i++){
    125                 if (enums[i]>0){
    126                         fnames[count]=EnumToStringx(enums[i]);
    127                         count++;
    128                 }
    129         }
    130         /*don't forget the extra fields "time" and "step":*/
    131         fnames[nfields-2]="time";
    132         fnames[nfields-1]="step";
    133 
    134         /*Initialize structure: */
    135         dataref=mxCreateStructArray( ndim,onebyone,nfields,fnames);
    136 
    137         /*Fill each field: */
    138         for(i=0;i<this->Size();i++){ //do not include the last one used for time
    139                 ExternalResult* result=(ExternalResult*)this->GetObjectByOffset(i);
    140                 result->SetMatlabField(dataref);
    141         }
    142 
    143         /*Now, process the patch in the dataref structure, by calling MatlabProcessPatch.m
    144          *on the current dataref structure: */
    145         mexCallMATLAB(1,&processeddataref,1,&dataref, "MatlabProcessPatch");
    146 
    147         /*Assign output pointers:*/
    148         *pdataref=processeddataref;
    149 }
    150 #else
    15167void Results::Write(Parameters* parameters){
    15268       
     
    16783
    16884}
    169 #endif
    17085/*}}}*/
  • issm/trunk/src/c/Container/Results.h

    r11995 r12330  
    2626                /*numerics: {{{1*/
    2727                Results* SpawnTriaResults(int* indices);
    28                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    29                 void Write(mxArray** pdataref);
    30                 #else
    3128                void Write(Parameters* parameters);
    32                 #endif
    3329                /*}}}*/
    3430};
  • issm/trunk/src/c/Container/Vertices.cpp

    r11527 r12330  
    6161         * First: bet number of dofs for each cpu*/
    6262        alldofcount=(int*)xmalloc(num_procs*sizeof(int));
     63        #ifdef _HAVE_MPI_
    6364        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD);
    6465        MPI_Bcast(alldofcount,num_procs,MPI_INT,0,MPI_COMM_WORLD);
     66        #else
     67        alldofcount[0]=dofcount;
     68        #endif
    6569
    6670        /* Every cpu should start its own dof count at the end of the dofcount from cpu-1*/
     
    8589                vertex->ShowTrueDofs(truedofs);
    8690        }
     91        #ifdef _HAVE_MPI_
    8792        MPI_Allreduce((void*)truedofs,(void*)alltruedofs,numberofobjects*numberofdofsperobject,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
     93        #else
     94        for(i=0;i<numberofobjects*numberofdofsperobject;i++)alltruedofs[i]=truedofs[i];
     95        #endif
    8896
    8997        /* Now every cpu knows the true dofs of everyone else that is not a clone*/
     
    121129         * dealt with by another cpu. We take the minimum because we are going to manage dof assignment in increasing
    122130         * order of cpu rank. This is also why we initialized this array to num_procs.*/
     131        #ifdef _HAVE_MPI_
    123132        MPI_Allreduce ( (void*)ranks,(void*)minranks,numberofobjects,MPI_INT,MPI_MIN,MPI_COMM_WORLD);
     133        #else
     134        for(i=0;i<numberofobjects;i++)minranks[i]=ranks[i];
     135        #endif
    124136
    125137        /*Now go through all objects, and use minranks to flag which objects are cloned: */
     
    149161        }
    150162
    151         #ifdef _PARALLEL_
     163        #ifdef _HAVE_MPI_
    152164        MPI_Reduce (&max_sid,&vertex_max_sid,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    153165        MPI_Bcast(&vertex_max_sid,1,MPI_INT,0,MPI_COMM_WORLD);
  • issm/trunk/src/c/Container/Vertices.h

    r10522 r12330  
    3232};
    3333
    34 
    35 
    3634#endif //ifndef _VERTICES_H_
    37 
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r12301 r12330  
    153153        PetscProfilingCurrentFlopsEnum,
    154154        PetscProfilingSolutionTimeEnum,
     155        MaxIterationConvergenceFlagEnum,
    155156        SteadystateMaxiterEnum,
    156157        SteadystateNumRequestedOutputsEnum,
  • issm/trunk/src/c/EnumDefinitions/Synchronize.sh

    r11995 r12330  
    22#Synchronize EnumToStringx.cpp and StringToEnumx.cpp and matlab Enums
    33
    4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all comas | add line number in the first column > put everything in file temp
    5 cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,//g" | awk '{ printf "%s %s\n", NR, $0 }' > temp
     4#Get all lines of EnumDefinitions2.h which hold Enum | remove all comas > put everything in file temp
     5cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,/ /g" | awk '{print $1}' > temp
    66
    77#Removed existing files
    8 rm $ISSM_TIER/src/m/enum/*.m
    9 rm $ISSM_TIER/src/c/modules/EnumToStringx/EnumToStringx.cpp
    10 rm $ISSM_TIER/src/c/modules/StringToEnumx/StringToEnumx.cpp
     8rm $ISSM_DIR/src/m/enum/*.m
     9rm $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
     10rm $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp
    1111
    1212#Get number of enums
    1313NUMENUMS=$(wc -l temp | awk '{printf("%s",$1);}');
    1414
    15 #Build EnumToStringx.cpp {{{1
     15#Build EnumToStringx.cpp {{{
    1616#Header
    17 cat <<END >  $ISSM_TIER/src/c/modules/EnumToStringx/EnumToStringx.cpp
     17cat <<END >  $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
    1818/*
    1919* \file EnumToStringx.cpp:
     
    3535END
    3636#core
    37 cat temp |  awk '{print "\t\t" "case " $2" : return \"" substr($2,1,length($2)-4) "\";"}' >> $ISSM_TIER/src/c/modules/EnumToStringx/EnumToStringx.cpp
     37cat temp |  awk '{print "\t\t" "case " $1" : return \"" substr($1,1,length($1)-4) "\";"}' >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
    3838#Footer
    39 cat <<END >> $ISSM_TIER/src/c/modules/EnumToStringx/EnumToStringx.cpp
     39cat <<END >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
    4040                default : return "unknown";
    4141
     
    5757#Build StringToEnumx.cpp {{{1
    5858#Header
    59 cat <<END > $ISSM_TIER/src/c/modules/StringToEnumx/StringToEnumx.cpp
     59cat <<END > $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp
    6060/*
    6161* \file StringToEnumx.cpp:
     
    8181i2=120;
    8282for (( i=1 ; i<=100 ; i++ )); do
    83         echo "   if(stage==$i){" >> $ISSM_TIER//src/c/modules/StringToEnumx/StringToEnumx.cpp
     83        echo "   if(stage==$i){" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp
    8484        awk -v i1=$i1 -v i2=$i2 '{if(NR>=i1 && NR<=i2) print $0 }' temp |
    85         awk '{print "\t" ((NR==1)?"      if":"      else if") " (strcmp(name,\"" substr($2,1,length($2)-4) "\")==0) return " $2 ";"}' >> $ISSM_TIER//src/c/modules/StringToEnumx/StringToEnumx.cpp
    86         echo "         else stage=$(($i+1));" >> $ISSM_TIER//src/c/modules/StringToEnumx/StringToEnumx.cpp
    87         echo "   }" >> $ISSM_TIER//src/c/modules/StringToEnumx/StringToEnumx.cpp
     85        awk '{print "\t" ((NR==1)?"      if":"      else if") " (strcmp(name,\"" substr($1,1,length($1)-4) "\")==0) return " $1 ";"}' >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp
     86        echo "         else stage=$(($i+1));" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp
     87        echo "   }" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp
    8888       
    8989        if [ $i2 -ge $NUMENUMS ]; then break; fi
     
    9393
    9494#footer
    95 cat <<END >> $ISSM_TIER/src/c/modules/StringToEnumx/StringToEnumx.cpp
     95cat <<END >> $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp
    9696        /*If we reach this point, the string provided has not been found*/
    9797   _error_("Enum %s not found",name);
     
    101101
    102102# go through the lines of temp
    103 for (( i=1 ; i<=$NUMENUMS ; i++ )); do
     103ENUM=0;
     104for NAMEENUM in $(cat temp); do
    104105
    105106        #Get name and enum of the line i
    106         NAMEENUM=$(cat temp | grep "^[ ]*$i " | awk '{printf("%s",$2);}');
    107107        NAME=$(echo $NAMEENUM | sed -e "s/Enum//g")
    108         ENUM=$i;
    109108        #offset Enum by one (Enum begins with 0 and not 1!)
    110         let ENUM=$ENUM-1
     109        let ENUM=$ENUM+1
    111110
    112111        #print info {{{
    113         if [ $i -lt 10 ]
     112        if [ $ENUM -lt 10 ]
    114113        then
    115114                printf "\r                                                                      "
    116                 printf "\r  $i/$NUMENUMS Adding "$NAME"..."
     115                printf "\r  $ENUM/$NUMENUMS Adding "$NAME"..."
    117116        else
    118                 if [ $i -lt 100 ]
     117                if [ $ENUM -lt 100 ]
    119118                then
    120119                        printf "\r                                                                      "
    121                         printf "\r $i/$NUMENUMS Adding "$NAME"..."
     120                        printf "\r $ENUM/$NUMENUMS Adding "$NAME"..."
    122121                else
    123122                        printf "\r                                                                      "
    124                         printf "\r$i/$NUMENUMS Adding "$NAME"..."
     123                        printf "\r$ENUM/$NUMENUMS Adding "$NAME"..."
    125124                fi
    126125        fi
    127126        #}}}
    128127        #Add case to matlabenum file{{{
    129         cat <<END > $ISSM_TIER"/src/m/enum/"$(echo $NAMEENUM".m")
     128        cat <<END > $ISSM_DIR"/src/m/enum/"$(echo $NAMEENUM".m")
    130129function macro=$(echo $NAMEENUM)()
    131130%$(echo $NAMEENUM | awk {'print toupper($1)'}) - Enum of $(echo $NAME)
     
    143142
    144143done
     144#MaximumNumberOfEnums{{{
     145cat <<END > $ISSM_DIR/src/m/enum/MaximumNumberOfEnums.m
     146function macro=MaximumNumberOfEnums()
     147%$(echo "MaximumNumberOfEnums" | awk {'print toupper($1)'}) - Enum of MaximumNumberOfEnums
     148%
     149%   WARNING: DO NOT MODIFY THIS FILE
     150%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
     151%            Please read src/c/EnumDefinitions/README for more information
     152%
     153%   Usage:
     154%      macro=MaximumNumberOfEnums()
     155
     156macro=$(cat EnumDefinitions.h | grep -e "[0-9]Enum" -e "[a-zA-Z]Enum" | grep -v include \
     157                | awk '{ printf "%s %s\n", NR-1, $0 }' \
     158                | grep "MaximumNumberOfEnums" | awk '{print $1}');
     159END
     160#}}}
    145161
    146162#clean up{{{
  • issm/trunk/src/c/Makefile.am

    r11995 r12330  
    44
    55#Library declaration {{{1
    6 #Compile serial library, and then try and compile parallel library
    7 if NOSERIAL
    8 if NOPARALLEL
    9 lib_LIBRARIES =
    10 else
    11 lib_LIBRARIES = libpISSM.a libOverload.a
    12 endif
    13 else
    14 if NOPARALLEL
    15 lib_LIBRARIES = libISSM.a libOverload.a
    16 else
    17 lib_LIBRARIES = libISSM.a libpISSM.a libOverload.a
    18 endif
     6lib_LIBRARIES = libISSMCore.a libISSMOverload.a
     7if PYTHON
     8lib_LIBRARIES += libISSMPython.a
     9endif
     10if MATLAB
     11lib_LIBRARIES += libISSMMatlab.a
     12endif
     13if MODULES
     14lib_LIBRARIES += libISSMModules.a
    1915endif
    2016#}}}
     
    2218#sources
    2319#Core sources{{{1
    24 core_sources = ./include/macros.h\
     20core_sources = ./issm.h\
     21                                        ./issm-binding.h\
     22                                        ./include/macros.h\
    2523                                        ./include/typedefs.h\
    2624                                        ./include/types.h\
     
    211209                                        ./shared/Wrapper/ModuleBoot.cpp\
    212210                                        ./shared/Wrapper/ModuleEnd.cpp\
    213                                         ./toolkits/mpi/mpiincludes.h\
    214                                         ./toolkits/mpi/patches/mpipatches.h\
    215                                         ./toolkits/mpi/patches/DetermineLocalSize.cpp\
    216                                         ./toolkits/mpi/patches/MPI_Upperrow.cpp\
    217                                         ./toolkits/mpi/patches/MPI_Lowerrow.cpp\
    218                                         ./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp\
    219211                                        ./toolkits/metis/metisincludes.h\
    220212                                        ./toolkits/issm/issmtoolkit.h\
     
    223215                                        ./toolkits/issm/SeqMat.h\
    224216                                        ./toolkits/issm/SeqMat.cpp\
    225                                         ./toolkits/metis/patches/metispatches.h\
    226                                         ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp\
    227217                                        ./toolkits/triangle/triangleincludes.h\
    228218                                        ./toolkitsenums.h\
     
    362352                                          ./modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp\
    363353                                          ./modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp\
    364                                           ./modules/AverageOntoPartitionx/AverageOntoPartitionx.h
    365 dakota_psources= ./modules/Dakotax/SpawnCoreParallel.cpp
     354                                          ./modules/AverageOntoPartitionx/AverageOntoPartitionx.h\
     355                                          ./modules/Dakotax/SpawnCoreParallel.cpp
    366356#}}}
    367357#Transient sources  {{{1
    368 transient_sources  = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp
    369 transient_psources = ./solutions/transient_core.cpp
     358transient_sources  = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \
     359                                        ./solutions/transient_core.cpp
    370360#}}}
    371361#Steadystate sources  {{{1
    372 steadystate_psources = ./solutions/steadystate_core.cpp\
    373                                                 ./solutions/steadystateconvergence.cpp
     362steadystate_sources = ./solutions/steadystate_core.cpp\
     363                                          ./solutions/steadystateconvergence.cpp
    374364#}}}
    375365#Prognostic sources  {{{1
     
    377367                                              ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\
    378368                                              ./modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp\
    379                                               ./modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
    380 prognostic_psources = ./solutions/prognostic_core.cpp
     369                                              ./modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp\
     370                                                  ./solutions/prognostic_core.cpp
    381371#}}}
    382372#Thermal sources  {{{1
     
    395385                                           ./modules/ConstraintsStatex/ThermalConstraintsState.cpp\
    396386                                           ./modules/ConstraintsStatex/ThermalIsPresent.cpp\
    397                                            ./modules/ResetConstraintsx/ThermalConstraintsReset.cpp
    398 
    399 thermal_psources = ./solutions/thermal_core.cpp\
    400                                             ./solutions/enthalpy_core.cpp\
    401                                             ./solvers/solver_thermal_nonlinear.cpp
     387                                           ./modules/ResetConstraintsx/ThermalConstraintsReset.cpp \
     388                                           ./solutions/thermal_core.cpp\
     389                                           ./solutions/enthalpy_core.cpp\
     390                                           ./solvers/solver_thermal_nonlinear.cpp
    402391#}}}
    403392#Control sources  {{{1
     
    443432                                          ./objects/Inputs/ControlInput.cpp\
    444433                                          ./shared/Numerics/BrentSearch.cpp\
    445                                           ./shared/Numerics/OptimalSearch.cpp\
    446                                           ./shared/Numerics/OptFunc.cpp
    447 
    448 control_psources=./solutions/control_core.cpp\
     434                                          ./shared/Numerics/OptimalSearch.cpp \
     435                                          ./solutions/control_core.cpp\
    449436                                          ./solutions/controltao_core.cpp\
    450437                                          ./solutions/controlrestart.cpp\
     
    462449                                              ./modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp\
    463450                                              ./modules/ModelProcessorx/Hydrology/CreateConstraintsHydrology.cpp\
    464                                               ./modules/ModelProcessorx/Hydrology/CreateLoadsHydrology.cpp
    465                                          
    466 hydrology_psources  = ./solutions/hydrology_core.cpp\
    467                                                ./solutions/hydrology_core_step.cpp
     451                                              ./modules/ModelProcessorx/Hydrology/CreateLoadsHydrology.cpp \
     452                                                  ./solutions/hydrology_core.cpp\
     453                                                  ./solutions/hydrology_core_step.cpp
    468454#}}}
    469455#Diagnostic sources  {{{1
     
    480466                                              ./modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp \
    481467                                              ./modules/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp \
    482                                                         ./shared/Elements/CoordinateSystemTransform.cpp\
    483                                                         ./shared/Elements/TransformLoadVectorCoord.cpp \
    484                                                         ./shared/Elements/TransformStiffnessMatrixCoord.cpp \
    485                                                         ./shared/Elements/TransformInvStiffnessMatrixCoord.cpp \
    486                                                         ./shared/Elements/TransformSolutionCoord.cpp
    487 diagnostic_psources =./solutions/diagnostic_core.cpp\
    488                                               ./solvers/solver_stokescoupling_nonlinear.cpp
     468                                                  ./shared/Elements/CoordinateSystemTransform.cpp\
     469                                                  ./shared/Elements/TransformLoadVectorCoord.cpp \
     470                                                  ./shared/Elements/TransformStiffnessMatrixCoord.cpp \
     471                                                  ./shared/Elements/TransformInvStiffnessMatrixCoord.cpp \
     472                                                  ./shared/Elements/TransformSolutionCoord.cpp\
     473                                                  ./solutions/diagnostic_core.cpp\
     474                                                  ./solvers/solver_stokescoupling_nonlinear.cpp
    489475#}}}
    490476#Balanced sources  {{{1
     
    492478                                            ./modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp\
    493479                                            ./modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp\
    494                                             ./modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp
    495 balanced_psources = ./solutions/balancethickness_core.cpp
     480                                                ./modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp\
     481                                                ./solutions/balancethickness_core.cpp
    496482#}}}
    497483#Responses sources  {{{1
     
    533519                                          ./modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp \
    534520                                          ./modules/ModelProcessorx/SurfaceSlope/CreateConstraintsSurfaceSlope.cpp\
    535                                           ./modules/ModelProcessorx/SurfaceSlope/CreateLoadsSurfaceSlope.cpp
    536 slope_psources = ./solutions/surfaceslope_core.cpp\
     521                                          ./modules/ModelProcessorx/SurfaceSlope/CreateLoadsSurfaceSlope.cpp\
     522                                          ./solutions/surfaceslope_core.cpp\
    537523                                          ./solutions/bedslope_core.cpp
    538524#}}}
     
    589575                                ./objects/Bamg/Metric.cpp\
    590576                                ./objects/Bamg/Metric.h\
    591                                 ./objects/Bamg/QuadTree.cpp\
    592                                 ./objects/Bamg/QuadTree.h\
     577                                ./objects/Bamg/BamgQuadtree.cpp\
     578                                ./objects/Bamg/BamgQuadtree.h\
    593579                                ./objects/Bamg/R2.h\
    594580                                ./objects/Bamg/SetOfE4.cpp\
     
    625611                                ./modules/BamgTriangulatex/BamgTriangulatex.cpp\
    626612                                ./modules/BamgTriangulatex/BamgTriangulatex.h
     613#}}}
     614#Kriging sources  {{{1
     615kriging_sources = ./Container/Observations.h\
     616                                                ./Container/Observations.cpp\
     617                                                ./objects/Kriging/Variogram.h \
     618                                                ./objects/Kriging/GaussianVariogram.h\
     619                                                ./objects/Kriging/GaussianVariogram.cpp\
     620                                                ./objects/Kriging/ExponentialVariogram.h\
     621                                                ./objects/Kriging/ExponentialVariogram.cpp\
     622                                                ./objects/Kriging/SphericalVariogram.h\
     623                                                ./objects/Kriging/SphericalVariogram.cpp\
     624                                                ./objects/Kriging/PowerVariogram.h\
     625                                                ./objects/Kriging/PowerVariogram.cpp\
     626                                                ./objects/Kriging/Quadtree.h\
     627                                                ./objects/Kriging/Quadtree.cpp\
     628                                                ./objects/Kriging/Observation.h\
     629                                                ./objects/Kriging/Observation.cpp\
     630                                                ./modules/Krigingx/Krigingx.cpp\
     631                                                ./modules/Krigingx/Krigingx.h
     632
    627633#}}}
    628634#Kml sources  {{{1
     
    694700                             ./objects/KML/KMLFileReadUtils.h
    695701#}}}
    696 #Matlab sources  {{{1
    697 matlab_sources= ./toolkits/matlab/matlabincludes.h\
    698                                     ./toolkits/matlab/MatlabNArrayToNArray.cpp\
    699                                     ./toolkits/double/MatlabVectorToDoubleVector.cpp\
    700                                     ./toolkits/double/double.h\
    701                                     ./toolkits/double/MatlabMatrixToDoubleMatrix.cpp\
    702                                     ./io/Matlab/matlabio.h\
    703                                     ./io/Matlab/CheckNumMatlabArguments.cpp\
    704                                     ./io/Matlab/mxGetAssignedField.cpp\
    705                                     ./io/Matlab/WriteMatlabData.cpp\
    706                                     ./io/Matlab/FetchMatlabData.cpp\
    707                                     ./io/Matlab/OptionParse.cpp
    708 #}}}
    709 #Python sources  {{{1
    710 python_sources=     ./io/Python/pythonio.h\
    711                                     ./io/Python/WritePythonData.cpp\
    712                                     ./io/Python/CheckNumPythonArguments.cpp\
    713                                     ./io/Python/FetchPythonData.cpp
    714 #}}}
    715702#Petsc sources  {{{1
    716703petsc_sources= ./toolkits/petsc\
     
    718705                                        ./toolkits/petsc/patches/SolverEnum.h\
    719706                                        ./toolkits/petsc/patches/petscpatches.h\
    720                                         ./toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp\
    721                                         ./toolkits/petsc/patches/MatlabVectorToPetscVector.cpp\
    722                                         ./toolkits/petsc/patches/PetscMatrixToMatlabMatrix.cpp\
    723                                         ./toolkits/petsc/patches/PetscVectorToMatlabVector.cpp\
    724707                                        ./toolkits/petsc/patches/VecTranspose.cpp\
    725708                                        ./toolkits/petsc/patches/VecToMPISerial.cpp\
     
    732715                                        ./toolkits/petsc/patches/SerialToVec.cpp\
    733716                                        ./toolkits/petsc/patches/VecFree.cpp\
     717                                        ./toolkits/petsc/patches/PetscMatrixToDoubleMatrix.cpp\
     718                                        ./toolkits/petsc/patches/PetscVectorToDoubleVector.cpp\
    734719                                        ./toolkits/petsc/patches/VecDuplicatePatch.cpp\
    735720                                        ./toolkits/petsc/patches/KSPFree.cpp\
     
    754739
    755740#}}}
    756 #Serialsources  {{{1
    757 serial_sources= ./objects/Options/Option.cpp\
     741#Mpi sources  {{{1
     742mpi_sources= ./toolkits/mpi/mpiincludes.h\
     743                                ./toolkits/mpi/patches/mpipatches.h\
     744                                ./toolkits/mpi/patches/DetermineLocalSize.cpp\
     745                                ./toolkits/mpi/patches/MPI_Upperrow.cpp\
     746                                ./toolkits/mpi/patches/MPI_Lowerrow.cpp\
     747                                ./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp
     748#}}}
     749#Metis sources  {{{1
     750metis_sources= ./toolkits/metis/patches/metispatches.h\
     751                                        ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
     752#}}}
     753#Python sources  {{{1
     754python_sources=     ./python/io/pythonio.h\
     755                                        ./python/python-binding.h\
     756                                    ./python/io/WritePythonData.cpp\
     757                                    ./python/io/CheckNumPythonArguments.cpp\
     758                                    ./python/io/FetchPythonData.cpp
     759
     760#}}}
     761#Matlab sources  {{{1
     762matlab_sources= ./toolkits/matlab/matlabincludes.h\
     763                                    ./matlab/matlab-binding.h\
     764                                    ./matlab/io/matlabio.h\
     765                                    ./matlab/io/MatlabNArrayToNArray.cpp\
     766                                    ./matlab/io/CheckNumMatlabArguments.cpp\
     767                                    ./matlab/io/mxGetAssignedField.cpp\
     768                                    ./matlab/io/WriteMatlabData.cpp\
     769                                    ./matlab/io/FetchMatlabData.cpp\
     770                                    ./matlab/io/OptionParse.cpp\
     771                                    ./matlab/io/MatlabMatrixToMatrix.cpp\
     772                                    ./matlab/io/MatlabVectorToVector.cpp\
     773                                         ./matlab/io/MatlabVectorToDoubleVector.cpp\
     774                                         ./matlab/io/MatlabMatrixToDoubleMatrix.cpp\
     775                                         ./matlab/io/MatlabMatrixToSeqMat.cpp\
     776                                         ./matlab/io/MatlabVectorToSeqVec.cpp
     777#}}}
     778#Matlab and Petsc sources  {{{1
     779matlabpetsc_sources= ./matlab/io/MatlabMatrixToPetscMatrix.cpp\
     780                                         ./matlab/io/MatlabVectorToPetscVector.cpp
     781       
     782#}}}
     783#Modules sources{{{1
     784module_sources= ./objects/Options/Option.cpp\
    758785                        ./objects/Options/Option.h\
    759786                        ./objects/Options/OptionDouble.cpp\
     
    769796                        ./objects/Options/OptionUtilities.cpp\
    770797                        ./objects/Options/OptionUtilities.h\
     798                        ./shared/Alloc/alloc_module.h\
     799                        ./shared/Alloc/alloc_module.cpp\
    771800                        ./shared/Threads/issm_threads.h\
    772801                        ./shared/Threads/LaunchThread.cpp\
     
    790819                        ./modules/Chacox/chaco_seconds.cpp\
    791820                        ./modules/Chacox/user_params.cpp\
    792                         ./modules/Dakotax/SpawnCoreSerial.cpp\
    793821                        ./modules/TriaSearchx/TriaSearchx.h\
    794822                        ./modules/TriaSearchx/TriaSearchx.cpp\
     
    841869#}}}
    842870
     871#{{{1 Conditional build-up of sources
    843872#ISSM sources are a combination of core sources and sources related to specific capabilities (which can
    844873#be activated by autotools conditionals
    845 #{{{1
     874
    846875
    847876#First the core
    848877issm_sources  =  $(core_sources)
    849 issm_psources = 
    850878
    851879#Now the optional source
    852880if DAKOTA
    853881issm_sources  +=  $(dakota_sources)
    854 issm_psources +=  $(dakota_psources)
    855882endif
    856883
    857884if PETSC
    858885issm_sources  +=  $(petsc_sources)
    859 issm_psources +=  $(petsc_psources)
    860886endif
    861887
    862888if GSL
    863889issm_sources  +=  $(gsl_sources)
    864 issm_psources +=  $(gsl_psources)
    865 endif
    866 
     890endif
    867891
    868892if TRANSIENT
    869893issm_sources  +=  $(transient_sources)
    870 issm_psources +=  $(transient_psources)
    871894endif
    872895
    873896if STEADYSTATE
    874897issm_sources  +=  $(steadystate_sources)
    875 issm_psources +=  $(steadystate_psources)
    876898endif
    877899
    878900if PROGNOSTIC
    879901issm_sources  +=  $(prognostic_sources)
    880 issm_psources +=  $(prognostic_psources)
    881902endif
    882903
    883904if THERMAL
    884905issm_sources  +=  $(thermal_sources)
    885 issm_psources +=  $(thermal_psources)
    886906endif
    887907
    888908if CONTROL
    889909issm_sources  +=  $(control_sources)
    890 issm_psources +=  $(control_psources)
    891910endif
    892911
    893912if HYDROLOGY
    894913issm_sources  +=  $(hydrology_sources)
    895 issm_psources +=  $(hydrology_psources)
    896914endif
    897915
    898916if DIAGNOSTIC
    899917issm_sources  +=  $(diagnostic_sources)
    900 issm_psources +=  $(diagnostic_psources)
    901918endif
    902919
    903920if BALANCED
    904921issm_sources  +=  $(balanced_sources)
    905 issm_psources +=  $(balanced_psources)
    906922endif
    907923
     
    912928if SLOPE
    913929issm_sources  +=  $(slope_sources)
    914 issm_psources +=  $(slope_psources)
    915930endif
    916931
     
    926941issm_sources +=  $(threed_sources)
    927942endif
    928 #}}}
    929 
    930 #ISSM serial library {{{1
    931 if SERIAL
    932 libISSM_a_SOURCES  = $(issm_sources)
    933 libISSM_a_SOURCES += $(serial_sources)
    934 libISSM_a_SOURCES += $(bamg_sources)
    935 libISSM_a_SOURCES += $(kml_sources)
    936 libISSM_a_CXXFLAGS = -fPIC -D_SERIAL_ -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS)
    937 #libISSM_a_CXXFLAGS = -D_SERIAL_ -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER   $(CXXFLAGS) $(CXXOPTFLAGS)
     943
     944if MPI
     945issm_sources +=  $(mpi_sources)
     946endif
     947
     948if METIS
     949issm_sources +=  $(metis_sources)
     950endif
     951
     952if PETSC
     953if MATLAB
     954issm_sources +=  $(matlabpetsc_sources)
     955endif
     956endif
     957
     958
     959#}}}
     960#Library flags and sources {{{1
     961ALLCXXFLAGS= -fPIC -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS)
     962
     963libISSMCore_a_SOURCES  = $(issm_sources)
     964libISSMCore_a_CXXFLAGS = $(ALLCXXFLAGS)
     965
     966if MODULES
     967libISSMModules_a_SOURCES = $(module_sources)
     968libISSMModules_a_SOURCES += $(bamg_sources)
     969libISSMModules_a_SOURCES += $(kriging_sources)
     970libISSMModules_a_SOURCES += $(kml_sources)
     971libISSMModules_a_CXXFLAGS = $(ALLCXXFLAGS)
     972endif
    938973
    939974if PYTHON
    940 libISSM_a_CXXFLAGS+=  -DNPY_NO_DEPRECATED_API
    941 libISSM_a_SOURCES += $(python_sources)
     975libISSMPython_a_SOURCES = $(python_sources)
     976libISSMPython_a_CXXFLAGS= $(ALLCXXFLAGS)
    942977endif
    943978
    944979if MATLAB
    945 libISSM_a_SOURCES += $(matlab_sources)
    946 endif
    947 
    948 endif
    949 #}}}
    950 #ISSM parallel library {{{1
    951 if PARALLEL
    952 libpISSM_a_SOURCES  = $(issm_sources)
    953 libpISSM_a_SOURCES += $(issm_psources)
    954 libpISSM_a_CXXFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(CXXFLAGS) $(CXXOPTFLAGS)
    955 endif
     980libISSMMatlab_a_SOURCES = $(matlab_sources)
     981libISSMMatlab_a_CXXFLAGS= $(ALLCXXFLAGS)
     982endif
     983
    956984#}}}
    957985#Overload library, to overload any non-standard symbols. {{{1
    958 libOverload_a_SOURCES = ./shared/String/stricmp.c
    959 libOverload_a_CFLAGS  = -fPIC -D_PARALLEL_  -D_C_ $(COPTFLAGS) $(CFLAGS)
     986libISSMOverload_a_SOURCES = ./shared/String/stricmp.c
     987libISSMOverload_a_CFLAGS  = -fPIC -D_C_ $(COPTFLAGS) $(CFLAGS)
    960988#}}}
    961989
    962990#Executable {{{1
    963 if NOPARALLEL
    964 bin_PROGRAMS =
    965 else
    966991bin_PROGRAMS = issm
    967 endif
    968992
    969993#Standard libraries
    970 LDADD = ./libpISSM.a ./libOverload.a
     994LDADD = ./libISSMCore.a ./libISSMOverload.a
    971995
    972996#External packages
    973 LDADD += $(PETSCLIB) $(TAOLIB) $(FLIBS) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)
     997LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)
     998
     999if FORTRAN
     1000LDADD += $(FLIBS)
     1001endif
    9741002
    9751003issm_SOURCES = solutions/issm.cpp
    976 issm_CXXFLAGS= -fPIC -D_PARALLEL_ $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS)
     1004issm_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS)
    9771005#}}}
    9781006#Automatic differentiation: append this fold to the end of the src/c/Makefile.am to get this Makefile.am {{{
    9791007if ADIC2
    980 lib_LIBRARIES += libAD.a libpISSMRose.a
     1008lib_LIBRARIES += libAD.a libISSMRose.a
    9811009
    9821010#ADIC2 library, for automatic differentiation
    9831011#libAD_a_SOURCES = ./mini1.ad.c
    9841012libAD_a_SOURCES =
    985 libAD_a_CFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(COPTFLAGS)
    986 
     1013libAD_a_CFLAGS = -fPIC -D_C_ $(COPTFLAGS)
    9871014
    9881015
    9891016#test rose preprocessing
    9901017%.r2cpp.cpp : %.cpp
    991         testTranslator -rose:o $@ -rose:skipfinalCompileStep -DHAVE_CONFIG_H -D_PARALLEL_ -D_C_ -I. -I../.. $(INCLUDES) $<
    992 libpISSMRose_a_SOURCES = $(libpISSM_a_SOURCES:.cpp=.r2cpp.cpp)
    993 libpISSMRose_a_CXXFLAGS= -fPIC -D_PARALLEL_ -D_C_ $(CXXOPTFLAGS)
     1018        testTranslator -rose:o $@ -rose:skipfinalCompileStep -DHAVE_CONFIG_H -D_C_ -I. -I../.. $(INCLUDES) $<
     1019libISSMRose_a_SOURCES = $(libISSMCore_a_SOURCES:.cpp=.r2cpp.cpp)
     1020libISSMRose_a_CXXFLAGS= -fPIC -D_C_ $(CXXOPTFLAGS)
    9941021
    9951022
     
    10031030#Executable
    10041031bin_PROGRAMS +=  issmRose.exe
    1005 issmRose_exe_LDADD = ./libpISSMRose.a $(LDADD)
     1032issmRose_exe_LDADD = ./libISSMRose.a $(LDADD)
    10061033issmRose_exe_SOURCES = solutions/issm.cpp
    1007 issmRose_exe_CXXFLAGS= -fPIC -D_PARALLEL_  $(CXXOPTFLAGS) $(COPTFLAGS)
     1034issmRose_exe_CXXFLAGS= -fPIC $(CXXOPTFLAGS) $(COPTFLAGS)
    10081035LDADD +=  $(ADIC2LIB)
    10091036
  • issm/trunk/src/c/include/macros.h

    r11995 r12330  
    4040#endif
    4141/*}}}*/
    42 
    43 /* MODULEBOOT/MODULEEND {{{1*/
     42/* ISSMBOOT/ISSMEND {{{1*/
    4443
    4544/*The following macros hide the error exception handling in a matlab module. Just put
    46  * MODULEBOOT(); and MODULEEND(); at the beginning and end of a module, and c++ exceptions
     45 * ISSMBOOT(); and ISSMEND(); at the beginning and end of a module, and c++ exceptions
    4746 * will be trapped. Really nifty!*/
    4847
    49 #ifdef _SERIAL_
    50 #ifdef _HAVE_MATLAB_ //{{{2
    51 #define MODULEBOOT(); ModuleBoot(); \
     48#define ISSMBOOT(); \
    5249        try{
    5350
    54 #define MODULEEND(); ModuleEnd(); }\
    55         catch(ErrorException &exception){\
    56                 exception.Report(); \
    57                 mexErrMsgTxt(""); \
    58         }\
    59         catch (exception& e) {\
    60                 _printf_(true,"Standard exception: %s\n",e.what());\
    61                 mexErrMsgTxt(" ");\
    62         }
    63 #endif //}}}
    64 #ifdef _HAVE_PYTHON_ //{{{2
    65 #define MODULEBOOT(); ModuleBoot();  \
    66         PyObject* output = PyTuple_New(NLHS); if (!output) return NULL;
    67 
    68 #define MODULEEND();  ModuleEnd(); \
    69                                                  return output;
    70 #endif //}}}
    71 #else
    72 //{{{2
    73 #define MODULEBOOT(); \
    74         try{
    75 
    76 #define MODULEEND(); }\
     51#define ISSMEND(); }\
    7752        catch(ErrorException &exception){\
    7853                exception.Report(); \
     
    8257                _printf_(true,"Standard exception: %s\n",e.what());\
    8358                return 1;\
     59        }\
     60        catch(...){\
     61                _printf_(true,"An unexpected error occurred");\
    8462        }
    85 //}}}
    86 #endif
    8763/*}}}*/
    88 /* WRAPPER {{{1*/
    89 #ifdef _HAVE_MATLAB_
    90 #define WRAPPER(modulename,...) void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
    91 #endif
    92 #ifdef _HAVE_PYTHON_
    93 #define WRAPPER(modulename,...)  \
    94 \
    95 static PyObject* modulename(PyObject* self,PyObject* args);\
    96 static PyMethodDef modulename##_funcs[] = {\
    97         {#modulename, (PyCFunction)modulename, METH_VARARGS, ""},\
    98         {NULL,NULL,0,NULL}\
    99 };\
    100 \
    101 static struct PyModuleDef modulename##module= {\
    102         PyModuleDef_HEAD_INIT,\
    103         #modulename,   /* name of module */\
    104         NULL, /* module documentation, may be NULL */\
    105         -1,       /* size of per-interpreter state of the module,\
    106                                  or -1 if the module keeps state in global variables. */\
    107         modulename##_funcs\
    108 };\
    109 \
    110 PyMODINIT_FUNC PyInit_##modulename(void){\
    111 \
    112         import_array();\
    113         return PyModule_Create(&modulename##module);\
    114 }\
    115 \
    116 static PyObject* modulename(PyObject* self,PyObject* args)
    11764
    11865#endif
    119 
    120 /*}}}*/
    121 /* CHECKARGUMENTS {{{1*/
    122 #ifdef _HAVE_MATLAB_
    123 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,functionpointer)
    124 #endif
    125 #ifdef _HAVE_PYTHON_
    126 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumPythonArguments(args, NRHS,functionpointer)
    127 #endif
    128 /*}}}*/
    129 
    130 
    131 #endif
  • issm/trunk/src/c/include/types.h

    r11995 r12330  
    1616
    1717/*Define abstract type for I/O: */
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    20 typedef const mxArray* ConstDataHandle;  //serially, we are reading data from a matlab array.
    21 typedef mxArray* DataHandle; 
    22 #else
    23 typedef FILE* ConstDataHandle; //in parallel, we are reading data from a file.
    24 typedef FILE* DataHandle;
    25 #endif
    2618enum param_type { STRING, INTEGER, STRINGARRAY, DOUBLE, DOUBLEVEC, DOUBLEMAT, PETSCVEC, PETSCMAT };
    2719
     
    3527#endif 
    3628
    37 typedef double IssmDouble;
     29#ifdef _HAVE_ADOLC_
     30typedef adouble IssmDouble;
     31#else
     32typedef double IssmDouble;
     33#endif
     34
    3835typedef bool IssmBool;
    3936
  • issm/trunk/src/c/io/PrintfFunction.cpp

    r11995 r12330  
    88#include "../shared/shared.h"
    99#include "../include/include.h"
    10 
    11 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    12 #include "mex.h"
    13 #endif
    1410
    1511int PrintfFunction(const char* format,...){
     
    5349
    5450        /*Ok, if we are running in parallel, get node 0 to print*/
    55 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    56         mexPrintf(buffer);
    57 #else
    5851        if(my_rank==0)printf(buffer);
    59 #endif
    6052
    6153        /*Clean up and return*/
  • issm/trunk/src/c/io/io.h

    r11995 r12330  
    1515#include "./Disk/diskio.h"
    1616
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include "./Matlab/matlabio.h"
    19 #endif
    20 
    21 #if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
    22 #include "./Python/pythonio.h"
    23 #endif
    24 
    2517/*printf: */
    2618int PrintfFunction(const char* format,...);
  • issm/trunk/src/c/modules/Bamgx/Bamgx.cpp

    r11995 r12330  
    9292
    9393                //Make Quadtree from background mesh
    94                 BTh.MakeQuadTree();
     94                BTh.MakeBamgQuadtree();
    9595
    9696                //Bound hmin and hmax
  • issm/trunk/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp

    r9761 r12330  
    3232        }
    3333
    34         #ifdef _PARALLEL_
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
     
    9595        }
    9696
    97         #ifdef _PARALLEL_
     97        #ifdef _HAVE_MPI_
    9898        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    9999        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
     
    135135       
    136136        /*Is there just one found? that would mean we have frozen! : */
    137         #ifdef _PARALLEL_
     137        #ifdef _HAVE_MPI_
    138138        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    139139        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
     
    195195        }
    196196
    197         #ifdef _PARALLEL_
     197        #ifdef _HAVE_MPI_
    198198        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    199199        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
     
    228228        }
    229229
    230         #ifdef _PARALLEL_
     230        #ifdef _HAVE_MPI_
    231231        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    232232        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
     
    289289        }
    290290
    291         #ifdef _PARALLEL_
     291        #ifdef _HAVE_MPI_
    292292        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    293293        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
     
    329329        }
    330330
    331         #ifdef _PARALLEL_
     331        #ifdef _HAVE_MPI_
    332332        MPI_Reduce (&max_penetration,&mpi_max_penetration,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    333333        MPI_Bcast(&mpi_max_penetration,1,MPI_DOUBLE,0,MPI_COMM_WORLD);               
     
    368368        }
    369369
    370         #ifdef _PARALLEL_
     370        #ifdef _HAVE_MPI_
    371371        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    372372        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
  • issm/trunk/src/c/modules/ConstraintsStatex/ThermalConstraintsState.cpp

    r9883 r12330  
    3636        }
    3737
    38         #ifdef _PARALLEL_
     38        #ifdef _HAVE_MPI_
    3939        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    4040        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
  • issm/trunk/src/c/modules/ConstraintsStatex/ThermalIsPresent.cpp

    r9883 r12330  
    2828        }
    2929       
    30         #ifdef _PARALLEL_
     30        #ifdef _HAVE_MPI_
    3131        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    3232        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
  • issm/trunk/src/c/modules/ContourToMeshx/ContourToMeshx.cpp

    r11995 r12330  
    1111#include "./ContourToMeshx.h"
    1212
    13 int ContourToMeshx( Vector** pin_nod,Vector** pin_elem, double* index, double* x, double* y,Contour** contours,int numcontours,char* interptype,int nel,int nods, int edgevalue) {
     13int ContourToMeshx( Vector** pin_nod,Vector** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue) {
    1414
    1515        int noerr=1;
     
    3737
    3838        /*initialize thread parameters: */
    39         gate.numcontours=numcontours;
    4039        gate.contours=contours;
    4140        gate.nods=nods;
  • issm/trunk/src/c/modules/ContourToMeshx/ContourToMeshx.h

    r11995 r12330  
    1313typedef struct{
    1414
    15         int numcontours;
    16         Contour** contours;
     15        DataSet* contours;
    1716        int nods;
    1817        int edgevalue;
     
    2524
    2625/* local prototypes: */
    27 int ContourToMeshx( Vector** pin_nods,Vector** pin_elem, double* index, double* x, double* y,Contour** contours,int numcontours,char* interptype,int nel,int nods, int edgevalue);
     26int ContourToMeshx( Vector** pin_nods,Vector** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue);
    2827
    2928void* ContourToMeshxt(void* vContourToMeshxThreadStruct);
  • issm/trunk/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp

    r11995 r12330  
    2626
    2727        /*Contour:*/
    28         Contour* contouri=NULL;
    29         int      numnodes;
    30         double*  xc=NULL;
    31         double*  yc=NULL;
    32 
     28        DataSet* contours=NULL;
    3329
    3430        /*parameters: */
    35         int numcontours;
    36         Contour** contours=NULL;
    3731        int nods;
    3832        int edgevalue;
     
    4943
    5044        /*recover parameters :*/
    51         numcontours=gate->numcontours;
    5245        contours=gate->contours;
    5346        nods=gate->nods;
     
    6154
    6255        /*Loop through all contours: */
    63         for (i=0;i<numcontours;i++){
    64                 contouri=*(contours+i);
    65                 numnodes=contouri->nods;
    66                 xc=contouri->x;
    67                 yc=contouri->y;
    68                 IsInPoly(in_nod,xc,yc,numnodes,x,y,i0,i1,edgevalue);
     56        for (i=0;i<contours->Size();i++){
     57                Contour* contour=(Contour*)contours->GetObjectByOffset(i);
     58                IsInPoly(in_nod,contour->x,contour->y,contour->nods,x,y,i0,i1,edgevalue);
    6959        }
    7060
  • issm/trunk/src/c/modules/ContourToNodesx/ContourToNodesx.cpp

    r11995 r12330  
    3838        return 1;
    3939}
     40
     41int ContourToNodesx( Vector** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue){
     42
     43        int i;
     44        int m,n;
     45
     46        /*Contour:*/
     47        Contour* contouri=NULL;
     48        int      numnodes;
     49        double*  xc=NULL;
     50        double*  yc=NULL;
     51        double   value;
     52
     53        /*output: */
     54        Vector* flags=NULL;
     55
     56        flags=new Vector(nods);
     57
     58        /*Loop through all contours: */
     59        if(contours){
     60                for (i=0;i<contours->Size();i++){
     61                        Contour* contour=(Contour*)contours->GetObjectByOffset(i);
     62                        IsInPoly(flags,contour->x,contour->y,contour->nods,x,y,0,nods,edgevalue);
     63                }
     64        }
     65
     66        /*Assemble vector: */
     67        flags->Assemble();
     68
     69        /*Assign output pointers: */
     70        *pflags=flags;
     71       
     72        return 1;
     73}
  • issm/trunk/src/c/modules/ContourToNodesx/ContourToNodesx.h

    r11995 r12330  
    1212/* local prototypes: */
    1313int ContourToNodesx( Vector** pflags,double* x, double* y, int nods, Contour** contours,int numcontours,int edgevalue);
     14int ContourToNodesx( Vector** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue);
    1415
    1516#endif /* _CONTOURTONODESX_H */
  • issm/trunk/src/c/modules/Dakotax/Dakotax.cpp

    r11995 r12330  
    5151#endif
    5252
    53 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    54 void Dakotax(mxArray* femmodel){
    55 #else
    5653void Dakotax(FemModel* femmodel){
    57 #endif
    5854
    5955
     
    6965
    7066        /*Retrieve parameters: */
    71         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    72         FetchData((Parameters**)&parameters,mxGetField((mxArray*)femmodel,0,"parameters"));
    73         #else
    7467        parameters=femmodel->parameters;
    75         #endif
    7668
    7769        /*Recover dakota_input_file, dakota_output_file and dakota_error_file, in the parameters dataset in parallel */
     
    8072        parameters->FindParam(&dakota_error_file,QmuErrNameEnum);
    8173
    82         #ifdef _PARALLEL_
    8374        if(my_rank==0){
    84         #endif
    8575       
    8676                // Instantiate/initialize the parallel library and problem description
    8777                // database objects.
    88                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    89                         Dakota::ParallelLibrary parallel_lib; //use Dakota's standard library mode constructor
    90                 #else
    91                         Dakota::ParallelLibrary parallel_lib("serial"); //use our own ISSM Dakota library mode constructor, which only fires up Dakota on CPU 0.
    92                 #endif
     78                Dakota::ParallelLibrary parallel_lib("serial"); //use our own ISSM Dakota library mode constructor, which only fires up Dakota on CPU 0.
    9379                Dakota::ProblemDescDB problem_db(parallel_lib);
    9480
     
    123109                selected_strategy.run_strategy();
    124110               
    125                 #ifdef _PARALLEL_
    126111                //Warn other cpus that we are done running the dakota iterator, by setting the counter to -1:
    127112                SpawnCore(NULL,0, NULL,NULL,0,femmodel,-1);
    128                 #endif
    129113
    130         #ifdef _PARALLEL_
    131114        }
    132115        else{
     
    136119                }
    137120        }
    138         #endif //#ifdef _PARALLEL_
    139121
    140122        /*Free ressources:*/
     
    143125        xfree((void**)&dakota_output_file);
    144126
    145         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    146         delete parameters;
    147         #endif
    148 
    149127        #endif //#ifdef _HAVE_DAKOTA_
    150128}
  • issm/trunk/src/c/modules/Dakotax/Dakotax.h

    r11995 r12330  
    1010
    1111/* local prototypes: */
    12 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter);
     12int  SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter);
    1313int  DescriptorIndex(char* root, int* pindex,char* descriptor);
    1414
    15 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    16 void Dakotax(mxArray* femmodel);
    17 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel,int counter);
    18 #else
    1915void Dakotax(FemModel* femmodel);
    2016void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int counter);
    21 #endif
    2217void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,FemModel* femmodel);
    2318void DakotaMPI_Bcast(double** pvariables, char*** pvariables_descriptors,int* pnumvariables, int* pnumresponses);
  • issm/trunk/src/c/modules/Dakotax/SpawnCore.cpp

    r11995 r12330  
    2121        /*Branch into a serial SpawnCore and a parallel SpawnCore: */
    2222
    23         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    24                 SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter);
    25         #else
    26                 /*Call SpawnCoreParallel unless counter=-1 on cpu0, in which case, bail out and return 0: */
    27                 MPI_Bcast(&counter,1,MPI_INT,0,MPI_COMM_WORLD);
    28                 if(counter==-1)return 0;
    29                 SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (FemModel*)femmodel,counter);
    30         #endif
     23        /*Call SpawnCoreParallel unless counter=-1 on cpu0, in which case, bail out and return 0: */
     24        MPI_Bcast(&counter,1,MPI_INT,0,MPI_COMM_WORLD);
     25        if(counter==-1)return 0;
     26
     27        SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (FemModel*)femmodel,counter);
    3128        return 1;
    3229}
  • issm/trunk/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp

    r8608 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/ElementResponsex/ElementResponsex.cpp

    r10703 r12330  
    3737
    3838        /*Broadcast whether we found the element: */
     39        #ifdef _HAVE_MPI_
    3940        MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    4041        if(!sumfound)_error_("%s%i%s","could not find material with id",index," to compute ElementResponse");
     42        #endif
    4143
    4244        /*Ok, we found the element, compute responseocity: */
     
    4648
    4749        /*Broadcast and plug into response: */
     50        #ifdef _HAVE_MPI_
    4851        MPI_Allreduce ( &cpu_found,&cpu_found,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    4952        MPI_Bcast(&response,1,MPI_DOUBLE,cpu_found,MPI_COMM_WORLD);
     53        #endif
    5054
    5155        *presponse=response;
  • issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp

    r12301 r12330  
    157157                case PetscProfilingCurrentFlopsEnum : return "PetscProfilingCurrentFlops";
    158158                case PetscProfilingSolutionTimeEnum : return "PetscProfilingSolutionTime";
     159                case MaxIterationConvergenceFlagEnum : return "MaxIterationConvergenceFlag";
    159160                case SteadystateMaxiterEnum : return "SteadystateMaxiter";
    160161                case SteadystateNumRequestedOutputsEnum : return "SteadystateNumRequestedOutputs";
  • issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp

    r11995 r12330  
    6161/*  read exp file  */
    6262
    63         if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,&closed,filexp,true))
     63        if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,&closed,filexp))
    6464                _error_("Error reading exp file.");
    6565        _printf_(true,"Exp2Kmlx -- Reading %d exp profiles from file \"%s\".\n",nprof,filexp);
  • issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r11995 r12330  
    156156                vec_nodes_on_floatingice->Assemble();
    157157               
     158                #ifdef _HAVE_MPI_
    158159                MPI_Allreduce(&local_nflipped,&nflipped,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    159160                _printf_(VerboseConvergence(),"   Additional number of vertices allowed to unground: %i\n",nflipped);
     161                #else
     162                nflipped=local_nflipped;
     163                #endif
    160164
    161165                /*Avoid leaks: */
  • issm/trunk/src/c/modules/IceVolumex/IceVolumex.cpp

    r9880 r12330  
    1919                local_ice_volume+=element->IceVolume();
    2020        }
     21        #ifdef _HAVE_MPI_
    2122        MPI_Reduce(&local_ice_volume,&total_ice_volume,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    2223        MPI_Bcast(&total_ice_volume,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     24        #else
     25        total_ice_volume=local_ice_volume;
     26        #endif
    2327
    2428        /*Assign output pointers: */
  • issm/trunk/src/c/modules/InputConvergencex/InputConvergencex.cpp

    r9761 r12330  
    3030
    3131        /*In parallel, we need to gather the converged status: */
    32         #ifdef _PARALLEL_
     32        #ifdef _HAVE_MPI_
    3333        MPI_Allreduce ( (void*)&num_notconverged,(void*)&total_notconverged,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    3434        num_notconverged=total_notconverged;
  • issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp

    r11995 r12330  
    1414
    1515int InterpFromMeshToMesh2dx(double** pdata_interp,double* index_data,double* x_data,double* y_data,int nods_data,int nels_data,
    16                         double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values, Contour** contours, int numcontours){
     16                        double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values, DataSet* contours){
    1717       
    1818        /*Output*/
     
    3636        bool   skip_bamg=false;
    3737
    38 
    3938        /*Checks*/
    4039        if (data_cols<=0){
     
    5049        /*If default values supplied, figure out which nodes are inside the contour, including the border of the contour: */
    5150        if(num_default_values){
    52                 ContourToNodesx( &vec_incontour,x_interp,y_interp,nods_interp,contours,numcontours,1);
     51                ContourToNodesx( &vec_incontour,x_interp,y_interp,nods_interp,contours,1);
    5352                incontour=vec_incontour->ToMPISerial();
    5453        }
  • issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h

    r5032 r12330  
    1010/* local prototypes: */
    1111int InterpFromMeshToMesh2dx(double** pdata_interp,double* index_data,double* x_data,double* y_data,int nods_data,int nels_data,
    12                         double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values,Contour** contours, int numcontours );
     12                        double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values,DataSet* contours);
    1313
    1414#endif
  • issm/trunk/src/c/modules/MassFluxx/MassFluxx.cpp

    r8263 r12330  
    5959        }
    6060
    61         #ifdef _PARALLEL_
     61        #ifdef _HAVE_MPI_
    6262        MPI_Allreduce ( (void*)&mass_flux,(void*)&all_mass_flux,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
    6363        mass_flux=all_mass_flux;
  • issm/trunk/src/c/modules/MaxAbsVxx/MaxAbsVxx.cpp

    r5870 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out maximum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&maxabsvx,&node_maxabsvx,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_maxabsvx,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MaxAbsVyx/MaxAbsVyx.cpp

    r5871 r12330  
    3232        }
    3333
    34         #ifdef _PARALLEL_
    3534        /*Figure out maximum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3636        MPI_Reduce (&maxabsvy,&node_maxabsvy,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3737        MPI_Bcast(&node_maxabsvy,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MaxAbsVzx/MaxAbsVzx.cpp

    r5414 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&maxabsvz,&node_maxabsvz,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_maxabsvz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MaxVelx/MaxVelx.cpp

    r5414 r12330  
    3232        }
    3333
    34         #ifdef _PARALLEL_
    3534        /*Figure out maximum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3636        MPI_Reduce (&maxvel,&node_maxvel,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3737        MPI_Bcast(&node_maxvel,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MaxVxx/MaxVxx.cpp

    r5414 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&maxvx,&node_maxvx,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_maxvx,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MaxVyx/MaxVyx.cpp

    r5414 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&maxvy,&node_maxvy,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_maxvy,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MaxVzx/MaxVzx.cpp

    r5414 r12330  
    3232        }
    3333
    34         #ifdef _PARALLEL_
    3534        /*Figure out minimum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3636        MPI_Reduce (&maxvz,&node_maxvz,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3737        MPI_Bcast(&node_maxvz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp

    r10000 r12330  
    4242                /*Partition using Metis:*/
    4343                if (num_procs>1){
     44                        #ifdef _HAVE_METIS_
    4445                        METIS_PartMeshNodalPatch(&numberofelements,&numberofnodes, index, &etype, &numflag, &num_procs, &edgecut, epart, npart);
     46                        #endif
    4547                }
    4648                else if (num_procs==1){
     
    6769                /*Partition using Metis:*/
    6870                if (num_procs>1){
     71                        #ifdef _HAVE_METIS_
    6972                        METIS_PartMeshNodalPatch(&numberofelements2d,&numberofnodes2d, index2d, &etype2d, &numflag, &num_procs, &edgecut, epart2d, npart2d);
     73                        #endif
    7074                }
    7175                else if (num_procs==1){
  • issm/trunk/src/c/modules/MeshProfileIntersectionx/SegmentIntersect.cpp

    r11237 r12330  
    66int SegmentIntersect(double* palpha, double* pbeta, double* x1, double* y1, double* x2, double* y2){
    77
    8         /*See ISSM_TIER/src/m/utils/Geometry/SegIntersect.m for matlab routine from which we take this routine: */
     8        /*See ISSM_DIR/src/m/utils/Geometry/SegIntersect.m for matlab routine from which we take this routine: */
    99
    1010        /*output: */
  • issm/trunk/src/c/modules/MinVelx/MinVelx.cpp

    r5414 r12330  
    3232        }
    3333
    34         #ifdef _PARALLEL_
    3534        /*Figure out minimum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3636        MPI_Reduce (&minvel,&node_minvel,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3737        MPI_Bcast(&node_minvel,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MinVxx/MinVxx.cpp

    r5414 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&minvx,&node_minvx,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_minvx,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MinVyx/MinVyx.cpp

    r5414 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&minvy,&node_minvy,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_minvy,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/MinVzx/MinVzx.cpp

    r5414 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&minvz,&node_minvz,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_minvz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
  • issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r9733 r12330  
    6363        else elements_width=6; //penta elements
    6464
    65         #ifdef _PARALLEL_
    6665        /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/
    6766        if(dim==2){
     
    7978        xfree((void**)&elements);
    8079        xfree((void**)&elements2d);
    81 
    82         #else
    83         /*In serial mode, epart is full of 0: all elements belong to cpu 0: */
    84         epart=(int*)xcalloc(numberofelements,sizeof(int));
    85         #endif
    8680
    8781        /*Deal with rifts, they have to be included into one partition only, not several: */
  • issm/trunk/src/c/modules/NodalValuex/NodalValuex.cpp

    r9206 r12330  
    3636
    3737        /*Broadcast whether we found the element: */
     38        #ifdef _HAVE_MPI_
    3839        MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    3940        if(!sumfound)_error_("%s%i%s%s","could not find element with vertex with id",index," to compute nodal value ",EnumToStringx(natureofdataenum));
     41        #endif
    4042
    4143        /*Broadcast and plug into response: */
     44        #ifdef _HAVE_MPI_
    4245        MPI_Allreduce ( &cpu_found,&cpu_found,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    4346        MPI_Bcast(&value,1,MPI_DOUBLE,cpu_found,MPI_COMM_WORLD);
     47        #else
     48        value=cpu_found;
     49        #endif
    4450
    4551        *pnodalvalue=value;
  • issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp

    r11995 r12330  
    1616#include "../../objects/objects.h"
    1717               
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
    20 #else
    2118void OutputResultsx(                    Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
    22 #endif
    2319
    2420        extern int  my_rank;
     
    3127        bool        dakota_analysis         = false;
    3228       
    33         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    34         const char **fnames      = NULL;
    35         mwSize       onebyone[2] = {0,0};
    36         mwSize       ndim        = 2;
    37         int          nfields=0;
    38         #endif
    39 
    4029        /*retrieve parameters: */
    4130        parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
     
    4332        if(dakota_analysis){
    4433                //no need to output anything, Dakota analysis has different outputs
    45                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    46                 *pdataref=mxCreateStructArray( ndim,onebyone,nfields,fnames);
    47                 #endif
    4834                return;
    4935        }
     
    5642        /*Results do not include the type of solution being run . In parallel, we output results to a filename,
    5743         *therefore, we need to include the solutiontype into the filename: */
    58         #ifdef _PARALLEL_
    5944        if(my_rank==0){
    6045                parameters->FindParam(&solutiontype,SolutionTypeEnum);
     
    8873                parameters->SetParam(fid,OutputFilePointerEnum);
    8974        }
    90         #endif
    9175
    92         /*Write results to disk (in parallel), or to memory (in serial mode): */
    93         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    94                 results->Write(pdataref);
    95         #else
    96                 results->Write(parameters);
    97         #endif
     76        /*Write results to disk: */
     77        results->Write(parameters);
    9878
    9979        /*Delete and reinitialize results, in parallel: */
    100         #ifdef _PARALLEL_
    101                 results->clear();
     80        results->clear();
    10281
    103                 /*Close output file? :*/
    104                 /*WARNING: issm.cpp is taking care of it for now (quick fix)
    105                 if((step==1) && (time==0)){
    106                         if(io_gather){
    107                                 if(my_rank==0) pfclose(fid,outputfilename);
    108                         }
    109                         else pfclose(fid,cpu_outputfilename);
    110                 }
    111                 */
    112         #endif
     82        /*Close output file? :*/
     83        /*WARNING: issm.cpp is taking care of it for now (quick fix)
     84          if((step==1) && (time==0)){
     85          if(io_gather){
     86          if(my_rank==0) pfclose(fid,outputfilename);
     87          }
     88          else pfclose(fid,cpu_outputfilename);
     89          }
     90        */
    11391}
  • issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h

    r11995 r12330  
    1414#include "../../Container/Container.h"
    1515
    16 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    17 #include <mex.h>
    18 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results* results);
    19 #else
    2016void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results* results);
    21 #endif
    2217
    2318#endif  /* _OUTPUTRESULTS_H */
  • issm/trunk/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp

    r11995 r12330  
    1010#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1111#endif
     12
     13#include <cstring>
    1214
    1315#include "./ParsePetscOptionsx.h"
     
    9294        }
    9395
    94         #ifdef _PARALLEL_
    9596        /*Ok, broadcast to other cpus: */
     97        #ifdef _HAVE_MPI_
    9698        MPI_Bcast(&numanalyses,1,MPI_INT,0,MPI_COMM_WORLD);
    9799        if(my_rank!=0){
     
    100102        }
    101103        MPI_Bcast(analyses,numanalyses,MPI_DOUBLE,0,MPI_COMM_WORLD);
     104        #endif
    102105        for(i=0;i<numanalyses;i++){
    103106                char* string=strings[i];
     
    106109                }
    107110                if(my_rank==0)stringlength=(strlen(string)+1)*sizeof(char);
     111                #ifdef _HAVE_MPI_
    108112                MPI_Bcast(&stringlength,1,MPI_INT,0,MPI_COMM_WORLD);
    109113                if(my_rank!=0)string=(char*)xmalloc(stringlength);
    110114                MPI_Bcast(string,stringlength,MPI_CHAR,0,MPI_COMM_WORLD);
    111115                if(my_rank!=0)strings[i]=string;
     116                #endif
    112117        }
    113         #endif
    114118
    115119        /*Ok, out of strings and analyses and numanalyses, create parameters, and plug them into parameters container: */
  • issm/trunk/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp

    r8608 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/Shp2Kmlx/Shp2Kmlx.h

    r10380 r12330  
    2222
    2323/* local prototypes: */
    24 int Shp2Kmlx(char* filshp,char* filkml,
    25                          int sgn);
    26 int Shp2Kmlx(char* filshp,char* filkml,
    27                          int sgn,double cm,double sp);
     24int Shp2Kmlx(char* filshp,char* filkml, int sgn);
     25int Shp2Kmlx(char* filshp,char* filkml, int sgn,double cm,double sp);
    2826
    2927#endif  /* _SHP2KMLX_H */
  • issm/trunk/src/c/modules/Solverx/Solverx.cpp

    r11995 r12330  
    3434
    3535                /*In serial mode, the Petsc Options database has not been initialized properly: */
    36                 #ifdef _SERIAL_
    37                 parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    38                 PetscOptionsFromAnalysis(parameters,analysis_type);
    39                 #endif
    4036
    4137                SolverxPetsc(&uf_vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters);
  • issm/trunk/src/c/modules/Solverx/SolverxPetsc.cpp

    r11995 r12330  
    4343        #endif
    4444
    45 
    4645        /*Display message*/
    4746        _printf_(VerboseModule(),"   Solving\n");
     
    5251        #endif
    5352
    54         /*First, check that f-set is not NULL, i.e. model is fully constrained: {{{*/
     53        /*First, check that f-set is not NULL, i.e. model is fully constrained:*/
    5554        _assert_(Kff);
    5655        MatGetSize(Kff,&global_m,&global_n); _assert_(global_m==global_m);
     
    5857                *puf=NULL; return;
    5958        }
    60         /*}}}*/
    61         /*Initial guess logic here: {{{1*/
     59
     60        /*Initial guess */
    6261        /*Now, check that we are not giving an initial guess to the solver, if we are running a direct solver: */
    6362        #if _PETSC_MAJOR_ >= 3
     
    7473                MatGetLocalSize(Kff,&local_m,&local_n);uf=NewVec(local_n,fromlocalsize);
    7574        }
    76         /*}}}*/
    77         /*Process petsc options to see if we are using special types of external solvers: {{{1*/
     75
     76        /*Process petsc options to see if we are using special types of external solvers*/
    7877        PetscOptionsDetermineSolverType(&solver_type);
    7978
    80         /*In serial mode, the matrices have been loaded as MPIAIJ or AIJ matrices.
    81          We need to convert them if we are going to run the solvers successfully: */
    82         #ifdef _SERIAL_
    83         #if _PETSC_MAJOR_ == 2
    84         if (solver_type==MUMPSPACKAGE_LU){
    85                 /*Convert Kff to MATTAIJMUMPS: */
    86                 MatConvert(Kff,MATAIJMUMPS,MAT_REUSE_MATRIX,&Kff);
     79        /*Check the solver is available*/
     80        if(solver_type==MUMPSPACKAGE_LU || solver_type==MUMPSPACKAGE_CHOL){
     81                #if _PETSC_MAJOR_ >=3
     82                        #ifndef _HAVE_MUMPS_
     83                        _error_("requested MUMPS solver, which was not compiled into ISSM!\n");
     84                        #endif
     85                #endif
    8786        }
    88         if (solver_type==MUMPSPACKAGE_CHOL){
    89                 /*Convert Kff to MATTSBAIJMUMPS: */
    90                 MatConvert(Kff,MATSBAIJMUMPS,MAT_REUSE_MATRIX,&Kff);
    91         }
    92         if (solver_type==SPOOLESPACKAGE_LU){
    93                 /*Convert Kff to MATTSBAIJMUMPS: */
    94                 MatConvert(Kff,MATAIJSPOOLES,MAT_REUSE_MATRIX,&Kff);
    95         }
    96         if (solver_type==SPOOLESPACKAGE_CHOL){
    97                 /*Convert Kff to MATTSBAIJMUMPS: */
    98                 MatConvert(Kff,MATSBAIJSPOOLES,MAT_REUSE_MATRIX,&Kff);
    99         }
    100         if (solver_type==SUPERLUDISTPACKAGE){
    101                 /*Convert Kff to MATTSBAIJMUMPS: */
    102                 MatConvert(Kff,MATSUPERLU_DIST,MAT_REUSE_MATRIX,&Kff);
    103         }
    104         if (solver_type==StokesSolverEnum){
    105                 _error_("Petsc 2 does not support multi-physics solvers");
    106         }
    107         #endif
    108         #endif
    109         /*}}}*/
    110         /*Check the solver is available: {{{1*/
    111         if(solver_type==MUMPSPACKAGE_LU || solver_type==MUMPSPACKAGE_CHOL){
    112         #if _PETSC_MAJOR_ >=3
    113                 #ifndef _HAVE_MUMPS_
    114                 _error_("requested MUMPS solver, which was not compiled into ISSM!\n");
    115                 #endif
    11687
    117         #endif
    118         }
    119         /*}}}*/
    120         /*Prepare solver:{{{1*/
     88        /*Prepare solver*/
    12189        KSPCreate(MPI_COMM_WORLD,&ksp);
    12290        KSPSetOperators(ksp,Kff,Kff,DIFFERENT_NONZERO_PATTERN);
    12391        KSPSetFromOptions(ksp);
    12492
    125         #if defined(_SERIAL_) && _PETSC_MAJOR_==3
     93        #if _PETSC_MAJOR_==3
    12694        /*Specific solver?: */
    12795        KSPGetPC(ksp,&pc);
     
    133101                #endif
    134102        }
    135         #endif
    136103
    137         #if defined(_PARALLEL_) && _PETSC_MAJOR_==3
    138104        /*Stokes: */
    139105        if (solver_type==StokesSolverEnum){
     
    155121        #endif
    156122
    157         /*}}}*/
    158         /*If there is an initial guess for the solution, use it, except if we are using the MUMPS direct solver, where any initial guess will crash Petsc: {{{1*/
     123        /*If there is an initial guess for the solution, use it
     124         * except if we are using the MUMPS direct solver
     125         * where any initial guess will crash Petsc*/
    159126        if (uf0){
    160                 if( (solver_type!=MUMPSPACKAGE_LU) && (solver_type!=MUMPSPACKAGE_CHOL) && (solver_type!=SPOOLESPACKAGE_LU) && (solver_type!=SPOOLESPACKAGE_CHOL) && (solver_type!=SUPERLUDISTPACKAGE)){
     127                if((solver_type!=MUMPSPACKAGE_LU) && (solver_type!=MUMPSPACKAGE_CHOL) && (solver_type!=SPOOLESPACKAGE_LU) && (solver_type!=SPOOLESPACKAGE_CHOL) && (solver_type!=SUPERLUDISTPACKAGE)){
    161128                        KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);
    162129                }
    163130        }
    164         /*}}}*/
    165        
    166         if(VerboseSolver())KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD);
    167131
    168132        /*Solve: */
     133        if(VerboseSolver())KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD);
    169134        KSPSolve(ksp,pf,uf);
    170135       
  • issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp

    r12301 r12330  
    161161              else if (strcmp(name,"PetscProfilingCurrentFlops")==0) return PetscProfilingCurrentFlopsEnum;
    162162              else if (strcmp(name,"PetscProfilingSolutionTime")==0) return PetscProfilingSolutionTimeEnum;
     163              else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
    163164              else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
    164165              else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
     
    259260              else if (strcmp(name,"Input")==0) return InputEnum;
    260261              else if (strcmp(name,"IntInput")==0) return IntInputEnum;
    261               else if (strcmp(name,"IntParam")==0) return IntParamEnum;
    262262         else stage=3;
    263263   }
    264264   if(stage==3){
    265               if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
     265              if (strcmp(name,"IntParam")==0) return IntParamEnum;
     266              else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
    266267              else if (strcmp(name,"MacAyeal2dIceFront")==0) return MacAyeal2dIceFrontEnum;
    267268              else if (strcmp(name,"MacAyeal3dIceFront")==0) return MacAyeal3dIceFrontEnum;
     
    382383              else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
    383384              else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
    384               else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
    385385         else stage=4;
    386386   }
    387387   if(stage==4){
    388               if (strcmp(name,"P0")==0) return P0Enum;
     388              if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
     389              else if (strcmp(name,"P0")==0) return P0Enum;
    389390              else if (strcmp(name,"P1")==0) return P1Enum;
    390391              else if (strcmp(name,"P1DG")==0) return P1DGEnum;
  • issm/trunk/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp

    r8607 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/SurfaceAreax/SurfaceAreax.cpp

    r5414 r12330  
    2828
    2929        /*Sum all J from all cpus of the cluster:*/
    30         MPI_Reduce (&S,&S_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
     30        #ifdef _HAVE_MPI_
     31        MPI_Reduce (&S,&S_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3132        MPI_Bcast(&S_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3233        S=S_sum;
     34        #endif
    3335
    3436        /*add surface area to element inputs:*/
  • issm/trunk/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp

    r8607 r12330  
    3131
    3232        /*Sum all J from all cpus of the cluster:*/
     33        #ifdef _HAVE_MPI_
    3334        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3435        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3536        J=J_sum;
     37        #endif
    3638
    3739        /*Assign output pointers: */
  • issm/trunk/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp

    r8607 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp

    r8607 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp

    r8607 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/ThicknessAbsGradientx/ThicknessAbsGradientx.cpp

    r8608 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp

    r8607 r12330  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk/src/c/modules/TimeAdaptx/TimeAdaptx.cpp

    r6130 r12330  
    3131        }
    3232
    33         #ifdef _PARALLEL_
    3433        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3535        MPI_Reduce (&min_dt,&node_min_dt,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3636        MPI_Bcast(&node_min_dt,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
  • issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp

    r11995 r12330  
    1010#include "../../toolkits/toolkits.h"
    1111#include "../../EnumDefinitions/EnumDefinitions.h"
     12/*ANSI_DECLARATORS needed to call triangle library: */
     13#ifndef ANSI_DECLARATORS
     14#define ANSI_DECLARATORS
     15#include "triangle.h"
     16#undef ANSI_DECLARATORS
     17#else
     18#include "triangle.h"
     19#endif
    1220/*}}}*/
    1321
    14 
    15 void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order){
     22void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area){
    1623
    1724        /*indexing: */
     
    2835
    2936        /*intermediary: */
    30         int      counter,backcounter;
     37        int      counter,counter2,backcounter;
    3138        Contour* contour=NULL;
    3239
     
    3946        for (i=0;i<domain->Size();i++){
    4047                contour=(Contour*)domain->GetObjectByOffset(i);
     48                in.numberofpoints+=contour->nods-1;
     49        }
     50        for (i=0;i<rifts->Size();i++){
     51                contour=(Contour*)rifts->GetObjectByOffset(i);
    4152                in.numberofpoints+=contour->nods;
    4253        }
     54
    4355        /*number of point attributes: */
    4456        in.numberofpointattributes=1;
     
    5062        for (i=0;i<domain->Size();i++){
    5163                contour=(Contour*)domain->GetObjectByOffset(i);
     64                for (j=0;j<contour->nods-1;j++){
     65                        in.pointlist[2*counter+0]=contour->x[j];
     66                        in.pointlist[2*counter+1]=contour->y[j];
     67                        counter++;
     68                }
     69        }
     70        for (i=0;i<rifts->Size();i++){
     71                contour=(Contour*)rifts->GetObjectByOffset(i);
    5272                for (j=0;j<contour->nods;j++){
    5373                        in.pointlist[2*counter+0]=contour->x[j];
     
    5878       
    5979        /*fill in the point attribute list: */
    60         in.pointattributelist = (REAL *) xmalloc(in.numberofpoints * in.numberofpointattributes * sizeof(REAL));
     80        in.pointattributelist = (REAL*)xmalloc(in.numberofpoints*in.numberofpointattributes*sizeof(REAL));
    6181        for (i=0;i<in.numberofpoints;i++) in.pointattributelist[i] = 0.0;
    6282       
     
    6585        for(i=0;i<in.numberofpoints;i++) in.pointmarkerlist[i] = 0;
    6686
    67 
    6887        /*Build segments. First figure out number of segments: holes and closed outlines have as many segments as vertices: */
    6988        in.numberofsegments=0;
    7089        for (i=0;i<domain->Size();i++){
    7190                contour=(Contour*)domain->GetObjectByOffset(i);
    72                 in.numberofsegments+=contour->nods;
     91                in.numberofsegments+=contour->nods-1;
     92        }
     93        for(i=0;i<rifts->Size();i++){
     94                contour=(Contour*)rifts->GetObjectByOffset(i);
     95                /*for rifts, we have one less segment as we have vertices*/
     96                in.numberofsegments+=contour->nods-1;
    7397        }
    7498       
     
    79103        for (i=0;i<domain->Size();i++){
    80104                contour=(Contour*)domain->GetObjectByOffset(i);
    81                 for (j=0;j<contour->nods-1;j++){
     105                for (j=0;j<contour->nods-2;j++){
    82106                        in.segmentlist[2*counter+0]=counter;
    83107                        in.segmentlist[2*counter+1]=counter+1;
     
    92116                 backcounter=counter;
    93117        }
    94 
     118        counter2=counter;
     119        for (i=0;i<rifts->Size();i++){
     120                contour=(Contour*)rifts->GetObjectByOffset(i);
     121                for (j=0;j<(contour->nods-1);j++){
     122                        in.segmentlist[2*counter2+0]=counter;
     123                        in.segmentlist[2*counter2+1]=counter+1;
     124                        in.segmentmarkerlist[counter2]=2+i;
     125                        counter2++;
     126                        counter++;
     127                }
     128                counter++;
     129        }
    95130       
    96131        /*Build regions: */
     
    103138                for (i=0;i<domain->Size()-1;i++){
    104139                        contour=(Contour*)domain->GetObjectByOffset(i+1);
    105                         GridInsideHole(&in.holelist[2*i+0],&in.holelist[2*i+1],contour->nods,contour->x,contour->y);
     140                        GridInsideHole(&in.holelist[2*i+0],&in.holelist[2*i+1],contour->nods-1,contour->x,contour->y);
    106141                }
    107142        }
    108143
    109144        /* Make necessary initializations so that Triangle can return a triangulation in `out': */
    110 
    111         out.pointlist = (REAL *) NULL;           
    112         out.pointattributelist = (REAL *) NULL;
    113         out.pointmarkerlist = (int *) NULL;
    114         out.trianglelist = (int *) NULL;         
    115         out.triangleattributelist = (REAL *) NULL;
    116         out.neighborlist = (int *) NULL;         
    117         out.segmentlist = (int *) NULL;
    118         out.segmentmarkerlist = (int *) NULL;
    119         out.edgelist = (int *) NULL;             
    120         out.edgemarkerlist = (int *) NULL;   
     145        out.pointlist             = (REAL*)NULL;
     146        out.pointattributelist    = (REAL*)NULL;
     147        out.pointmarkerlist       = (int *)NULL;
     148        out.trianglelist          = (int *)NULL;
     149        out.triangleattributelist = (REAL*)NULL;
     150        out.neighborlist          = (int *)NULL;
     151        out.segmentlist           = (int *)NULL;
     152        out.segmentmarkerlist     = (int *)NULL;
     153        out.edgelist              = (int *)NULL;
     154        out.edgemarkerlist        = (int *)NULL;
    121155
    122156        /* Triangulate the points:.  Switches are chosen to read and write a  */
     
    125159        /*   produce an edge list (e), a Voronoi diagram (v), and a triangle */
    126160        /*   neighbor list (n).                                              */
    127 
    128161        sprintf(options,"%s%lf","pQzDq30ia",area); /*replace V by Q to quiet down the logging*/
    129 
    130  
    131162        triangulate(options, &in, &out, NULL);
    132 
    133163        /*report(&out, 0, 1, 1, 1, 1, 0);*/
    134 
    135164
    136165        /*Allocate index, x and y: */
     
    141170        segmentmarkerlist=(double*)xmalloc(out.numberofsegments*sizeof(double));
    142171
    143         for (i = 0; i < out.numberoftriangles; i++) {
     172        for (i = 0; i< out.numberoftriangles; i++) {
    144173                for (j = 0; j < out.numberofcorners; j++) {
    145                         *(index+3*i+j)=(double)out.trianglelist[i * out.numberofcorners + j]+1;
    146                 }
    147         }
    148         for (i = 0; i < out.numberofpoints; i++) {
    149                 x[i]=out.pointlist[i * 2 + 0];
    150                 y[i]=out.pointlist[i * 2 + 1];
    151         }
    152        
    153         for (i = 0; i < out.numberofsegments; i++) {
     174                        index[3*i+j]=(double)out.trianglelist[i*out.numberofcorners+j]+1;
     175                }
     176        }
     177        for (i = 0; i< out.numberofpoints; i++){
     178                x[i]=out.pointlist[i*2+0];
     179                y[i]=out.pointlist[i*2+1];
     180        }
     181        for (i = 0; i<out.numberofsegments;i++){
    154182                segments[3*i+0]=(double)out.segmentlist[i*2+0]+1;
    155183                segments[3*i+1]=(double)out.segmentlist[i*2+1]+1;
     
    157185        }
    158186
    159 
    160 
    161187        /*Associate elements with segments: */
    162188        AssociateSegmentToElement(&segments,out.numberofsegments,index,out.numberoftriangles);
    163189
    164190        /*Order segments so that their normals point outside the domain: */
    165         if(order){
    166                 OrderSegments(&segments,out.numberofsegments, index,out.numberoftriangles);
    167         }
    168 
     191        OrderSegments(&segments,out.numberofsegments, index,out.numberoftriangles);
    169192
    170193        /*Output : */
     
    179202        *py=new Vector(y,out.numberofpoints);
    180203        *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments);
    181 
    182204}
  • issm/trunk/src/c/modules/TriMeshx/TriMeshx.h

    r11995 r12330  
    66#define _TRIMESHX_H_
    77
    8 
    9 
    10 /*ANSI_DECLARATORS needed to call triangle library: */
    11 #ifndef ANSI_DECLARATORS
    12 #define ANSI_DECLARATORS
    13 #include "triangle.h"
    14 #undef ANSI_DECLARATORS
    15 #else
    16 #include "triangle.h"
    17 #endif
    18 
    198#include "string.h"
    20 
    219#include "../../Container/Container.h"
    2210#include "../../objects/objects.h"
    2311
    2412/* local prototypes: */
    25 void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order);
     13void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area);
    2614
    2715#endif  /* _TRIMESHX_H */
  • issm/trunk/src/c/modules/modules.h

    r12296 r12330  
    6262#include "./Exp2Kmlx/Exp2Kmlx.h"
    6363#include "./Kml2Expx/Kml2Expx.h"
     64#include "./Krigingx/Krigingx.h"
    6465#include "./Shp2Kmlx/Shp2Kmlx.h"
    6566#include "./MassFluxx/MassFluxx.h"
     
    112113#include "./TimeAdaptx/TimeAdaptx.h"
    113114#include "./TriaSearchx/TriaSearchx.h"
    114 #ifdef _SERIAL_
    115115#include "./TriMeshx/TriMeshx.h"
    116 #endif
    117116#include "./ThicknessAbsMisfitx/ThicknessAbsMisfitx.h"
    118117#include "./ThicknessAbsGradientx/ThicknessAbsGradientx.h"
  • issm/trunk/src/c/objects/Bamg/BamgGeom.cpp

    r11995 r12330  
    1919}
    2020/*}}}*/
    21 /*FUNCTION BamgGeom::BamgGeom(mxArray* matlab_struct){{{1*/
    22 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    23 BamgGeom::BamgGeom(mxArray* matlab_struct){
    24 
    25         FetchData(&this->Vertices,        &this->VerticesSize[0],        &this->VerticesSize[1],        mxGetAssignedField(matlab_struct,0,"Vertices"));
    26         FetchData(&this->Edges,           &this->EdgesSize[0],           &this->EdgesSize[1],           mxGetAssignedField(matlab_struct,0,"Edges"));
    27         this->TangentAtEdgesSize[0]=0,    this->TangentAtEdgesSize[1]=0;    this->TangentAtEdges=NULL;
    28         FetchData(&this->Corners,         &this->CornersSize[0],         &this->CornersSize[1],         mxGetAssignedField(matlab_struct,0,"Corners"));
    29         FetchData(&this->RequiredVertices,&this->RequiredVerticesSize[0],&this->RequiredVerticesSize[1],mxGetAssignedField(matlab_struct,0,"RequiredVertices"));
    30         FetchData(&this->RequiredEdges,   &this->RequiredEdgesSize[0],   &this->RequiredEdgesSize[1],   mxGetAssignedField(matlab_struct,0,"RequiredEdges"));
    31         FetchData(&this->CrackedEdges,    &this->CrackedEdgesSize[0],    &this->CrackedEdgesSize[1],    mxGetAssignedField(matlab_struct,0,"CrackedEdges"));
    32         FetchData(&this->SubDomains,      &this->SubDomainsSize[0],      &this->SubDomainsSize[1],      mxGetAssignedField(matlab_struct,0,"SubDomains"));
    33 
    34 }
    35 #endif
    36 /*}}}*/
    3721/*FUNCTION BamgGeom::~BamgGeom(){{{1*/
    3822BamgGeom::~BamgGeom(){
     
    4933}
    5034/*}}}*/
    51 
    52 /*Methods*/
    53 /*FUNCTION BamgGeom::SetMatlabStructureFields{{{1*/
    54 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    55 void BamgGeom::SetMatlabStructureFields(mxArray** matlab_struct){
    56 
    57         /*Intermediary*/
    58         int         i;
    59         mxArray*    output=NULL;
    60         const int         numfields=7;
    61         const char* fnames[numfields];
    62         mwSize      ndim=2;
    63         mwSize      dimensions[2]={1,1};
    64 
    65         /*Initialize field names*/
    66         i=0;
    67         fnames[i++] = "Vertices";
    68         fnames[i++] = "Edges";
    69         fnames[i++] = "TangentAtEdges";
    70         fnames[i++] = "RequiredVertices";
    71         fnames[i++] = "RequiredEdges";
    72         fnames[i++] = "CrackedEdges";
    73         fnames[i++] = "SubDomains";
    74         _assert_(i==numfields);
    75 
    76         /*Initialize Matlab structure*/
    77         output=mxCreateStructArray(ndim,dimensions,numfields,fnames);
    78 
    79         /*set each matlab each field*/
    80         i=0;
    81         i++; SetMatlabStructureField(output,"Vertices",        this->VerticesSize[0],        this->VerticesSize[1],        this->Vertices);
    82         i++; SetMatlabStructureField(output,"Edges",           this->EdgesSize[0],           this->EdgesSize[1],           this->Edges);
    83         i++; SetMatlabStructureField(output,"TangentAtEdges",  this->TangentAtEdgesSize[0],  this->TangentAtEdgesSize[1],  this->TangentAtEdges);
    84         i++; SetMatlabStructureField(output,"RequiredVertices",this->RequiredVerticesSize[0],this->RequiredVerticesSize[1],this->RequiredVertices);
    85         i++; SetMatlabStructureField(output,"RequiredEdges",   this->RequiredEdgesSize[0],   this->RequiredEdgesSize[1],   this->RequiredEdges);
    86         i++; SetMatlabStructureField(output,"CrackedEdges",    this->CrackedEdgesSize[0],    this->CrackedEdgesSize[1],    this->CrackedEdges);
    87         i++; SetMatlabStructureField(output,"SubDomains",      this->SubDomainsSize[0],      this->SubDomainsSize[1],      this->SubDomains);
    88         _assert_(i==numfields);
    89 
    90         /*Assign output*/
    91         *matlab_struct=output;
    92 
    93 }
    94 #endif
    95 /*}}}*/
    96 /*FUNCTION BamgGeom::SetMatlabStructureField{{{1*/
    97 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    98 void BamgGeom::SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer){
    99 
    100         /*Intermediary*/
    101         int         i1,i2;
    102         mxArray*    pfield=NULL;
    103         mxArray*    pfield2=NULL;
    104 
    105         /*Copy field*/
    106         double*  fieldcopy=NULL;
    107         if (fieldrows*fieldcols){
    108                 fieldcopy=(double*)xmalloc(fieldrows*fieldcols*sizeof(double));
    109                 for(i1=0;i1<fieldrows;i1++){
    110                         for(i2=0;i2<fieldcols;i2++){
    111                                 fieldcopy[fieldcols*i1+i2]=fieldpointer[fieldcols*i1+i2];
    112                         }
    113                 }
    114         }
    115 
    116         /*Set matlab field*/
    117         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    118         mxSetM(pfield,fieldcols);
    119         mxSetN(pfield,fieldrows);
    120         mxSetPr(pfield,fieldcopy);
    121         mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose
    122         mxSetField(matlab_struct,0,fieldname,pfield2);
    123 }
    124 #endif
    125 /*}}}*/
  • issm/trunk/src/c/objects/Bamg/BamgGeom.h

    r11995 r12330  
    44#ifndef _BAMGGEOM_H_
    55#define _BAMGGEOM_H_
    6 
    7 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    8 #include <mex.h>
    9 #endif
    106
    117class BamgGeom{
     
    3026
    3127                BamgGeom();
    32                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    33                 BamgGeom(mxArray* matlab_struct);
    34                 #endif
    3528                ~BamgGeom();
    36 
    37                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    38                 void SetMatlabStructureFields(mxArray** matlab_struct);
    39                 void SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
    40                 #endif
    4129};
    4230
  • issm/trunk/src/c/objects/Bamg/BamgMesh.cpp

    r11995 r12330  
    1818        this->CrackedEdgesSize[0]=0,              this->CrackedEdgesSize[1]=0;             this->CrackedEdges=NULL;
    1919
    20         this->VerticesOnGeomVertexSize[0]=0, this->VerticesOnGeomVertexSize[1]=0;this->VerticesOnGeomVertex=NULL;
    21         this->VerticesOnGeomEdgeSize[0]=0,   this->VerticesOnGeomEdgeSize[1]=0;  this->VerticesOnGeomEdge=NULL;
    22         this->EdgesOnGeomEdgeSize[0]=0,      this->EdgesOnGeomEdgeSize[1]=0;     this->EdgesOnGeomEdge=NULL;
     20        this->VerticesOnGeomVertexSize[0]=0,      this->VerticesOnGeomVertexSize[1]=0;     this->VerticesOnGeomVertex=NULL;
     21        this->VerticesOnGeomEdgeSize[0]=0,        this->VerticesOnGeomEdgeSize[1]=0;       this->VerticesOnGeomEdge=NULL;
     22        this->EdgesOnGeomEdgeSize[0]=0,           this->EdgesOnGeomEdgeSize[1]=0;          this->EdgesOnGeomEdge=NULL;
    2323
    2424        this->IssmEdgesSize[0]=0,                 this->IssmEdgesSize[1]=0;                this->IssmEdges=NULL;
     
    2828        this->NodalConnectivitySize[0]=0,         this->NodalConnectivitySize[1]=0;        this->NodalConnectivity=NULL;
    2929        this->NodalElementConnectivitySize[0]=0,  this->NodalElementConnectivitySize[1]=0; this->NodalElementConnectivity=NULL;
    30 
    31 
    3230}
    33 /*}}}*/
    34 /*FUNCTION BamgMesh::BamgMesh(mxArray* matlab_struct){{{1*/
    35 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    36 BamgMesh::BamgMesh(mxArray* matlab_struct){
    37 
    38         int lines,cols;
    39 
    40         FetchData(&this->Vertices,            &this->VerticesSize[0],            &this->VerticesSize[1],            mxGetAssignedField(matlab_struct,0,"Vertices"));
    41         FetchData(&this->Edges,               &this->EdgesSize[0],               &this->EdgesSize[1],               mxGetAssignedField(matlab_struct,0,"Edges"));
    42         FetchData(&this->Triangles,           &this->TrianglesSize[0],           &this->TrianglesSize[1],           mxGetAssignedField(matlab_struct,0,"Triangles"));
    43         this->QuadrilateralsSize[0]=0,        this->QuadrilateralsSize[1]=0;     this->Quadrilaterals=NULL;
    44 
    45         this->SubDomainsSize[0]=0,            this->SubDomainsSize[1]=0;         this->SubDomains=NULL;
    46         this->SubDomainsFromGeomSize[0]=0,    this->SubDomainsFromGeomSize[1]=0; this->SubDomainsFromGeom=NULL;
    47         this->CrackedVerticesSize[0]=0,       this->CrackedVerticesSize[1]=0;    this->CrackedVertices=NULL;
    48         FetchData(&this->CrackedEdges,        &this->CrackedEdgesSize[0],        &this->CrackedEdgesSize[1],        mxGetAssignedField(matlab_struct,0,"CrackedEdges"));
    49 
    50         FetchData(&this->VerticesOnGeomEdge,  &this->VerticesOnGeomEdgeSize[0],  &this->VerticesOnGeomEdgeSize[1],  mxGetAssignedField(matlab_struct,0,"VerticesOnGeomEdge"));
    51         FetchData(&this->VerticesOnGeomVertex,&this->VerticesOnGeomVertexSize[0],&this->VerticesOnGeomVertexSize[1],mxGetAssignedField(matlab_struct,0,"VerticesOnGeomVertex"));
    52         FetchData(&this->EdgesOnGeomEdge,     &this->EdgesOnGeomEdgeSize[0],     &this->EdgesOnGeomEdgeSize[1],     mxGetAssignedField(matlab_struct,0,"EdgesOnGeomEdge"));
    53 
    54         this->IssmEdgesSize[0]=0,             this->IssmEdgesSize[1]=0;          this->IssmEdges=NULL;
    55         FetchData(&this->IssmSegments,        &this->IssmSegmentsSize[0],        &this->IssmSegmentsSize[1],        mxGetAssignedField(matlab_struct,0,"IssmSegments"));
    56 
    57         this->ElementConnectivitySize[0]=0,      this->ElementConnectivitySize[1]=0;      this->ElementConnectivity=NULL;
    58         this->NodalConnectivitySize[0]=0,        this->NodalConnectivitySize[1]=0;        this->NodalConnectivity=NULL;
    59         this->NodalElementConnectivitySize[0]=0, this->NodalElementConnectivitySize[1]=0; this->NodalElementConnectivity=NULL;
    60 
    61 }
    62 #endif
    6331/*}}}*/
    6432/*FUNCTION BamgMesh::~BamgMesh(){{{1*/
     
    8957}
    9058/*}}}*/
    91 
    92 /*Methods*/
    93 /*FUNCTION BamgMesh::SetMatlabStructureFields{{{1*/
    94 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    95 void BamgMesh::SetMatlabStructureFields(mxArray** matlab_struct){
    96 
    97         /*Intermediary*/
    98         int         i;
    99         mxArray*    output=NULL;
    100         const int         numfields=16;
    101         const char* fnames[numfields];
    102         mwSize      ndim=2;
    103         mwSize      dimensions[2]={1,1};
    104 
    105         /*Initialize field names*/
    106         i=0;
    107         fnames[i++] = "Triangles";
    108         fnames[i++] = "Vertices";
    109         fnames[i++] = "Edges";
    110         fnames[i++] = "IssmSegments";
    111         fnames[i++] = "IssmEdges";
    112         fnames[i++] = "Quadrilaterals";
    113         fnames[i++] = "VerticesOnGeomVertex";
    114         fnames[i++] = "VerticesOnGeomEdge";
    115         fnames[i++] = "EdgesOnGeomEdge";
    116         fnames[i++] = "SubDomains";
    117         fnames[i++] = "SubDomainsFromGeom";
    118         fnames[i++] = "ElementConnectivity";
    119         fnames[i++] = "NodalConnectivity";
    120         fnames[i++] = "NodalElementConnectivity";
    121         fnames[i++] = "CrackedVertices";
    122         fnames[i++] = "CrackedEdges";
    123         _assert_(i==numfields);
    124 
    125         /*Initialize Matlab structure*/
    126         output=mxCreateStructArray(ndim,dimensions,numfields,fnames);
    127 
    128         /*set each matlab each field*/
    129         i=0;
    130         i++; SetMatlabStructureField(output,"Triangles",                this->TrianglesSize[0],                this->TrianglesSize[1],                 this->Triangles);
    131         i++; SetMatlabStructureField(output,"Vertices",                 this->VerticesSize[0],                 this->VerticesSize[1],                  this->Vertices);
    132         i++; SetMatlabStructureField(output,"Edges",                    this->EdgesSize[0],                    this->EdgesSize[1],                     this->Edges);
    133         i++; SetMatlabStructureField(output,"IssmSegments",             this->IssmSegmentsSize[0],             this->IssmSegmentsSize[1],              this->IssmSegments);
    134         i++; SetMatlabStructureField(output,"IssmEdges",                this->IssmEdgesSize[0],                this->IssmEdgesSize[1],                 this->IssmEdges);
    135         i++; SetMatlabStructureField(output,"Quadrilaterals",           this->QuadrilateralsSize[0],           this->QuadrilateralsSize[1],            this->Quadrilaterals);
    136         i++; SetMatlabStructureField(output,"VerticesOnGeomVertex",this->VerticesOnGeomVertexSize[0],this->VerticesOnGeomVertexSize[1], this->VerticesOnGeomVertex);
    137         i++; SetMatlabStructureField(output,"VerticesOnGeomEdge",  this->VerticesOnGeomEdgeSize[0],  this->VerticesOnGeomEdgeSize[1],   this->VerticesOnGeomEdge);
    138         i++; SetMatlabStructureField(output,"EdgesOnGeomEdge",     this->EdgesOnGeomEdgeSize[0],     this->EdgesOnGeomEdgeSize[1],      this->EdgesOnGeomEdge);
    139         i++; SetMatlabStructureField(output,"SubDomains",               this->SubDomainsSize[0],               this->SubDomainsSize[1],                this->SubDomains);
    140         i++; SetMatlabStructureField(output,"SubDomainsFromGeom",       this->SubDomainsFromGeomSize[0],       this->SubDomainsFromGeomSize[1],        this->SubDomainsFromGeom);
    141         i++; SetMatlabStructureField(output,"ElementConnectivity",      this->ElementConnectivitySize[0],      this->ElementConnectivitySize[1],       this->ElementConnectivity);
    142         i++; SetMatlabStructureField(output,"NodalConnectivity",        this->NodalConnectivitySize[0],        this->NodalConnectivitySize[1],         this->NodalConnectivity);
    143         i++; SetMatlabStructureField(output,"NodalElementConnectivity", this->NodalElementConnectivitySize[0], this->NodalElementConnectivitySize[1],  this->NodalElementConnectivity);
    144         i++; SetMatlabStructureField(output,"CrackedVertices",          this->CrackedVerticesSize[0],          this->CrackedVerticesSize[1],           this->CrackedVertices);
    145         i++; SetMatlabStructureField(output,"CrackedEdges",             this->CrackedEdgesSize[0],             this->CrackedEdgesSize[1],              this->CrackedEdges);
    146         _assert_(i==numfields);
    147 
    148         /*Assign output*/
    149         *matlab_struct=output;
    150 
    151 }
    152 #endif
    153 /*}}}*/
    154 /*FUNCTION BamgMesh::SetMatlabStructureField{{{1*/
    155 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    156 void BamgMesh::SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer){
    157 
    158         /*Intermediary*/
    159         int         i1,i2;
    160         mxArray*    pfield=NULL;
    161         mxArray*    pfield2=NULL;
    162 
    163         /*Copy field*/
    164         double*  fieldcopy=NULL;
    165         if (fieldrows*fieldcols){
    166                 fieldcopy=(double*)xmalloc(fieldrows*fieldcols*sizeof(double));
    167                 for(i1=0;i1<fieldrows;i1++){
    168                         for(i2=0;i2<fieldcols;i2++){
    169                                 fieldcopy[fieldcols*i1+i2]=fieldpointer[fieldcols*i1+i2];
    170                         }
    171                 }
    172         }
    173 
    174         /*Set matlab field*/
    175         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    176         mxSetM(pfield,fieldcols);
    177         mxSetN(pfield,fieldrows);
    178         mxSetPr(pfield,fieldcopy);
    179         mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose
    180         mxSetField(matlab_struct,0,fieldname,pfield2);
    181 }
    182 #endif
    183 /*}}}*/
  • issm/trunk/src/c/objects/Bamg/BamgMesh.h

    r11995 r12330  
    44#ifndef _BAMGMESH_H_
    55#define _BAMGMESH_H_
    6 
    7 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    8 #include <mex.h>
    9 #endif
    106
    117class BamgMesh{
     
    5147
    5248                BamgMesh();
    53                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    54                 BamgMesh(mxArray* matlab_struct);
    55                 #endif
    5649                ~BamgMesh();
    57 
    58                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    59                 void SetMatlabStructureFields(mxArray** matlab_struct);
    60                 void SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
    61                 #endif
    62 
    6350};
    6451
  • issm/trunk/src/c/objects/Bamg/BamgOpts.cpp

    r11995 r12330  
    4040
    4141}
    42 /*}}}*/
    43 /*FUNCTION BamgOpts::BamgOpts(mxArray* matlab_struct){{{1*/
    44 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    45 BamgOpts::BamgOpts(mxArray* matlab_struct){
    46 
    47         FetchData(&this->anisomax,mxGetField(matlab_struct,0,"anisomax"));
    48         FetchData(&this->cutoff,mxGetField(matlab_struct,0,"cutoff"));
    49         FetchData(&this->coeff,mxGetField(matlab_struct,0,"coeff"));
    50         FetchData(&this->errg,mxGetField(matlab_struct,0,"errg"));
    51         FetchData(&this->gradation,mxGetField(matlab_struct,0,"gradation"));
    52         FetchData(&this->Hessiantype,mxGetField(matlab_struct,0,"Hessiantype"));
    53         FetchData(&this->MaxCornerAngle,mxGetField(matlab_struct,0,"MaxCornerAngle"));
    54         FetchData(&this->maxnbv,mxGetField(matlab_struct,0,"maxnbv"));
    55         FetchData(&this->maxsubdiv,mxGetField(matlab_struct,0,"maxsubdiv"));
    56         FetchData(&this->Metrictype,mxGetField(matlab_struct,0,"Metrictype"));
    57         FetchData(&this->nbjacobi,mxGetField(matlab_struct,0,"nbjacobi"));
    58         FetchData(&this->nbsmooth,mxGetField(matlab_struct,0,"nbsmooth"));
    59         FetchData(&this->omega,mxGetField(matlab_struct,0,"omega"));
    60         FetchData(&this->power,mxGetField(matlab_struct,0,"power"));
    61         FetchData(&this->verbose,mxGetField(matlab_struct,0,"verbose"));
    62 
    63         FetchData(&this->Crack,mxGetField(matlab_struct,0,"Crack"));
    64         FetchData(&this->geometricalmetric,mxGetField(matlab_struct,0,"geometricalmetric"));
    65         FetchData(&this->KeepVertices,mxGetField(matlab_struct,0,"KeepVertices"));
    66         FetchData(&this->splitcorners,mxGetField(matlab_struct,0,"splitcorners"));
    67 
    68         FetchData(&this->hmin,mxGetField(matlab_struct,0,"hmin"));
    69         FetchData(&this->hmax,mxGetField(matlab_struct,0,"hmax"));
    70         FetchData(&this->hminVertices,&this->hminVerticesSize[0],&this->hminVerticesSize[1],mxGetField(matlab_struct,0,"hminVertices"));
    71         FetchData(&this->hmaxVertices,&this->hmaxVerticesSize[0],&this->hmaxVerticesSize[1],mxGetField(matlab_struct,0,"hmaxVertices"));
    72         FetchData(&this->hVertices,&this->hVerticesSize[0],&this->hVerticesSize[1],mxGetField(matlab_struct,0,"hVertices"));
    73         FetchData(&this->metric,&this->metricSize[0],&this->metricSize[1],mxGetField(matlab_struct,0,"metric"));
    74         FetchData(&this->field,&this->fieldSize[0],&this->fieldSize[1],mxGetField(matlab_struct,0,"field"));
    75         FetchData(&this->err,&this->errSize[0],&this->errSize[1],mxGetField(matlab_struct,0,"err"));
    76 
    77         /*Additional checks*/
    78         this->Check();
    79 
    80 }
    81 #endif
    8242/*}}}*/
    8343/*FUNCTION BamgOpts::~BamgOpts() {{{1*/
  • issm/trunk/src/c/objects/Bamg/BamgOpts.h

    r11995 r12330  
    55#ifndef _BAMGOPTS_H_
    66#define _BAMGOPTS_H_
    7 
    8 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    9 #include <mex.h>
    10 #endif
    117
    128class BamgOpts{
     
    5450
    5551                BamgOpts();
    56                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    57                 BamgOpts(mxArray* matlab_struct);
    58                 #endif
    5952                ~BamgOpts();
    6053
  • issm/trunk/src/c/objects/Bamg/Geometry.cpp

    r9309 r12330  
    505505                float             *eangle   = new float[nbe];
    506506                double             eps      = 1e-20;
    507                 QuadTree           quadtree; // build quadtree to find duplicates
     507                BamgQuadtree           quadtree; // build quadtree to find duplicates
    508508                BamgVertex        *v0       = vertices;
    509509                GeomVertex *v0g      = (GeomVertex*) (void*)v0;
  • issm/trunk/src/c/objects/Bamg/Geometry.h

    r5573 r12330  
    1212
    1313        class Triangle;
    14         class QuadTree;
     14        class BamgQuadtree;
    1515        class GeomSubDomain;
    1616        class Edge;
     
    2020                public:
    2121
    22                         long                  NbRef;                         // counter of ref on the this class if 0 we can delete
    23                         long                  nbv;                           // number of vertices
    24                         long                  nbe;                           // number of edges
    25                         long                  nbsubdomains;
    26                         long                  nbcurves;
     22                        long           NbRef;                 // counter of ref on the this class if 0 we can delete
     23                        long           nbv;                   // number of vertices
     24                        long           nbe;                   // number of edges
     25                        long           nbsubdomains;
     26                        long           nbcurves;
    2727                        GeomVertex    *vertices;
    2828                        GeomEdge      *edges;
    29                         QuadTree             *quadtree;
     29                        BamgQuadtree  *quadtree;
    3030                        GeomSubDomain *subdomains;
    31                         Curve                *curves;
    32                         R2                    pmin,pmax;                     // domain extrema coordinates
    33                         double                coefIcoor;                     // coef to integer Icoor1;
    34                         double                MaxCornerAngle;
     31                        Curve         *curves;
     32                        R2             pmin,pmax;             // domain extrema coordinates
     33                        double         coefIcoor;             // coef to integer Icoor1;
     34                        double         MaxCornerAngle;
    3535
    3636                        //Constructor/Destructors
     
    4444                        GeomVertex       &operator[](long i) { return vertices[i];       };
    4545                        const GeomEdge   &operator()(long i) const { return edges[i];    };
    46                         GeomEdge         &operator()(long  i) { return edges[i];                };
     46                        GeomEdge         &operator()(long  i) { return edges[i];         };
    4747
    4848                        //Methods
  • issm/trunk/src/c/objects/Bamg/Mesh.cpp

    r11995 r12330  
    28852885
    28862886                //build quadtree
    2887                 if (!quadtree)  quadtree = new QuadTree(this,0);
     2887                if (!quadtree)  quadtree = new BamgQuadtree(this,0);
    28882888                quadtree->Add(*v0);
    28892889                quadtree->Add(*v1);
     
    31073107        }
    31083108        /*}}}1*/
    3109         /*FUNCTION Mesh::MakeQuadTree{{{1*/
    3110         void Mesh::MakeQuadTree() { 
    3111                 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/MakeQuadTree)*/
     3109        /*FUNCTION Mesh::MakeBamgQuadtree{{{1*/
     3110        void Mesh::MakeBamgQuadtree() { 
     3111                /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/MakeBamgQuadtree)*/
    31123112
    31133113                long int verbose=0;
    3114                 if (  !quadtree )  quadtree = new QuadTree(this);
     3114                if (  !quadtree )  quadtree = new BamgQuadtree(this);
    31153115
    31163116        }
     
    36223622
    36233623        if (!quadtree) delete quadtree; //ReInitialise;
    3624         quadtree = new QuadTree(this,0);
     3624        quadtree = new BamgQuadtree(this,0);
    36253625        quadtree->Add(*v0);
    36263626        quadtree->Add(*v1);
     
    39003900                if (quadtree){
    39013901                        delete quadtree;
    3902                         quadtree = new QuadTree(this);
     3902                        quadtree = new BamgQuadtree(this);
    39033903                }
    39043904
     
    41164116
    41174117        delete [] tstart;
    4118         if (quadtree) quadtree= new QuadTree(this);
     4118        if (quadtree) quadtree= new BamgQuadtree(this);
    41194119}
    41204120/*}}}1*/
  • issm/trunk/src/c/objects/Bamg/Mesh.h

    r10205 r12330  
    1717        class Geometry;
    1818        class CrackedEdge;
    19         class QuadTree;
     19        class BamgQuadtree;
    2020        class SubDomain;
    2121
     
    2929                        Triangle                     *triangles;
    3030                        Edge                         *edges;
    31                         QuadTree                     *quadtree;
     31                        BamgQuadtree                 *quadtree;
    3232                        BamgVertex                  **orderedvertices;
    3333                        SubDomain                    *subdomains;
     
    9494                        void MakeQuadrangles(double costheta);
    9595                        int  SplitElement(int choice);
    96                         void MakeQuadTree();
     96                        void MakeBamgQuadtree();
    9797                        void NewPoints(Mesh &,BamgOpts* bamgopts,int KeepVertices=1);
    9898                        long InsertNewPoints(long nbvold,long & NbTSwap) ;
  • issm/trunk/src/c/objects/Bamg/Metric.h

    r9690 r12330  
    55#include "../../shared/Bamg/shared.h"
    66#include "R2.h"
     7#include <math.h>
    78
    89namespace bamg {
  • issm/trunk/src/c/objects/Constraints/Constraint.h

    r9285 r12330  
    1111/*Headers:*/
    1212/*{{{1*/
     13class Nodes;
    1314#include "../Object.h"
    14 
    15 class Nodes;
    16 
    1715#include "../../toolkits/toolkits.h"
    1816/*}}}*/
  • issm/trunk/src/c/objects/Constraints/SpcDynamic.cpp

    r9883 r12330  
    7272}
    7373/*}}}1*/
    74 #ifdef _SERIAL_
    75 /*FUNCTION SpcDynamic::Marshall {{{1*/
    76 void  SpcDynamic::Marshall(char** pmarshalled_dataset){
    77 
    78         char* marshalled_dataset=NULL;
    79         int   enum_type=0;
    80 
    81         /*recover marshalled_dataset: */
    82         marshalled_dataset=*pmarshalled_dataset;
    83 
    84         /*get enum type of SpcDynamic: */
    85         enum_type=SpcDynamicEnum;
    86        
    87         /*marshall enum: */
    88         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    89        
    90         /*marshall SpcDynamic data: */
    91         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    92         memcpy(marshalled_dataset,&nodeid,sizeof(nodeid));marshalled_dataset+=sizeof(nodeid);
    93         memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
    94         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    95         memcpy(marshalled_dataset,&isset,sizeof(isset));marshalled_dataset+=sizeof(isset);
    96         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    97 
    98         *pmarshalled_dataset=marshalled_dataset;
    99         return;
    100 }
    101 /*}}}1*/
    102 /*FUNCTION SpcDynamic::MarshallSize {{{1*/
    103 int   SpcDynamic::MarshallSize(){
    104 
    105         return sizeof(sid)
    106                 +sizeof(nodeid)
    107                 +sizeof(dof)
    108                 +sizeof(value)
    109                 +sizeof(isset)
    110                 +sizeof(analysis_type)
    111                 +sizeof(int); //sizeof(int) for enum type
    112 }
    113 /*}}}1*/
    114 /*FUNCTION SpcDynamic::Demarshall {{{1*/
    115 void  SpcDynamic::Demarshall(char** pmarshalled_dataset){
    116 
    117         char* marshalled_dataset=NULL;
    118 
    119         /*recover marshalled_dataset: */
    120         marshalled_dataset=*pmarshalled_dataset;
    121 
    122         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    123          *object data (thanks to DataSet::Demarshall):*/
    124 
    125         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    126         memcpy(&nodeid,marshalled_dataset,sizeof(nodeid));marshalled_dataset+=sizeof(nodeid);
    127         memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
    128         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    129         memcpy(&isset,marshalled_dataset,sizeof(isset));marshalled_dataset+=sizeof(isset);
    130         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    131 
    132         /*return: */
    133         *pmarshalled_dataset=marshalled_dataset;
    134         return;
    135 }
    136 /*}}}1*/
    137 #endif
    13874/*FUNCTION SpcDynamic::ObjectEnum{{{1*/
    13975int SpcDynamic::ObjectEnum(void){
  • issm/trunk/src/c/objects/Constraints/SpcDynamic.h

    r9883 r12330  
    3434                int   Id();
    3535                int   MyRank();
    36                 #ifdef _SERIAL_
    37                 void  Marshall(char** pmarshalled_dataset);
    38                 int   MarshallSize();
    39                 void  Demarshall(char** pmarshalled_dataset);
    40                 #endif
    4136                int   ObjectEnum();
    4237                Object* copy();
  • issm/trunk/src/c/objects/Constraints/SpcStatic.cpp

    r9883 r12330  
    7575}
    7676/*}}}1*/
    77 #ifdef _SERIAL_
    78 /*FUNCTION SpcStatic::Marshall {{{1*/
    79 void  SpcStatic::Marshall(char** pmarshalled_dataset){
    80 
    81         char* marshalled_dataset=NULL;
    82         int   enum_type=0;
    83 
    84         /*recover marshalled_dataset: */
    85         marshalled_dataset=*pmarshalled_dataset;
    86 
    87         /*get enum type of SpcStatic: */
    88         enum_type=SpcStaticEnum;
    89        
    90         /*marshall enum: */
    91         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    92        
    93         /*marshall SpcStatic data: */
    94         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    95         memcpy(marshalled_dataset,&nodeid,sizeof(nodeid));marshalled_dataset+=sizeof(nodeid);
    96         memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
    97         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    98         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    99 
    100         *pmarshalled_dataset=marshalled_dataset;
    101         return;
    102 }
    103 /*}}}1*/
    104 /*FUNCTION SpcStatic::MarshallSize {{{1*/
    105 int   SpcStatic::MarshallSize(){
    106 
    107         return sizeof(sid)
    108                 +sizeof(nodeid)
    109                 +sizeof(dof)
    110                 +sizeof(value)
    111                 +sizeof(analysis_type)
    112                 +sizeof(int); //sizeof(int) for enum type
    113 }
    114 /*}}}1*/
    115 /*FUNCTION SpcStatic::Demarshall {{{1*/
    116 void  SpcStatic::Demarshall(char** pmarshalled_dataset){
    117 
    118         char* marshalled_dataset=NULL;
    119 
    120         /*recover marshalled_dataset: */
    121         marshalled_dataset=*pmarshalled_dataset;
    122 
    123         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    124          *object data (thanks to DataSet::Demarshall):*/
    125 
    126         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    127         memcpy(&nodeid,marshalled_dataset,sizeof(nodeid));marshalled_dataset+=sizeof(nodeid);
    128         memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
    129         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    130         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    131 
    132         /*return: */
    133         *pmarshalled_dataset=marshalled_dataset;
    134         return;
    135 }
    136 /*}}}1*/
    137 #endif
    13877/*FUNCTION SpcStatic::ObjectEnum{{{1*/
    13978int SpcStatic::ObjectEnum(void){
  • issm/trunk/src/c/objects/Constraints/SpcStatic.h

    r9883 r12330  
    3333                int   Id();
    3434                int   MyRank();
    35                 #ifdef _SERIAL_
    36                 void  Marshall(char** pmarshalled_dataset);
    37                 int   MarshallSize();
    38                 void  Demarshall(char** pmarshalled_dataset);
    39                 #endif
    4035                int   ObjectEnum();
    4136                Object* copy();
  • issm/trunk/src/c/objects/Constraints/SpcTransient.cpp

    r9883 r12330  
    8787}
    8888/*}}}1*/
    89 #ifdef _SERIAL_
    90 /*FUNCTION SpcTransient::Marshall {{{1*/
    91 void  SpcTransient::Marshall(char** pmarshalled_dataset){
    92 
    93         char* marshalled_dataset=NULL;
    94         int   enum_type=0;
    95 
    96         /*recover marshalled_dataset: */
    97         marshalled_dataset=*pmarshalled_dataset;
    98 
    99         /*get enum type of SpcTransient: */
    100         enum_type=SpcTransientEnum;
    101        
    102         /*marshall enum: */
    103         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    104        
    105         /*marshall SpcTransient data: */
    106         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    107         memcpy(marshalled_dataset,&nodeid,sizeof(nodeid));marshalled_dataset+=sizeof(nodeid);
    108         memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
    109         memcpy(marshalled_dataset,&nsteps,sizeof(nsteps));marshalled_dataset+=sizeof(nsteps);
    110         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    111         if(nsteps){
    112                 memcpy(marshalled_dataset,values,nsteps*sizeof(double));marshalled_dataset+=nsteps*sizeof(double);
    113                 memcpy(marshalled_dataset,times,nsteps*sizeof(double));marshalled_dataset+=nsteps*sizeof(double);
    114         }
    115 
    116         *pmarshalled_dataset=marshalled_dataset;
    117         return;
    118 }
    119 /*}}}1*/
    120 /*FUNCTION SpcTransient::MarshallSize {{{1*/
    121 int   SpcTransient::MarshallSize(){
    122 
    123         return sizeof(sid)
    124                 +sizeof(nodeid)
    125                 +sizeof(dof)
    126                 +sizeof(nsteps)
    127                 +nsteps*2*sizeof(double)
    128                 +sizeof(analysis_type)
    129                 +sizeof(int); //sizeof(int) for enum type
    130 }
    131 /*}}}1*/
    132 /*FUNCTION SpcTransient::Demarshall {{{1*/
    133 void  SpcTransient::Demarshall(char** pmarshalled_dataset){
    134 
    135         char* marshalled_dataset=NULL;
    136 
    137         /*recover marshalled_dataset: */
    138         marshalled_dataset=*pmarshalled_dataset;
    139 
    140         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    141          *object data (thanks to DataSet::Demarshall):*/
    142 
    143         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    144         memcpy(&nodeid,marshalled_dataset,sizeof(nodeid));marshalled_dataset+=sizeof(nodeid);
    145         memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
    146         memcpy(&nsteps,marshalled_dataset,sizeof(nsteps));marshalled_dataset+=sizeof(nsteps);
    147         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    148         if(nsteps){
    149                 values=(double*)xmalloc(nsteps*sizeof(double));
    150                 times=(double*)xmalloc(nsteps*sizeof(double));
    151                 memcpy(values,marshalled_dataset,nsteps*sizeof(double));marshalled_dataset+=nsteps*sizeof(double);
    152                 memcpy(times,marshalled_dataset,nsteps*sizeof(double));marshalled_dataset+=nsteps*sizeof(double);
    153         }
    154 
    155         /*return: */
    156         *pmarshalled_dataset=marshalled_dataset;
    157         return;
    158 }
    159 /*}}}1*/
    160 #endif
    16189/*FUNCTION SpcTransient::ObjectEnum{{{1*/
    16290int SpcTransient::ObjectEnum(void){
  • issm/trunk/src/c/objects/Constraints/SpcTransient.h

    r9883 r12330  
    3535                int   Id();
    3636                int   MyRank();
    37                 #ifdef _SERIAL_
    38                 void  Marshall(char** pmarshalled_dataset);
    39                 int   MarshallSize();
    40                 void  Demarshall(char** pmarshalled_dataset);
    41                 #endif
    4237                int   ObjectEnum();
    4338                Object* copy();
  • issm/trunk/src/c/objects/Contour.cpp

    r11995 r12330  
    99#endif
    1010
     11#include <string.h>
    1112#include "./objects.h"
    1213#include "../include/include.h"
     
    7980}
    8081/*}}}*/
    81 #ifdef _SERIAL_
    82 /*FUNCTION Contour::Marshall{{{1*/
    83 void  Contour::Marshall(char** pmarshalled_dataset){
    84 
    85         char* marshalled_dataset=NULL;
    86         int   enum_type=0;
    87         char* marshalled_inputs=NULL;
    88         int   marshalled_inputssize;
    89 
    90         /*recover marshalled_dataset: */
    91         marshalled_dataset=*pmarshalled_dataset;
    92 
    93         /*get enum type of Contour: */
    94         enum_type=ContourEnum;
    95        
    96         /*marshall enum: */
    97         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    98        
    99         /*marshall Contour data: */
    100         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    101         memcpy(marshalled_dataset,&nods,sizeof(nods));marshalled_dataset+=sizeof(nods);
    102         memcpy(marshalled_dataset,&closed,sizeof(closed));marshalled_dataset+=sizeof(closed);
    103         memcpy(marshalled_dataset,x,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
    104         memcpy(marshalled_dataset,y,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
    105 
    106         *pmarshalled_dataset=marshalled_dataset;
    107         return;
    108 }
    109 /*}}}*/
    110 /*FUNCTION Contour::MarshallSize{{{1*/
    111 int   Contour::MarshallSize(){
    112 
    113         return sizeof(id)+
    114                 sizeof(nods)+
    115                 sizeof(closed)+
    116                 2*nods*sizeof(double)+
    117                 sizeof(int); //sizeof(int) for enum type
    118 }
    119 /*}}}*/
    120 /*FUNCTION Contour::Demarshall{{{1*/
    121 void  Contour::Demarshall(char** pmarshalled_dataset){
    122 
    123         char* marshalled_dataset=NULL;
    124 
    125         /*recover marshalled_dataset: */
    126         marshalled_dataset=*pmarshalled_dataset;
    127 
    128         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    129          *object data (thanks to DataSet::Demarshall):*/
    130 
    131         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    132         memcpy(&nods,marshalled_dataset,sizeof(nods));marshalled_dataset+=sizeof(nods);
    133         memcpy(&closed,marshalled_dataset,sizeof(closed));marshalled_dataset+=sizeof(closed);
    134 
    135         if(nods){
    136                 this->x=(double*)xmalloc(nods*sizeof(double));
    137                 this->y=(double*)xmalloc(nods*sizeof(double));
    138                 memcpy(x,marshalled_dataset,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
    139                 memcpy(y,marshalled_dataset,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
    140         }
    141 
    142         /*return: */
    143         *pmarshalled_dataset=marshalled_dataset;
    144         return;
    145 }
    146 /*}}}*/
    147 #endif
    14882/*FUNCTION Contour::ObjectEnum{{{1*/
    14983int Contour::ObjectEnum(void){
  • issm/trunk/src/c/objects/Contour.h

    r11995 r12330  
    2020                int     id;
    2121                int       nods;  //number of vertices in the contour
    22                 double* x;
    23                 double* y;
     22                IssmDouble* x;
     23                IssmDouble* y;
    2424                bool    closed; //is this contour closed?
    2525
    2626                /*Contour constructors, destructors {{{1*/
    2727                Contour();
    28                 Contour(int id, int nods, double* x, double* y,bool closed);
     28                Contour(int id, int nods, IssmDouble* x, IssmDouble* y,bool closed);
    2929                ~Contour();
    3030                /*}}}*/
     
    3434                int   Id(void);
    3535                int   MyRank(void);
    36                 #ifdef _SERIAL_
    37                 void  Marshall(char** pmarshalled_dataset);
    38                 int   MarshallSize(void);
    39                 void  Demarshall(char** pmarshalled_dataset);
    40                 #endif
    4136                int   ObjectEnum(void);
    4237                Object* copy(void);
  • issm/trunk/src/c/objects/DofIndexing.cpp

    r9777 r12330  
    208208}               
    209209/*}}}*/
    210 #ifdef _SERIAL_
    211 /*FUNCTION DofIndexing::Marshall{{{1*/
    212 void  DofIndexing::Marshall(char** pmarshalled_dataset){
    213 
    214         char* marshalled_dataset=NULL;
    215         int   enum_type=0;
    216         bool  flagdoftype; //to indicate if there are some doftype or if NULL
    217 
    218         /*recover marshalled_dataset: */
    219         marshalled_dataset=*pmarshalled_dataset;
    220 
    221         /*preliminary: */
    222         if(this->doftype)flagdoftype=true;
    223         else             flagdoftype=false;
    224 
    225         /*get enum type of DofIndexing: */
    226         enum_type=DofIndexingEnum;
    227        
    228         /*marshall enum: */
    229         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    230        
    231         /*marshall DofIndexing data: */
    232         memcpy(marshalled_dataset,&gsize,sizeof(gsize));marshalled_dataset+=sizeof(gsize);
    233         memcpy(marshalled_dataset,&fsize,sizeof(fsize));marshalled_dataset+=sizeof(fsize);
    234         memcpy(marshalled_dataset,&ssize,sizeof(ssize));marshalled_dataset+=sizeof(ssize);
    235         memcpy(marshalled_dataset,&flagdoftype,sizeof(flagdoftype));marshalled_dataset+=sizeof(flagdoftype);
    236         memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone);
    237        
    238         if(this->gsize>0){
    239                 memcpy(marshalled_dataset,f_set,gsize*sizeof(bool));marshalled_dataset+=gsize*sizeof(bool);
    240                 memcpy(marshalled_dataset,s_set,gsize*sizeof(bool));marshalled_dataset+=gsize*sizeof(bool);
    241                 memcpy(marshalled_dataset,svalues,gsize*sizeof(double)); marshalled_dataset+=gsize*sizeof(double);
    242                 if(flagdoftype){ memcpy(marshalled_dataset,doftype,gsize*sizeof(int)); marshalled_dataset+=gsize*sizeof(int); }
    243                 memcpy(marshalled_dataset,gdoflist,gsize*sizeof(int)); marshalled_dataset+=gsize*sizeof(int);
    244         }
    245         if(this->fsize>0 && this->fsize!=UNDEF){ memcpy(marshalled_dataset,fdoflist,fsize*sizeof(int)); marshalled_dataset+=fsize*sizeof(int);}
    246         if(this->ssize>0 && this->ssize!=UNDEF){ memcpy(marshalled_dataset,sdoflist,ssize*sizeof(int)); marshalled_dataset+=ssize*sizeof(int);}
    247 
    248         *pmarshalled_dataset=marshalled_dataset;
    249         return;
    250 }
    251 /*}}}*/
    252 /*FUNCTION DofIndexing::MarshallSize{{{1*/
    253 int   DofIndexing::MarshallSize(){
    254 
    255         int size=0;
    256 
    257         size+=4*sizeof(int)+sizeof(bool);
    258         if(this->gsize>0){
    259                 size+= 2*this->gsize*sizeof(bool)+
    260                            this->gsize*sizeof(double)+
    261                            this->gsize*sizeof(int);
    262                 if(this->doftype)size+=this->gsize*sizeof(int);
    263         }
    264         if(this->fsize>0 && this->fsize!=UNDEF)size+=this->fsize*sizeof(int);
    265         if(this->ssize>0 && this->ssize!=UNDEF)size+=this->ssize*sizeof(int);
    266 
    267         size+=sizeof(int); //sizeof(int) for enum type
    268 
    269         return size;
    270 }
    271 /*}}}*/
    272 /*FUNCTION DofIndexing::Demarshall{{{1*/
    273 void  DofIndexing::Demarshall(char** pmarshalled_dataset){
    274 
    275         char* marshalled_dataset=NULL;
    276         int   enum_type;
    277         bool  flagdoftype;
    278 
    279         /*recover marshalled_dataset: */
    280         marshalled_dataset=*pmarshalled_dataset;
    281 
    282         /*get enum type of object since DofIndexing is not directly called by DataSet: */
    283         memcpy(&enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    284 
    285         /*easy part: */
    286         memcpy(&gsize,marshalled_dataset,sizeof(gsize));marshalled_dataset+=sizeof(gsize);
    287         memcpy(&fsize,marshalled_dataset,sizeof(fsize));marshalled_dataset+=sizeof(fsize);
    288         memcpy(&ssize,marshalled_dataset,sizeof(ssize));marshalled_dataset+=sizeof(ssize);
    289         memcpy(&flagdoftype,marshalled_dataset,sizeof(flagdoftype));marshalled_dataset+=sizeof(flagdoftype);
    290         memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone);
    291        
    292         /*Allocate: */
    293         if(this->gsize>0){
    294                 this->f_set=(bool*)xmalloc(this->gsize*sizeof(bool));
    295                 this->s_set=(bool*)xmalloc(this->gsize*sizeof(bool));
    296                 this->svalues=(double*)xmalloc(this->gsize*sizeof(double));
    297                 if(flagdoftype)this->doftype=(int*)xmalloc(this->gsize*sizeof(int));
    298                 else           this->doftype=NULL;
    299                 this->gdoflist=(int*)xmalloc(this->gsize*sizeof(int));
    300         }
    301         else{
    302                 this->f_set=NULL;
    303                 this->s_set=NULL;
    304                 this->svalues=NULL;
    305                 this->doftype=NULL;
    306                 this->gdoflist=NULL;
    307         }
    308         if(this->fsize>0)
    309          this->fdoflist=(int*)xmalloc(this->fsize*sizeof(int));
    310         else
    311          this->fdoflist=NULL;
    312         if(this->ssize>0)
    313          this->sdoflist=(int*)xmalloc(this->ssize*sizeof(int));
    314         else
    315          this->sdoflist=NULL;
    316 
    317         /*Copy arrays: */
    318         if(this->gsize>0){
    319                 memcpy(f_set,marshalled_dataset,gsize*sizeof(bool));marshalled_dataset+=gsize*sizeof(bool);
    320                 memcpy(s_set,marshalled_dataset,gsize*sizeof(bool));marshalled_dataset+=gsize*sizeof(bool);
    321                 memcpy(svalues,marshalled_dataset,gsize*sizeof(double));marshalled_dataset+=gsize*sizeof(double);
    322                 if(flagdoftype){memcpy(doftype,marshalled_dataset,gsize*sizeof(int));marshalled_dataset+=gsize*sizeof(int); }
    323                 memcpy(gdoflist,marshalled_dataset,gsize*sizeof(int));marshalled_dataset+=gsize*sizeof(int);
    324         }
    325        
    326         if(this->fsize>0 && this->fsize!=UNDEF){ memcpy(this->fdoflist,marshalled_dataset,this->fsize*sizeof(int));marshalled_dataset+=this->fsize*sizeof(int); }
    327         if(this->ssize>0 && this->ssize!=UNDEF){ memcpy(this->sdoflist,marshalled_dataset,this->ssize*sizeof(int));marshalled_dataset+=this->ssize*sizeof(int); }
    328 
    329         /*return: */
    330         *pmarshalled_dataset=marshalled_dataset;
    331         return;
    332 }
    333 /*}}}*/
    334 #endif
    335 
     210
  • issm/trunk/src/c/objects/DofIndexing.h

    r9777 r12330  
    55#ifndef _DOFINDEXING_H_
    66#define  _DOFINDEXING_H_
     7
     8#include "../include/include.h"
    79
    810class DofIndexing{
     
    2123                bool*     f_set; //is dof on f-set (on which we solve)
    2224                bool*     s_set; //is dof on s-set (on which boundary conditions -dirichlet- are applied)
    23                 double*   svalues; //list of constraint values. size g_size, for ease of use.
     25                IssmDouble*   svalues; //list of constraint values. size g_size, for ease of use.
    2426
    2527                /*types of dofs: */
     
    4345                void  Echo(void);
    4446                void  DeepEcho(void);
    45                 #ifdef _SERIAL_
    46                 void  Marshall(char** pmarshalled_dataset);
    47                 int   MarshallSize();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 #endif
    5047                void  copy(DofIndexing* properties);
    5148                /*}}}*/
  • issm/trunk/src/c/objects/ElementResults/BoolElementResult.cpp

    r11995 r12330  
    6464}
    6565/*}}}*/
    66 #ifdef _SERIAL_
    67 /*FUNCTION BoolElementResult::Marshall{{{1*/
    68 void  BoolElementResult::Marshall(char** pmarshalled_dataset){
    69 
    70         char* marshalled_dataset=NULL;
    71         int   enum_value=0;
    72 
    73         /*recover marshalled_dataset: */
    74         marshalled_dataset=*pmarshalled_dataset;
    75 
    76         /*get enum value of BoolElementResult: */
    77         enum_value=BoolElementResultEnum;
    78        
    79         /*marshall enum: */
    80         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    81        
    82         /*marshall BoolElementResult data: */
    83         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    84         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    85         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    86         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    87 
    88         *pmarshalled_dataset=marshalled_dataset;
    89 }
    90 /*}}}*/
    91 /*FUNCTION BoolElementResult::Demarshall{{{1*/
    92 void  BoolElementResult::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         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    105         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    106 
    107         /*return: */
    108         *pmarshalled_dataset=marshalled_dataset;
    109         return;
    110 }
    111 /*}}}*/
    112 /*FUNCTION BoolElementResult::MarshallSize{{{1*/
    113 int   BoolElementResult::MarshallSize(){
    114        
    115         return sizeof(value)+
    116                 +sizeof(enum_type)
    117                 +sizeof(time)
    118                 +sizeof(step)
    119                 +sizeof(int); //sizeof(int) for enum value
    120 }
    121 /*}}}*/
    122 #endif
    12366/*FUNCTION BoolElementResult::ObjectEnum{{{1*/
    12467int BoolElementResult::ObjectEnum(void){
  • issm/trunk/src/c/objects/ElementResults/BoolElementResult.h

    r11995 r12330  
    3535                int   Id();
    3636                int   MyRank();
    37                 #ifdef _SERIAL_
    38                 void  Marshall(char** pmarshalled_dataset);
    39                 int   MarshallSize();
    40                 void  Demarshall(char** pmarshalled_dataset);
    41                 #endif
    4237                int   ObjectEnum();
    4338                Object* copy();
  • issm/trunk/src/c/objects/ElementResults/DoubleElementResult.cpp

    r9883 r12330  
    6464}
    6565/*}}}*/
    66 #ifdef _SERIAL_
    67 /*FUNCTION DoubleElementResult::Marshall{{{1*/
    68 void  DoubleElementResult::Marshall(char** pmarshalled_dataset){
    69 
    70         char* marshalled_dataset=NULL;
    71         int   enum_value=0;
    72 
    73         /*recover marshalled_dataset: */
    74         marshalled_dataset=*pmarshalled_dataset;
    75 
    76         /*get enum value of DoubleElementResult: */
    77         enum_value=DoubleElementResultEnum;
    78        
    79         /*marshall enum: */
    80         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    81        
    82         /*marshall DoubleElementResult data: */
    83         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    84         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    85         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    86         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    87 
    88         *pmarshalled_dataset=marshalled_dataset;
    89 }
    90 /*}}}*/
    91 /*FUNCTION DoubleElementResult::Demarshall{{{1*/
    92 void  DoubleElementResult::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         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 DoubleElementResult::MarshallSize{{{1*/
    113 int   DoubleElementResult::MarshallSize(){
    114        
    115         return sizeof(value)+
    116                 +sizeof(enum_type)
    117                 +sizeof(time)
    118                 +sizeof(step)
    119                 +sizeof(int); //sizeof(int) for enum value
    120 }
    121 /*}}}*/
    122 #endif
    12366/*FUNCTION DoubleElementResult::ObjectEnum{{{1*/
    12467int DoubleElementResult::ObjectEnum(void){
  • issm/trunk/src/c/objects/ElementResults/DoubleElementResult.h

    r11995 r12330  
    3535                int   Id();
    3636                int   MyRank();
    37                 #ifdef _SERIAL_
    38                 void  Marshall(char** pmarshalled_dataset);
    39                 int   MarshallSize();
    40                 void  Demarshall(char** pmarshalled_dataset);
    41                 #endif
    4237                int   ObjectEnum();
    4338                Object* copy();
  • issm/trunk/src/c/objects/ElementResults/PentaP1ElementResult.cpp

    r11995 r12330  
    6767}
    6868/*}}}*/
    69 #ifdef _SERIAL_
    70 /*FUNCTION PentaP1ElementResult::Marshall{{{1*/
    71 void  PentaP1ElementResult::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 PentaP1ElementResult: */
    80         enum_value=PentaP1ElementResultEnum;
    81        
    82         /*marshall enum: */
    83         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    84        
    85         /*marshall PentaP1ElementResult data: */
    86         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    87         memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);
    88         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    89         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    90 
    91         *pmarshalled_dataset=marshalled_dataset;
    92 }
    93 /*}}}*/
    94 /*FUNCTION PentaP1ElementResult::MarshallSize{{{1*/
    95 int   PentaP1ElementResult::MarshallSize(){
    96        
    97         return sizeof(values)+
    98                 +sizeof(enum_type)
    99                 +sizeof(time)
    100                 +sizeof(step)
    101                 +sizeof(int); //sizeof(int) for enum value
    102 }
    103 /*}}}*/
    104 /*FUNCTION PentaP1ElementResult::Demarshall{{{1*/
    105 void  PentaP1ElementResult::Demarshall(char** pmarshalled_dataset){
    106 
    107         char* marshalled_dataset=NULL;
    108         int   i;
    109 
    110         /*recover marshalled_dataset: */
    111         marshalled_dataset=*pmarshalled_dataset;
    112 
    113         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    114          *object data (thanks to DataSet::Demarshall):*/
    115         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    116         memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);
    117         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    118         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    119 
    120         /*return: */
    121         *pmarshalled_dataset=marshalled_dataset;
    122         return;
    123 }
    124 /*}}}*/
    125 #endif
    12669/*FUNCTION PentaP1ElementResult::ObjectEnum{{{1*/
    12770int PentaP1ElementResult::ObjectEnum(void){
  • issm/trunk/src/c/objects/ElementResults/PentaP1ElementResult.h

    r11995 r12330  
    3434                int   Id();
    3535                int   MyRank();
    36                 #ifdef _SERIAL_
    37                 void  Marshall(char** pmarshalled_dataset);
    38                 int   MarshallSize();
    39                 void  Demarshall(char** pmarshalled_dataset);
    40                 #endif
    4136                int   ObjectEnum();
    4237                Object* copy();
  • issm/trunk/src/c/objects/ElementResults/TriaP1ElementResult.cpp

    r11995 r12330  
    6666}
    6767/*}}}*/
    68 #ifdef _SERIAL_
    69 /*FUNCTION TriaP1ElementResult::Marshall{{{1*/
    70 void  TriaP1ElementResult::Marshall(char** pmarshalled_dataset){
    71 
    72         char* marshalled_dataset=NULL;
    73         int   enum_value=0;
    74 
    75 
    76         /*recover marshalled_dataset: */
    77         marshalled_dataset=*pmarshalled_dataset;
    78 
    79         /*get enum value of TriaP1ElementResult: */
    80         enum_value=TriaP1ElementResultEnum;
    81        
    82         /*marshall enum: */
    83         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    84        
    85         /*marshall TriaP1ElementResult data: */
    86         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    87         memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);
    88         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    89         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    90 
    91         *pmarshalled_dataset=marshalled_dataset;
    92 }
    93 /*}}}*/
    94 /*FUNCTION TriaP1ElementResult::MarshallSize{{{1*/
    95 int   TriaP1ElementResult::MarshallSize(){
    96        
    97         return sizeof(values)
    98                 +sizeof(enum_type)
    99                 +sizeof(time)
    100                 +sizeof(step)
    101                 +sizeof(int); //sizeof(int) for enum value
    102 }
    103 /*}}}*/
    104 /*FUNCTION TriaP1ElementResult::Demarshall{{{1*/
    105 void  TriaP1ElementResult::Demarshall(char** pmarshalled_dataset){
    106 
    107         char* marshalled_dataset=NULL;
    108         int   i;
    109 
    110         /*recover marshalled_dataset: */
    111         marshalled_dataset=*pmarshalled_dataset;
    112 
    113         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    114          *object data (thanks to DataSet::Demarshall):*/
    115         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    116         memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);
    117         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    118         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    119 
    120         /*return: */
    121         *pmarshalled_dataset=marshalled_dataset;
    122         return;
    123 }
    124 /*}}}*/
    125 #endif
    12668/*FUNCTION TriaP1ElementResult::ObjectEnum{{{1*/
    12769int TriaP1ElementResult::ObjectEnum(void){
  • issm/trunk/src/c/objects/ElementResults/TriaP1ElementResult.h

    r11995 r12330  
    3333                int   Id();
    3434                int   MyRank();
    35                 #ifdef _SERIAL_
    36                 void  Marshall(char** pmarshalled_dataset);
    37                 int   MarshallSize();
    38                 void  Demarshall(char** pmarshalled_dataset);
    39                 #endif
    4035                int   ObjectEnum();
    4136                Object* copy();
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r12294 r12330  
    142142}
    143143/*}}}*/
    144 
    145 /*Marshall*/
    146 #ifdef _SERIAL_
    147 /*FUNCTION Penta::Marshall {{{1*/
    148 void  Penta::Marshall(char** pmarshalled_dataset){
    149 
    150         int   i;
    151         char* marshalled_dataset=NULL;
    152         int   enum_type=0;
    153         char* marshalled_inputs=NULL;
    154         int   marshalled_inputs_size;
    155         char* marshalled_results=NULL;
    156         int   marshalled_results_size;
    157         int   flaghook; //to indicate if hook is NULL or exists
    158 
    159         /*recover marshalled_dataset: */
    160         marshalled_dataset=*pmarshalled_dataset;
    161 
    162         /*get enum type of Penta: */
    163         enum_type=PentaEnum;
    164 
    165         /*marshall enum: */
    166         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    167 
    168         /*marshall Penta data: */
    169         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    170         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    171         memcpy(marshalled_dataset,&numanalyses,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
    172 
    173         /*Mershall Ref: */
    174         for(i=0;i<numanalyses;i++){
    175                 memcpy(marshalled_dataset,&element_type_list[i],sizeof(element_type_list[i]));marshalled_dataset+=sizeof(element_type_list[i]);
    176         }
    177 
    178         /*Marshall hooks: */
    179         for(i=0;i<numanalyses;i++){
    180                 if(hnodes[i]){
    181                         /*Set flag to 1 as there is a hook */
    182                         flaghook=1;
    183                         memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
    184                         hnodes[i]->Marshall(&marshalled_dataset);
    185                 }
    186                 else{
    187                         /*Set flag to 0 and do not marshall flag as there is no Hook */
    188                         flaghook=0;
    189                         memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
    190                 }
    191         }
    192         hmatice->Marshall(&marshalled_dataset);
    193         hmatpar->Marshall(&marshalled_dataset);
    194         hneighbors->Marshall(&marshalled_dataset);
    195 
    196         /*Marshall inputs and results: */
    197         marshalled_inputs_size=inputs->MarshallSize();
    198         marshalled_inputs=inputs->Marshall();
    199         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    200         marshalled_dataset+=marshalled_inputs_size;
    201 
    202         marshalled_results_size=results->MarshallSize();
    203         marshalled_results=results->Marshall();
    204         memcpy(marshalled_dataset,marshalled_results,marshalled_results_size*sizeof(char));
    205         marshalled_dataset+=marshalled_results_size;
    206 
    207         /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
    208 
    209         xfree((void**)&marshalled_inputs);
    210         xfree((void**)&marshalled_results);
    211 
    212         /*marshall horizontal neighbors: */
    213         memcpy(marshalled_dataset,horizontalneighborsids,3*sizeof(int));marshalled_dataset+=3*sizeof(int);
    214 
    215         *pmarshalled_dataset=marshalled_dataset;
    216         return;
    217 }
    218 /*}}}*/
    219 /*FUNCTION Penta::MarshallSize {{{1*/
    220 int   Penta::MarshallSize(){
    221 
    222         int i;
    223         int hnodes_size=0;;
    224 
    225         for(i=0;i<numanalyses;i++){
    226                 hnodes_size+=sizeof(int); //Flag 0 or 1
    227                 if (hnodes[i]) hnodes_size+=hnodes[i]->MarshallSize();
    228         }
    229 
    230         return sizeof(id)
    231                 +sizeof(sid)
    232                 +hnodes_size
    233                 +sizeof(numanalyses)
    234                 +numanalyses*sizeof(int) //element_type_lists
    235                 +hmatice->MarshallSize()
    236                 +hmatpar->MarshallSize()
    237                 +hneighbors->MarshallSize()
    238                 +inputs->MarshallSize()
    239                 +results->MarshallSize()
    240                 +3*sizeof(int)
    241                 +sizeof(int); //sizeof(int) for enum type
    242 }
    243 /*}}}*/
    244 /*FUNCTION Penta::Demarshall {{{1*/
    245 void  Penta::Demarshall(char** pmarshalled_dataset){
    246 
    247         char* marshalled_dataset=NULL;
    248         int   i;
    249         int flaghook;
    250 
    251         /*recover marshalled_dataset: */
    252         marshalled_dataset=*pmarshalled_dataset;
    253 
    254         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    255          *object data (thanks to DataSet::Demarshall):*/
    256         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    257         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    258         memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
    259 
    260         /*demarshall Ref: */
    261         this->element_type_list=(int*)xmalloc(this->numanalyses*sizeof(int));
    262         for(i=0;i<numanalyses;i++){ memcpy(&element_type_list[i],marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);}
    263 
    264         /*allocate dynamic memory: */
    265         this->hnodes=new Hook*[this->numanalyses];
    266         /*demarshall hooks: */
    267         for(i=0;i<numanalyses;i++){
    268                 memcpy(&flaghook,marshalled_dataset,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
    269                 if(flaghook){ // there is a hook so demarshall it
    270                         hnodes[i]=new Hook();
    271                         hnodes[i]->Demarshall(&marshalled_dataset);
    272                 }
    273                 else hnodes[i]=NULL; //There is no hook so it is NULL
    274         }
    275         hmatice=new Hook(); hmatice->Demarshall(&marshalled_dataset);
    276         hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset);
    277         hneighbors=new Hook(); hneighbors->Demarshall(&marshalled_dataset);
    278 
    279         /*pointers are garbage, until configuration is carried out: */
    280         nodes=NULL;
    281         matice=NULL;
    282         matpar=NULL;
    283         verticalneighbors=NULL;
    284 
    285         /*demarshall inputs and results: */
    286         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    287         results=(Results*)DataSetDemarshallRaw(&marshalled_dataset);
    288 
    289         /*parameters: may not exist even yet, so let Configure handle it: */
    290         this->parameters=NULL;
    291 
    292         /*neighbors: */
    293         memcpy(&this->horizontalneighborsids,marshalled_dataset,3*sizeof(int));marshalled_dataset+=3*sizeof(int);
    294 
    295         /*return: */
    296         *pmarshalled_dataset=marshalled_dataset;
    297         return;
    298 }
    299 /*}}}*/
    300 #endif
    301144
    302145/*Other*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r11995 r12330  
    5555                int               ObjectEnum();
    5656                int               Id();
    57                 #ifdef _SERIAL_
    58                 void      Marshall(char** pmarshalled_dataset);
    59                 int               MarshallSize();
    60                 void      Demarshall(char** pmarshalled_dataset);
    61                 #endif
    6257                int               MyRank();
    6358                /*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r12301 r12330  
    122122}
    123123/*}}}*/
    124 
    125 /*Marshall*/
    126 #ifdef _SERIAL_
    127 /*FUNCTION Tria::Marshall {{{1*/
    128 void  Tria::Marshall(char** pmarshalled_dataset){
    129 
    130         int   i;
    131         char* marshalled_dataset=NULL;
    132         int   enum_type=0;
    133         char* marshalled_inputs=NULL;
    134         int   marshalled_inputs_size;
    135         char* marshalled_results=NULL;
    136         int   marshalled_results_size;
    137         int   flaghook; //to indicate if hook is NULL or exists
    138 
    139         /*recover marshalled_dataset: */
    140         marshalled_dataset=*pmarshalled_dataset;
    141 
    142         /*get enum type of Tria: */
    143         enum_type=TriaEnum;
    144 
    145         /*marshall enum: */
    146         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    147 
    148         /*marshall Tria data: */
    149         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    150         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    151         memcpy(marshalled_dataset,&numanalyses,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
    152 
    153         /*Mershall Ref: */
    154         for(i=0;i<numanalyses;i++){
    155                 memcpy(marshalled_dataset,&element_type_list[i],sizeof(element_type_list[i]));marshalled_dataset+=sizeof(element_type_list[i]);
    156         }
    157 
    158         /*Marshall hooks: */
    159         for(i=0;i<numanalyses;i++){
    160                 if(hnodes[i]){
    161                         /*Set flag to 1 as there is a hook */
    162                         flaghook=1;
    163                         memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
    164                         hnodes[i]->Marshall(&marshalled_dataset);
    165                 }
    166                 else{
    167                         /*Set flag to 0 and do not marshall flag as there is no Hook */
    168                         flaghook=0;
    169                         memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
    170                 }
    171         }
    172         hmatice->Marshall(&marshalled_dataset);
    173         hmatpar->Marshall(&marshalled_dataset);
    174 
    175         /*Marshall inputs: */
    176         marshalled_inputs_size=inputs->MarshallSize();
    177         marshalled_inputs=inputs->Marshall();
    178         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    179         marshalled_dataset+=marshalled_inputs_size;
    180 
    181         /*Marshall results: */
    182         marshalled_results_size=results->MarshallSize();
    183         marshalled_results=results->Marshall();
    184         memcpy(marshalled_dataset,marshalled_results,marshalled_results_size*sizeof(char));
    185         marshalled_dataset+=marshalled_results_size;
    186 
    187         /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
    188 
    189         xfree((void**)&marshalled_inputs);
    190         xfree((void**)&marshalled_results);
    191 
    192         /*marshall horizontal neighbors: */
    193         memcpy(marshalled_dataset,horizontalneighborsids,3*sizeof(int));marshalled_dataset+=3*sizeof(int);
    194 
    195         *pmarshalled_dataset=marshalled_dataset;
    196         return;
    197 }
    198 /*}}}*/
    199 /*FUNCTION Tria::MarshallSize {{{1*/
    200 int   Tria::MarshallSize(){
    201 
    202         int i;
    203         int hnodes_size=0;;
    204 
    205         for(i=0;i<numanalyses;i++){
    206                 hnodes_size+=sizeof(int); //Flag 0 or 1
    207                 if (hnodes[i]) hnodes_size+=hnodes[i]->MarshallSize();
    208         }
    209 
    210         return sizeof(id)
    211           +sizeof(sid)
    212           +hnodes_size
    213           +sizeof(numanalyses)
    214           +numanalyses*sizeof(int) //element_type_lists
    215           +hmatice->MarshallSize()
    216           +hmatpar->MarshallSize()
    217           +inputs->MarshallSize()
    218           +results->MarshallSize()
    219           +3*sizeof(int)
    220           +sizeof(int); //sizeof(int) for enum type
    221 }
    222 /*}}}*/
    223 /*FUNCTION Tria::Demarshall {{{1*/
    224 void  Tria::Demarshall(char** pmarshalled_dataset){
    225 
    226         char* marshalled_dataset=NULL;
    227         int i;
    228         int flaghook;
    229 
    230         /*recover marshalled_dataset: */
    231         marshalled_dataset=*pmarshalled_dataset;
    232 
    233         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    234          *object data (thanks to DataSet::Demarshall):*/
    235         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    236         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    237         memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
    238 
    239         /*demarshall Ref: */
    240         this->element_type_list=(int*)xmalloc(this->numanalyses*sizeof(int));
    241         for(i=0;i<numanalyses;i++){ memcpy(&element_type_list[i],marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);}
    242 
    243         /*allocate dynamic memory: */
    244         this->hnodes=new Hook*[this->numanalyses];
    245         /*demarshall hooks: */
    246         for(i=0;i<numanalyses;i++){
    247                 memcpy(&flaghook,marshalled_dataset,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
    248                 if(flaghook){ // there is a hook so demarshall it
    249                         hnodes[i]=new Hook();
    250                         hnodes[i]->Demarshall(&marshalled_dataset);
    251                 }
    252                 else hnodes[i]=NULL; //There is no hook so it is NULL
    253         }
    254         hmatice=new Hook(); hmatice->Demarshall(&marshalled_dataset);
    255         hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset);
    256 
    257         /*pointers are garbabe, until configuration is carried out: */
    258         nodes=NULL;
    259         matice=NULL;
    260         matpar=NULL;
    261        
    262         /*demarshall inputs: */
    263         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    264         results=(Results*)DataSetDemarshallRaw(&marshalled_dataset);
    265 
    266         /*parameters: may not exist even yet, so let Configure handle it: */
    267         this->parameters=NULL;
    268 
    269         /*neighbors: */
    270         memcpy(&this->horizontalneighborsids,marshalled_dataset,3*sizeof(int));marshalled_dataset+=3*sizeof(int);
    271 
    272         /*return: */
    273         *pmarshalled_dataset=marshalled_dataset;
    274         return;
    275 }
    276 /*}}}*/
    277 #endif
    278124
    279125/*Other*/
     
    783629                basal_melting_input->GetInputValue(&basal_melting_g,gauss);
    784630                thickness_input->GetInputValue(&thickness_g,gauss);
    785                 if(basal_melting_correction_input) basal_melting_correction_input->GetInputValue(&basal_melting_correction_g,gauss);
     631                if(basal_melting_correction_input)
     632                 basal_melting_correction_input->GetInputValue(&basal_melting_correction_g,gauss);
     633                else
     634                 basal_melting_correction_g=0.;
    786635
    787636                for(i=0;i<numdof;i++) pe->values[i]+=Jdettria*gauss->weight*(thickness_g+dt*(surface_mass_balance_g-basal_melting_g-basal_melting_correction_g))*L[i];
  • issm/trunk/src/c/objects/Elements/Tria.h

    r11995 r12330  
    5151                int   Id();
    5252                int   MyRank();
    53                 #ifdef _SERIAL_
    54                 void  Marshall(char** pmarshalled_dataset);
    55                 int   MarshallSize();
    56                 void  Demarshall(char** pmarshalled_dataset);
    57                 #endif
    5853                int   ObjectEnum();
    5954                Object* copy();
  • issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.cpp

    r11995 r12330  
    6868}
    6969/*}}}*/
    70 #ifdef _SERIAL_
    71 /*FUNCTION BoolExternalResult::Marshall{{{1*/
    72 void  BoolExternalResult::Marshall(char** pmarshalled_dataset){
    73 
    74         char* marshalled_dataset=NULL;
    75         int   enum_value=0;
    76 
    77         /*recover marshalled_dataset: */
    78         marshalled_dataset=*pmarshalled_dataset;
    79 
    80         /*get enum value of BoolExternalResult: */
    81         enum_value=BoolExternalResultEnum;
    82        
    83         /*marshall enum: */
    84         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    85        
    86         /*marshall BoolExternalResult data: */
    87         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    88         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    89         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    90         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    91         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    92 
    93         *pmarshalled_dataset=marshalled_dataset;
    94 }
    95 /*}}}*/
    96 /*FUNCTION BoolExternalResult::MarshallSize{{{1*/
    97 int   BoolExternalResult::MarshallSize(){
    98        
    99         return sizeof(value)+
    100                 +sizeof(id)
    101                 +sizeof(enum_type)
    102                 +sizeof(step)
    103                 +sizeof(time)
    104                 +sizeof(int); //sizeof(int) for enum value
    105 }
    106 /*}}}*/
    107 /*FUNCTION BoolExternalResult::Demarshall{{{1*/
    108 void  BoolExternalResult::Demarshall(char** pmarshalled_dataset){
    109 
    110         char* marshalled_dataset=NULL;
    111         int   i;
    112 
    113         /*recover marshalled_dataset: */
    114         marshalled_dataset=*pmarshalled_dataset;
    115 
    116         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    117          *object data (thanks to DataSet::Demarshall):*/
    118         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    119         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    120         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    121         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    122         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    123 
    124         /*return: */
    125         *pmarshalled_dataset=marshalled_dataset;
    126         return;
    127 }
    128 /*}}}*/
    129 #endif
    13070/*FUNCTION BoolExternalResult::ObjectEnum{{{1*/
    13171int BoolExternalResult::ObjectEnum(void){
     
    185125}
    186126/*}}}*/
    187 /*FUNCTION BoolExternalResult::SetMatlabField{{{1*/
    188 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    189 void BoolExternalResult::SetMatlabField(mxArray* dataref){
    190 
    191         char* name=NULL;
    192         this->GetResultName(&name);
    193        
    194         mxSetField( dataref, this->step-1, name,mxCreateDoubleScalar((double)value));
    195         mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time));
    196         mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step));
    197 }
    198 #endif
    199 /*}}}*/
    200127/*FUNCTION BoolExternalResult::GetStep{{{1*/
    201128int BoolExternalResult::GetStep(void){
  • issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.h

    r11995 r12330  
    1515#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1616#endif
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    20 #endif
    21 
    2217
    2318#include "./ExternalResult.h"
     
    4742                int   Id();
    4843                int   MyRank();
    49                 #ifdef _SERIAL_
    50                 void  Marshall(char** pmarshalled_dataset);
    51                 int   MarshallSize();
    52                 void  Demarshall(char** pmarshalled_dataset);
    53                 #endif
    5444                int   ObjectEnum();
    5545                Object* copy();
     
    5949                void  WriteData(FILE* fid,bool io_gather);
    6050                void  GetResultName(char**);
    61             #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    62                 void  SetMatlabField(mxArray* dataref);
    63                 #endif
    6451                int   GetStep(void);
    6552                /*}}}*/
    6653};
    67 #endif  /* _BOOLEXTERNALRESULT_H */
     54#endif
  • issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.cpp

    r11995 r12330  
    6868}
    6969/*}}}*/
    70 #ifdef _SERIAL_
    71 /*FUNCTION DoubleExternalResult::Marshall{{{1*/
    72 void  DoubleExternalResult::Marshall(char** pmarshalled_dataset){
    73 
    74         char* marshalled_dataset=NULL;
    75         int   enum_value=0;
    76 
    77         /*recover marshalled_dataset: */
    78         marshalled_dataset=*pmarshalled_dataset;
    79 
    80         /*get enum value of DoubleExternalResult: */
    81         enum_value=DoubleExternalResultEnum;
    82        
    83         /*marshall enum: */
    84         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    85        
    86         /*marshall DoubleExternalResult data: */
    87         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    88         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    89         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    90         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    91         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    92 
    93         *pmarshalled_dataset=marshalled_dataset;
    94 }
    95 /*}}}*/
    96 /*FUNCTION DoubleExternalResult::MarshallSize{{{1*/
    97 int   DoubleExternalResult::MarshallSize(){
    98        
    99         return sizeof(value)+
    100                 +sizeof(id)
    101                 +sizeof(enum_type)
    102                 +sizeof(step)
    103                 +sizeof(time)
    104                 +sizeof(int); //sizeof(int) for enum value
    105 }
    106 /*}}}*/
    107 /*FUNCTION DoubleExternalResult::Demarshall{{{1*/
    108 void  DoubleExternalResult::Demarshall(char** pmarshalled_dataset){
    109 
    110         char* marshalled_dataset=NULL;
    111         int   i;
    112 
    113         /*recover marshalled_dataset: */
    114         marshalled_dataset=*pmarshalled_dataset;
    115 
    116         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    117          *object data (thanks to DataSet::Demarshall):*/
    118         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    119         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    120         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    121         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    122         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    123 
    124         /*return: */
    125         *pmarshalled_dataset=marshalled_dataset;
    126         return;
    127 }
    128 /*}}}*/
    129 #endif
    13070/*FUNCTION DoubleExternalResult::ObjectEnum{{{1*/
    13171int DoubleExternalResult::ObjectEnum(void){
     
    181121}
    182122/*}}}*/
    183 /*FUNCTION DoubleExternalResult::SetMatlabField{{{1*/
    184 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    185 void DoubleExternalResult::SetMatlabField(mxArray* dataref){
    186 
    187         char* name=NULL;
    188         this->GetResultName(&name);
    189         mxSetField( dataref,this->step-1, name,mxCreateDoubleScalar(value));
    190         mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time));
    191         mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step));
    192 
    193 }
    194 #endif
    195 /*}}}*/
    196123/*FUNCTION DoubleExternalResult::GetStep{{{1*/
    197124int DoubleExternalResult::GetStep(void){
  • issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.h

    r11995 r12330  
    1414#else
    1515#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    16 #endif
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    2016#endif
    2117
     
    4844                int   Id();
    4945                int   MyRank();
    50                 #ifdef _SERIAL_
    51                 void  Marshall(char** pmarshalled_dataset);
    52                 int   MarshallSize();
    53                 void  Demarshall(char** pmarshalled_dataset);
    54                 #endif
    5546                int   ObjectEnum();
    5647                Object* copy();
     
    6051                void  WriteData(FILE* fid,bool io_gather);
    6152                void  GetResultName(char**);
    62                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    63                 void  SetMatlabField(mxArray* dataref);
    64                 #endif
    6553                int   GetStep(void);
    6654                /*}}}*/
  • issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp

    r11995 r12330  
    9696}
    9797/*}}}*/
    98 #ifdef _SERIAL_
    99 /*FUNCTION DoubleMatExternalResult::Marshall{{{1*/
    100 void  DoubleMatExternalResult::Marshall(char** pmarshalled_dataset){
    101 
    102         char* marshalled_dataset=NULL;
    103         int   enum_value=0;
    104 
    105         /*recover marshalled_dataset: */
    106         marshalled_dataset=*pmarshalled_dataset;
    107 
    108         /*get enum value of DoubleMatExternalResult: */
    109         enum_value=DoubleMatExternalResultEnum;
    110        
    111         /*marshall enum: */
    112         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    113        
    114         /*marshall DoubleMatExternalResult data: */
    115         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    116         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    117         memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    118         memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N);
    119         memcpy(marshalled_dataset,values,M*sizeof(double));marshalled_dataset+=M*sizeof(double);
    120         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    121         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    122 
    123         *pmarshalled_dataset=marshalled_dataset;
    124 }
    125 /*}}}*/
    126 /*FUNCTION DoubleMatExternalResult::MarshallSize{{{1*/
    127 int   DoubleMatExternalResult::MarshallSize(){
    128        
    129         return sizeof(M)
    130                 +sizeof(N)
    131                 +M*N*sizeof(double)
    132                 +sizeof(id)
    133                 +sizeof(enum_type)
    134                 +sizeof(step)
    135                 +sizeof(time)
    136                 +sizeof(int); //sizeof(int) for enum value
    137 }
    138 /*}}}*/
    139 /*FUNCTION DoubleMatExternalResult::Demarshall{{{1*/
    140 void  DoubleMatExternalResult::Demarshall(char** pmarshalled_dataset){
    141 
    142         char* marshalled_dataset=NULL;
    143         int   i;
    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(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    155         memcpy(&N,marshalled_dataset,sizeof(N));marshalled_dataset+=sizeof(N);
    156         values=(double*)xmalloc(M*N*sizeof(double));
    157         memcpy(values,marshalled_dataset,M*N*sizeof(double));marshalled_dataset+=M*N*sizeof(double);
    158         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    159         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    160 
    161         /*return: */
    162         *pmarshalled_dataset=marshalled_dataset;
    163         return;
    164 }
    165 /*}}}*/
    166 #endif
    16798/*FUNCTION DoubleMatExternalResult::ObjectEnum{{{1*/
    16899int DoubleMatExternalResult::ObjectEnum(void){
     
    222153}
    223154/*}}}*/
    224 /*FUNCTION DoubleMatExternalResult::SetMatlabField{{{1*/
    225 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    226 void DoubleMatExternalResult::SetMatlabField(mxArray* dataref){
    227 
    228         mxArray* pfield=NULL;
    229         mxArray* pfield2=NULL;
    230         char* name=NULL;
    231         double* doublemat=NULL;
    232 
    233         /*Make a copy of the value, to be used by matlab: */
    234         doublemat=(double*)xmalloc(M*N*sizeof(double));
    235         memcpy(doublemat,values,M*N*sizeof(double));
    236 
    237         /*recover name: */
    238         this->GetResultName(&name);
    239                                
    240         /*create matlab matrix: */
    241         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    242         mxSetM(pfield,N);
    243         mxSetN(pfield,M);
    244         mxSetPr(pfield,doublemat);
    245        
    246         /*transpose the matrix, from c to matlab format */
    247         mexCallMATLAB(1,&pfield2, 1, &pfield, "transpose");
    248 
    249         /*set tranpose matrix inside the dataref structure: */
    250         mxSetField( dataref, this->step-1, name,pfield2);
    251         mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time));
    252         mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step));
    253 
    254 }
    255 #endif
    256 /*}}}*/
    257155/*FUNCTION DoubleMatExternalResult::GetStep{{{1*/
    258156int DoubleMatExternalResult::GetStep(void){
  • issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.h

    r11995 r12330  
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1515#endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    19 #endif
    20 
    2116
    2217#include "./ExternalResult.h"
     
    4944                int   Id();
    5045                int   MyRank();
    51                 #ifdef _SERIAL_
    52                 void  Marshall(char** pmarshalled_dataset);
    53                 int   MarshallSize();
    54                 void  Demarshall(char** pmarshalled_dataset);
    55                 #endif
    5646                int   ObjectEnum();
    5747                Object* copy();
     
    6151                void  WriteData(FILE* fid,bool io_gather);
    6252                void  GetResultName(char**);
    63                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    64                 void  SetMatlabField(mxArray* dataref);
    65                 #endif
    6653                int   GetStep(void);
    6754                /*}}}*/
  • issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp

    r11995 r12330  
    8787}
    8888/*}}}*/
    89 #ifdef _SERIAL_
    90 /*FUNCTION DoubleVecExternalResult::Marshall{{{1*/
    91 void  DoubleVecExternalResult::Marshall(char** pmarshalled_dataset){
    92 
    93         char* marshalled_dataset=NULL;
    94         int   enum_value=0;
    95 
    96         /*recover marshalled_dataset: */
    97         marshalled_dataset=*pmarshalled_dataset;
    98 
    99         /*get enum value of DoubleVecExternalResult: */
    100         enum_value=DoubleVecExternalResultEnum;
    101        
    102         /*marshall enum: */
    103         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    104        
    105         /*marshall DoubleVecExternalResult data: */
    106         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    107         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    108         memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    109         memcpy(marshalled_dataset,values,M*sizeof(double));marshalled_dataset+=M*sizeof(double);
    110         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    111         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    112 
    113         *pmarshalled_dataset=marshalled_dataset;
    114 }
    115 /*}}}*/
    116 /*FUNCTION DoubleVecExternalResult::MarshallSize{{{1*/
    117 int   DoubleVecExternalResult::MarshallSize(){
    118        
    119         return sizeof(M)
    120                 +M*sizeof(double)
    121                 +sizeof(id)
    122                 +sizeof(enum_type)
    123                 +sizeof(step)
    124                 +sizeof(time)
    125                 +sizeof(int); //sizeof(int) for enum value
    126 }
    127 /*}}}*/
    128 /*FUNCTION DoubleVecExternalResult::Demarshall{{{1*/
    129 void  DoubleVecExternalResult::Demarshall(char** pmarshalled_dataset){
    130 
    131         char* marshalled_dataset=NULL;
    132         int   i;
    133 
    134         /*recover marshalled_dataset: */
    135         marshalled_dataset=*pmarshalled_dataset;
    136 
    137         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    138          *object data (thanks to DataSet::Demarshall):*/
    139         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    140         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    141        
    142         /*data: */
    143         memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    144         values=(double*)xmalloc(M*sizeof(double));
    145         memcpy(values,marshalled_dataset,M*sizeof(double));marshalled_dataset+=M*sizeof(double);
    146         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    147         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    148 
    149         /*return: */
    150         *pmarshalled_dataset=marshalled_dataset;
    151         return;
    152 }
    153 /*}}}*/
    154 #endif
    15589/*FUNCTION DoubleVecExternalResult::ObjectEnum{{{1*/
    15690int DoubleVecExternalResult::ObjectEnum(void){
     
    206140}
    207141/*}}}*/
    208 /*FUNCTION DoubleVecExternalResult::SetMatlabField{{{1*/
    209 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    210 void DoubleVecExternalResult::SetMatlabField(mxArray* dataref){
    211 
    212         mxArray *pfield    = NULL;
    213         double  *doublemat = NULL;
    214         char    *name      = NULL;
    215         double  *doublevec = NULL;
    216 
    217         /*Make a copy of the value, to be used by matlab: */
    218         doublevec=(double*)xmalloc(M*sizeof(double));
    219         memcpy(doublevec,values,M*sizeof(double));
    220 
    221         /*recover name: */
    222         this->GetResultName(&name);
    223                                
    224         /*create matlab matrix: */
    225         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    226         mxSetM(pfield,M);
    227         mxSetN(pfield,1);
    228         mxSetPr(pfield,doublevec);
    229 
    230         mxSetField( dataref, this->step-1, name,pfield);
    231         mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time));
    232         mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step));
    233 }
    234 #endif
    235 /*}}}*/
    236142/*FUNCTION DoubleVecExternalResult::GetStep{{{1*/
    237143int DoubleVecExternalResult::GetStep(void){
  • issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.h

    r11995 r12330  
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1515#endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    19 #endif
    20 
    2116
    2217#include "./ExternalResult.h"
     
    4843                int   Id();
    4944                int   MyRank();
    50                 #ifdef _SERIAL_
    51                 void  Marshall(char** pmarshalled_dataset);
    52                 int   MarshallSize();
    53                 void  Demarshall(char** pmarshalled_dataset);
    54                 #endif
    5545                int   ObjectEnum();
    5646                Object* copy();
     
    6050                void  WriteData(FILE* fid,bool io_gather);
    6151                void  GetResultName(char**);
    62                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    63                 void  SetMatlabField(mxArray* dataref);
    64                 #endif
    6552                int   GetStep(void);
    6653                /*}}}*/
  • issm/trunk/src/c/objects/ExternalResults/ExternalResult.h

    r11995 r12330  
    1616#endif
    1717
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    20 #endif
    21 
    2218#include "../Object.h"
    2319#include "../Node.h"
     
    3329                virtual void  WriteData(FILE* fid,bool io_gather)=0;
    3430                virtual void  GetResultName(char**)=0;
    35                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    36                 virtual void  SetMatlabField(mxArray* dataref)=0;
    37                 #endif
    3831                virtual int   GetStep(void)=0;
    3932                /*}}}*/
  • issm/trunk/src/c/objects/ExternalResults/IntExternalResult.cpp

    r11995 r12330  
    6868}
    6969/*}}}*/
    70 #ifdef _SERIAL_
    71 /*FUNCTION IntExternalResult::Marshall{{{1*/
    72 void  IntExternalResult::Marshall(char** pmarshalled_dataset){
    73 
    74         char* marshalled_dataset=NULL;
    75         int   enum_value=0;
    76 
    77         /*recover marshalled_dataset: */
    78         marshalled_dataset=*pmarshalled_dataset;
    79 
    80         /*get enum value of IntExternalResult: */
    81         enum_value=IntExternalResultEnum;
    82        
    83         /*marshall enum: */
    84         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    85        
    86         /*marshall IntExternalResult data: */
    87         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    88         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    89         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    90         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    91         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    92 
    93         *pmarshalled_dataset=marshalled_dataset;
    94 }
    95 /*}}}*/
    96 /*FUNCTION IntExternalResult::MarshallSize{{{1*/
    97 int   IntExternalResult::MarshallSize(){
    98        
    99         return sizeof(value)+
    100                 +sizeof(id)
    101                 +sizeof(enum_type)
    102                 +sizeof(step)
    103                 +sizeof(time)
    104                 +sizeof(int); //sizeof(int) for enum value
    105 }
    106 /*}}}*/
    107 /*FUNCTION IntExternalResult::Demarshall{{{1*/
    108 void  IntExternalResult::Demarshall(char** pmarshalled_dataset){
    109 
    110         char* marshalled_dataset=NULL;
    111         int   i;
    112 
    113         /*recover marshalled_dataset: */
    114         marshalled_dataset=*pmarshalled_dataset;
    115 
    116         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    117          *object data (thanks to DataSet::Demarshall):*/
    118         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    119         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    120         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    121         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    122         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    123 
    124         /*return: */
    125         *pmarshalled_dataset=marshalled_dataset;
    126         return;
    127 }
    128 /*}}}*/
    129 #endif
    13070/*FUNCTION IntExternalResult::ObjectEnum{{{1*/
    13171int IntExternalResult::ObjectEnum(void){
     
    185125}
    186126/*}}}*/
    187 /*FUNCTION IntExternalResult::SetMatlabField{{{1*/
    188 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    189 void IntExternalResult::SetMatlabField(mxArray* dataref){
    190 
    191         char* name=NULL;
    192         this->GetResultName(&name);
    193 
    194         mxSetField( dataref, this->step-1, name,mxCreateDoubleScalar(value));
    195         mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time));
    196         mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step));
    197 
    198 }
    199 #endif
    200 /*}}}*/
    201127/*FUNCTION IntExternalResult::GetStep{{{1*/
    202128int IntExternalResult::GetStep(void){
  • issm/trunk/src/c/objects/ExternalResults/IntExternalResult.h

    r11995 r12330  
    1414#else
    1515#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    16 #endif
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    2016#endif
    2117
     
    4642                int   Id();
    4743                int   MyRank();
    48                 #ifdef _SERIAL_
    49                 void  Marshall(char** pmarshalled_dataset);
    50                 int   MarshallSize();
    51                 void  Demarshall(char** pmarshalled_dataset);
    52                 #endif
    5344                int   ObjectEnum();
    5445                Object* copy();
     
    5849                void  WriteData(FILE* fid,bool io_gather);
    5950                void  GetResultName(char**);
    60                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    61                 void  SetMatlabField(mxArray* dataref);
    62                 #endif
    6351                int   GetStep(void);
    6452                /*}}}*/
  • issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.cpp

    r11995 r12330  
    8080}
    8181/*}}}*/
    82 #ifdef _SERIAL_
    83 /*FUNCTION PetscVecExternalResult::Marshall{{{1*/
    84 void  PetscVecExternalResult::Marshall(char** pmarshalled_dataset){
    85 
    86         char* marshalled_dataset=NULL;
    87         int   enum_value=0;
    88         int   M;
    89         double* serial_value=NULL;
    90 
    91         /*recover marshalled_dataset: */
    92         marshalled_dataset=*pmarshalled_dataset;
    93 
    94         /*get enum value of PetscVecExternalResult: */
    95         enum_value=PetscVecExternalResultEnum;
    96        
    97         /*marshall enum: */
    98         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    99        
    100         /*marshall PetscVecExternalResult data: */
    101         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    102         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    103         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    104         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    105        
    106         if(value){
    107                 VecGetSize(value,&M);
    108                 VecToMPISerial(&serial_value,value);
    109                 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    110                 memcpy(marshalled_dataset,serial_value,M*sizeof(double));marshalled_dataset+=(M*sizeof(double));
    111         }
    112         else{
    113                 M=0;
    114                 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    115         }
    116         /*Free ressources:*/
    117         xfree((void**)&serial_value);
    118 
    119         /*return:*/
    120         *pmarshalled_dataset=marshalled_dataset;
    121 }
    122 /*}}}*/
    123 /*FUNCTION PetscVecExternalResult::MarshallSize{{{1*/
    124 int   PetscVecExternalResult::MarshallSize(){
    125 
    126         int M=0;
    127         if(value)VecGetSize(value,&M);
    128 
    129         return sizeof(M)+M*sizeof(double)
    130                 +sizeof(id)
    131                 +sizeof(enum_type)
    132                 +sizeof(step)
    133                 +sizeof(time)
    134                 +sizeof(int); //sizeof(int) for enum value
    135 }
    136 /*}}}*/
    137 /*FUNCTION PetscVecExternalResult::Demarshall{{{1*/
    138 void  PetscVecExternalResult::Demarshall(char** pmarshalled_dataset){
    139 
    140         char* marshalled_dataset=NULL;
    141         int   i;
    142         int   M;
    143         double* serial_vec=NULL;
    144         int*    idxm=NULL;
    145 
    146         /*recover marshalled_dataset: */
    147         marshalled_dataset=*pmarshalled_dataset;
    148 
    149         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    150          *object data (thanks to DataSet::Demarshall):*/
    151         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    152         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    153        
    154         /*data: */
    155         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    156         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    157        
    158         memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    159         if(M){
    160                 serial_vec=(double*)xmalloc(M*sizeof(double));
    161                 memcpy(serial_vec,marshalled_dataset,M*sizeof(double));marshalled_dataset+=(M*sizeof(double));
    162 
    163                 value=NewVec(M);
    164                 idxm=(int*)xmalloc(M*sizeof(int));
    165                 for(i=0;i<M;i++)idxm[i]=i;
    166                 VecSetValues(value,M,idxm,serial_vec,INSERT_VALUES);
    167 
    168                 VecAssemblyBegin(value);
    169                 VecAssemblyEnd(value);
    170 
    171                
    172         }
    173         else{
    174                 value=NULL;
    175         }
    176 
    177         /*Free ressources:*/
    178         xfree((void**)&serial_vec);
    179         xfree((void**)&idxm);
    180 
    181         /*return: */
    182         *pmarshalled_dataset=marshalled_dataset;
    183 }
    184 /*}}}*/
    185 #endif
    18682/*FUNCTION PetscVecExternalResult::ObjectEnum{{{1*/
    18783int PetscVecExternalResult::ObjectEnum(void){
     
    244140}
    245141/*}}}*/
    246 /*FUNCTION PetscVecExternalResult::SetMatlabField{{{1*/
    247 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    248 void  PetscVecExternalResult::SetMatlabField(mxArray* dataref){
    249 
    250         mxArray* pfield=NULL;
    251         char* name=NULL;
    252         double* doublevec=NULL;
    253         int M;
    254        
    255         VecToMPISerial(&doublevec,value);
    256         VecGetSize(value,&M);
    257         this->GetResultName(&name);
    258        
    259         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    260         mxSetM(pfield,M);
    261         mxSetN(pfield,1);
    262         mxSetPr(pfield,doublevec);
    263        
    264         mxSetField( dataref, this->step-1, name, pfield);
    265         mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time));
    266         mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step));
    267 
    268 }
    269 #endif
    270 /*}}}*/
    271142/*FUNCTION PetscVecExternalResult::GetStep{{{1*/
    272143int PetscVecExternalResult::GetStep(void){
  • issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.h

    r11995 r12330  
    1515#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1616#endif
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    20 #endif
    21 
    2217
    2318#include "./ExternalResult.h"
     
    4843                int   Id();
    4944                int   MyRank();
    50                 #ifdef _SERIAL_
    51                 void  Marshall(char** pmarshalled_dataset);
    52                 int   MarshallSize();
    53                 void  Demarshall(char** pmarshalled_dataset);
    54                 #endif
    5545                int   ObjectEnum();
    5646                Object* copy();
     
    6050                void  WriteData(FILE* fid,bool io_gather);
    6151                void  GetResultName(char**);
    62                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    63                 void  SetMatlabField(mxArray* dataref);
    64                 #endif
    6552                int   GetStep(void);
    6653                /*}}}*/
  • issm/trunk/src/c/objects/ExternalResults/StringExternalResult.cpp

    r11995 r12330  
    7171}
    7272/*}}}*/
    73 #ifdef _SERIAL_
    74 /*FUNCTION StringExternalResult::Marshall{{{1*/
    75 void  StringExternalResult::Marshall(char** pmarshalled_dataset){
    76 
    77         char* marshalled_dataset=NULL;
    78         int   enum_value=0;
    79         int   stringsize;
    80 
    81         /*recover marshalled_dataset: */
    82         marshalled_dataset=*pmarshalled_dataset;
    83 
    84         /*get enum value of StringExternalResult: */
    85         enum_value=StringExternalResultEnum;
    86        
    87         /*marshall enum: */
    88         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    89 
    90         /*marshall data: */
    91         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    92         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    93         stringsize=strlen(this->value)+1;
    94        
    95         memcpy(marshalled_dataset,&stringsize,sizeof(stringsize));marshalled_dataset+=sizeof(stringsize);
    96         memcpy(marshalled_dataset,this->value,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);
    97         memcpy(marshalled_dataset,&step,sizeof(step));marshalled_dataset+=sizeof(step);
    98         memcpy(marshalled_dataset,&time,sizeof(time));marshalled_dataset+=sizeof(time);
    99 
    100         *pmarshalled_dataset=marshalled_dataset;
    101 }
    102 /*}}}*/
    103 /*FUNCTION StringExternalResult::MarshallSize{{{1*/
    104 int   StringExternalResult::MarshallSize(){
    105 
    106         int stringsize;
    107         stringsize=strlen(this->value)+1;
    108        
    109         return sizeof(int)+
    110                 +stringsize*sizeof(char)
    111                 +sizeof(id)
    112                 +sizeof(enum_type)
    113                 +sizeof(step)
    114                 +sizeof(time)
    115                 +sizeof(int); //sizeof(int) for enum value
    116 }
    117 /*}}}*/
    118 /*FUNCTION StringExternalResult::Demarshall{{{1*/
    119 void  StringExternalResult::Demarshall(char** pmarshalled_dataset){
    120 
    121         char* marshalled_dataset=NULL;
    122         int   i;
    123         int   stringsize;
    124 
    125         /*recover marshalled_dataset: */
    126         marshalled_dataset=*pmarshalled_dataset;
    127 
    128         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    129          *object data (thanks to DataSet::Demarshall):*/
    130         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    131         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    132 
    133         memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    134        
    135         this->value=(char*)xmalloc(stringsize*sizeof(char));
    136         memcpy(value,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);
    137         memcpy(&step,marshalled_dataset,sizeof(step));marshalled_dataset+=sizeof(step);
    138         memcpy(&time,marshalled_dataset,sizeof(time));marshalled_dataset+=sizeof(time);
    139 
    140         /*return: */
    141         *pmarshalled_dataset=marshalled_dataset;
    142         return;
    143 }
    144 /*}}}*/
    145 #endif
    14673/*FUNCTION StringExternalResult::ObjectEnum{{{1*/
    14774int StringExternalResult::ObjectEnum(void){
     
    197124}
    198125/*}}}*/
    199 /*FUNCTION StringExternalResult::SetMatlabField{{{1*/
    200 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    201 void  StringExternalResult::SetMatlabField(mxArray* dataref){
    202        
    203         char* name=NULL;
    204 
    205         this->GetResultName(&name);
    206 
    207         mxSetField( dataref, this->step-1, name, mxCreateString(value));
    208         mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time));
    209         mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step));
    210 
    211 }
    212 #endif
    213 /*}}}*/
    214126/*FUNCTION StringExternalResult::GetStep{{{1*/
    215127int StringExternalResult::GetStep(void){
  • issm/trunk/src/c/objects/ExternalResults/StringExternalResult.h

    r11995 r12330  
    1515#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1616#endif
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    20 #endif
    21 
    2217
    2318#include "./ExternalResult.h"
     
    4843                int   Id();
    4944                int   MyRank();
    50                 #ifdef _SERIAL_
    51                 void  Marshall(char** pmarshalled_dataset);
    52                 int   MarshallSize();
    53                 void  Demarshall(char** pmarshalled_dataset);
    54                 #endif
    5545                int   ObjectEnum();
    5646                Object* copy();
     
    6050                void  WriteData(FILE* fid,bool io_gather);
    6151                void  GetResultName(char**);
    62                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    63                 void  SetMatlabField(mxArray* dataref);
    64                 #endif
    6552                int   GetStep(void);
    6653                /*}}}*/
  • issm/trunk/src/c/objects/FemModel.cpp

    r11995 r12330  
    2222/*FUNCTION FemModel::constructor {{{1*/
    2323FemModel::FemModel(char* inputfilename, char* outputfilename, const int in_solution_type,const int* analyses,const int nummodels){
    24 #ifdef _PARALLEL_
    2524
    2625        /*intermediary*/
     
    7574        /*Add output file name to parameters: */
    7675        this->parameters->AddObject(new StringParam(OutputfilenameEnum,outputfilename));
    77 
    78 #endif
    7976
    8077}
  • issm/trunk/src/c/objects/Hook.cpp

    r9777 r12330  
    118118}
    119119/*}}}*/
    120 #ifdef _SERIAL_
    121 /*FUNCTION Hook::Marshall{{{1*/
    122 void Hook::Marshall(char** pmarshalled_dataset){
    123 
    124         char* marshalled_dataset=NULL;
    125         int   enum_type=0;
    126         int   i;
    127 
    128         /*recover marshalled_dataset: */
    129         marshalled_dataset=*pmarshalled_dataset;
    130 
    131         /*get enum type of Hook: */
    132         enum_type=HookEnum;
    133        
    134         /*marshall enum: */
    135         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    136        
    137         /*marshall Hook data: */
    138         memcpy(marshalled_dataset,&num,sizeof(num));marshalled_dataset+=sizeof(num);
    139         for(i=0;i<num;i++){
    140                 memcpy(marshalled_dataset,&this->ids[i],sizeof(int));marshalled_dataset+=sizeof(int);
    141                 memcpy(marshalled_dataset,&this->offsets[i],sizeof(int));marshalled_dataset+=sizeof(int);
    142         }
    143 
    144         *pmarshalled_dataset=marshalled_dataset;
    145         return;
    146 }
    147 /*}}}*/
    148 /*FUNCTION Hook::MarshallSize{{{1*/
    149 int Hook::MarshallSize(){
    150 
    151         return
    152                 sizeof(num)+
    153                 num*sizeof(int)+
    154                 num*sizeof(int)+
    155                 sizeof(int); //sizeof(int) for enum type
    156 }
    157 /*}}}*/
    158 /*FUNCTION Hook::Demarshall{{{1*/
    159 void Hook::Demarshall(char** pmarshalled_dataset){
    160 
    161         char* marshalled_dataset=NULL;
    162         int   i;
    163         int   enum_type;
    164 
    165         /*recover marshalled_dataset: */
    166         marshalled_dataset=*pmarshalled_dataset;
    167 
    168         /*get enum type of object since Hook is not directly called by DataSet: */
    169         memcpy(&enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    170 
    171         memcpy(&num,marshalled_dataset,sizeof(num));marshalled_dataset+=sizeof(num);
    172        
    173         /*allocate: */
    174         if (num<0){
    175                 _error_("cannot demarshall Hook as num<=0");
    176         }
    177         else if (num==0){
    178                 this->ids=NULL;
    179                 this->offsets=NULL;
    180                 this->objects=NULL;
    181         }
    182         else{
    183 
    184                 this->ids=(int*)xmalloc(num*sizeof(int));
    185                 this->offsets=(int*)xmalloc(num*sizeof(int));
    186 
    187                 /*demarshall allocated ids and offsets: */
    188                 _assert_(num<1000);
    189                 for (i=0;i<num;i++){
    190                         memcpy(&this->ids[i],marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    191                         memcpy(&this->offsets[i],marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    192                 }
    193 
    194                 /*nullify object pointers */
    195                 this->objects=(Object**)xmalloc(num*sizeof(Object*));
    196                 for (i=0;i<num;i++){
    197                         this->objects[i]=NULL;
    198                 }
    199         }
    200 
    201         /*return: */
    202         *pmarshalled_dataset=marshalled_dataset;
    203         return;
    204 }
    205 /*}}}*/
    206 #endif
    207120/*FUNCTION Hook::copy {{{1*/
    208121Object* Hook::copy(void){
  • issm/trunk/src/c/objects/Hook.h

    r9777 r12330  
    3434                void       Echo(void);
    3535                void       DeepEcho(void);
    36                 #ifdef _SERIAL_
    37                 void       Marshall(char** pmarshalled_dataset);
    38                 int        MarshallSize();
    39                 void       Demarshall(char** pmarshalled_dataset);
    40                 #endif
    4136                Object*    copy(void);
    4237                /*}}}*/
  • issm/trunk/src/c/objects/Inputs/BoolInput.cpp

    r11995 r12330  
    5959}
    6060/*}}}*/
    61 #ifdef _SERIAL_
    62 /*FUNCTION BoolInput::Marshall{{{1*/
    63 void  BoolInput::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 BoolInput: */
    72         enum_value=BoolInputEnum;
    73        
    74         /*marshall enum: */
    75         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    76        
    77         /*marshall BoolInput data: */
    78         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    79         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    80 
    81         *pmarshalled_dataset=marshalled_dataset;
    82 }
    83 /*}}}*/
    84 /*FUNCTION BoolInput::MarshallSize{{{1*/
    85 int   BoolInput::MarshallSize(){
    86        
    87         return sizeof(value)+
    88                 +sizeof(enum_type)+
    89                 +sizeof(int); //sizeof(int) for enum value
    90 }
    91 /*}}}*/
    92 /*FUNCTION BoolInput::Demarshall{{{1*/
    93 void  BoolInput::Demarshall(char** pmarshalled_dataset){
    94 
    95         char* marshalled_dataset=NULL;
    96         int   i;
    97 
    98         /*recover marshalled_dataset: */
    99         marshalled_dataset=*pmarshalled_dataset;
    100 
    101         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    102          *object data (thanks to DataSet::Demarshall):*/
    103         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    104         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    105 
    106         /*return: */
    107         *pmarshalled_dataset=marshalled_dataset;
    108         return;
    109 }
    110 /*}}}*/
    111 #endif
    11261/*FUNCTION BoolInput::ObjectEnum{{{1*/
    11362int BoolInput::ObjectEnum(void){
  • issm/trunk/src/c/objects/Inputs/BoolInput.h

    r12299 r12330  
    3131                int   Id();
    3232                int   MyRank();
    33                 #ifdef _SERIAL_
    34                 void  Marshall(char** pmarshalled_dataset);
    35                 int   MarshallSize();
    36                 void  Demarshall(char** pmarshalled_dataset);
    37                 #endif
    3833                int   ObjectEnum();
    3934                Object* copy();
  • issm/trunk/src/c/objects/Inputs/ControlInput.cpp

    r11995 r12330  
    9090}
    9191/*}}}*/
    92 #ifdef _SERIAL_
    93 /*FUNCTION ControlInput::Marshall{{{1*/
    94 void  ControlInput::Marshall(char** pmarshalled_dataset){
    95 
    96         char* marshalled_dataset=NULL;
    97         int   enum_value=0;
    98         int   flag;
    99 
    100         /*recover marshalled_dataset: */
    101         marshalled_dataset=*pmarshalled_dataset;
    102 
    103         /*get enum value of ControlInput: */
    104         enum_value=ControlInputEnum;
    105        
    106         /*marshall enum: */
    107         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    108        
    109         /*marshall enum_type: */
    110         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    111         memcpy(marshalled_dataset,&control_id,sizeof(control_id));marshalled_dataset+=sizeof(control_id);
    112 
    113         /*marshal values*/
    114         if(!values){
    115                 flag=0;
    116                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    117         }
    118         else{
    119                 flag=1;
    120                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    121                 this->values->Marshall(&marshalled_dataset);
    122         }
    123 
    124         /*marshal savedvalues*/
    125         if(!savedvalues){
    126                 flag=0;
    127                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    128         }
    129         else{
    130                 flag=1;
    131                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    132                 this->savedvalues->Marshall(&marshalled_dataset);
    133         }
    134 
    135         /*marshal minvalues*/
    136         if(!minvalues){
    137                 flag=0;
    138                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    139         }
    140         else{
    141                 flag=1;
    142                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    143                 this->minvalues->Marshall(&marshalled_dataset);
    144         }
    145 
    146         /*marshal maxvalues*/
    147         if(!maxvalues){
    148                 flag=0;
    149                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    150         }
    151         else{
    152                 flag=1;
    153                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    154                 this->maxvalues->Marshall(&marshalled_dataset);
    155         }
    156 
    157         /*marshal gradient*/
    158         if(!gradient){
    159                 flag=0;
    160                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    161         }
    162         else{
    163                 flag=1;
    164                 memcpy(marshalled_dataset,&flag,sizeof(flag));marshalled_dataset+=sizeof(flag);
    165                 this->gradient->Marshall(&marshalled_dataset);
    166         }
    167 
    168         /*clean up and assign output pointer*/
    169         *pmarshalled_dataset=marshalled_dataset;
    170 }
    171 /*}}}*/
    172 /*FUNCTION ControlInput::MarshallSize{{{1*/
    173 int   ControlInput::MarshallSize(){
    174        
    175         int size=0;
    176 
    177         size=sizeof(enum_type)+
    178           +sizeof(control_id)
    179           +5*sizeof(int) //5 flags
    180           +sizeof(int); //sizeof(int) for enum value
    181 
    182         if(values)     size+=values->MarshallSize();
    183         if(savedvalues)size+=savedvalues->MarshallSize();
    184         if(minvalues)size+=minvalues->MarshallSize();
    185         if(maxvalues)size+=maxvalues->MarshallSize();
    186         if(gradient)   size+=gradient->MarshallSize();
    187         return size;
    188 }
    189 /*}}}*/
    190 /*FUNCTION ControlInput::Demarshall{{{1*/
    191 void  ControlInput::Demarshall(char** pmarshalled_dataset){
    192 
    193         char* marshalled_dataset=NULL;
    194         int   flag,input_enum_type;
    195 
    196         /*recover marshalled_dataset: */
    197         marshalled_dataset=*pmarshalled_dataset;
    198 
    199         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    200          *object data (thanks to DataSet::Demarshall):*/
    201         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    202         memcpy(&control_id,marshalled_dataset,sizeof(control_id));marshalled_dataset+=sizeof(control_id);
    203 
    204         /*Demarshal values*/
    205         memcpy(&flag,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    206         if(flag){
    207                 memcpy(&input_enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    208                 if(input_enum_type==PentaP1InputEnum){
    209                         values=new PentaP1Input();
    210                         values->Demarshall(&marshalled_dataset);
    211                 }
    212                 else if(input_enum_type==TriaP1InputEnum){
    213                         values=new TriaP1Input();
    214                         values->Demarshall(&marshalled_dataset);
    215                 }
    216                 else _error_("Not supported yet");
    217         }
    218         else{
    219                 values=NULL;
    220         }
    221 
    222         /*Demarshal savedvalues*/
    223         memcpy(&flag,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    224         if(flag){
    225                 memcpy(&input_enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    226                 if(input_enum_type==PentaP1InputEnum){
    227                         savedvalues=new PentaP1Input();
    228                         savedvalues->Demarshall(&marshalled_dataset);
    229                 }
    230                 else if(input_enum_type==TriaP1InputEnum){
    231                         savedvalues=new TriaP1Input();
    232                         savedvalues->Demarshall(&marshalled_dataset);
    233                 }
    234                 else _error_("Not supported yet");
    235         }
    236         else{
    237                 savedvalues=NULL;
    238         }
    239 
    240         /*Demarshal minvalues*/
    241         memcpy(&flag,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    242         if(flag){
    243                 memcpy(&input_enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    244                 if(input_enum_type==PentaP1InputEnum){
    245                         minvalues=new PentaP1Input();
    246                         minvalues->Demarshall(&marshalled_dataset);
    247                 }
    248                 else if(input_enum_type==TriaP1InputEnum){
    249                         minvalues=new TriaP1Input();
    250                         minvalues->Demarshall(&marshalled_dataset);
    251                 }
    252                 else _error_("Not supported yet");
    253         }
    254         else{
    255                 minvalues=NULL;
    256         }
    257 
    258         /*Demarshal maxvalues*/
    259         memcpy(&flag,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    260         if(flag){
    261                 memcpy(&input_enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    262                 if(input_enum_type==PentaP1InputEnum){
    263                         maxvalues=new PentaP1Input();
    264                         maxvalues->Demarshall(&marshalled_dataset);
    265                 }
    266                 else if(input_enum_type==TriaP1InputEnum){
    267                         maxvalues=new TriaP1Input();
    268                         maxvalues->Demarshall(&marshalled_dataset);
    269                 }
    270                 else _error_("Not supported yet");
    271         }
    272         else{
    273                 maxvalues=NULL;
    274         }
    275 
    276         /*Demarshal gradient*/
    277         memcpy(&flag,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    278         if(flag){
    279                 memcpy(&input_enum_type,marshalled_dataset,sizeof(int)); marshalled_dataset+=sizeof(int);
    280                 if(input_enum_type==PentaP1InputEnum){
    281                         gradient=new PentaP1Input();
    282                         gradient->Demarshall(&marshalled_dataset);
    283                 }
    284                 else if(input_enum_type==TriaP1InputEnum){
    285                         gradient=new TriaP1Input();
    286                         gradient->Demarshall(&marshalled_dataset);
    287                 }
    288                 else _error_("Not supported yet");
    289         }
    290         else{
    291                 gradient=NULL;
    292         }
    293 
    294         /*return: */
    295         *pmarshalled_dataset=marshalled_dataset;
    296         return;
    297 }
    298 /*}}}*/
    299 #endif
    30092/*FUNCTION ControlInput::ObjectEnum{{{1*/
    30193int ControlInput::ObjectEnum(void){
  • issm/trunk/src/c/objects/Inputs/ControlInput.h

    r12299 r12330  
    3535                int   Id();
    3636                int   MyRank();
    37                 #ifdef _SERIAL_
    38                 void  Marshall(char** pmarshalled_dataset);
    39                 int   MarshallSize();
    40                 void  Demarshall(char** pmarshalled_dataset);
    41                 #endif
    4237                int   ObjectEnum();
    4338                Object* copy();
  • issm/trunk/src/c/objects/Inputs/DatasetInput.cpp

    r10135 r12330  
    6161}
    6262/*}}}*/
    63 #ifdef _SERIAL_
    64 /*FUNCTION DatasetInput::Marshall{{{1*/
    65 void  DatasetInput::Marshall(char** pmarshalled_dataset){
    66 
    67         char* marshalled_dataset=NULL;
    68         char* marshalled_inputs=NULL;
    69         int   marshalled_inputs_size;
    70         int   enum_value=0;
    71 
    72         /*recover marshalled_dataset: */
    73         marshalled_dataset=*pmarshalled_dataset;
    74 
    75         /*get enum value of DatasetInput: */
    76         enum_value=DatasetInputEnum;
    77        
    78         /*marshall enum: */
    79         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    80        
    81         /*marshall enum_type: */
    82         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    83 
    84         /*marshal inputs*/
    85         marshalled_inputs_size=inputs->MarshallSize();
    86         marshalled_inputs=inputs->Marshall();
    87         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    88         marshalled_dataset+=marshalled_inputs_size;
    89 
    90         /*clean up and assign output pointer*/
    91         xfree((void**)&marshalled_inputs);
    92         *pmarshalled_dataset=marshalled_dataset;
    93 }
    94 /*}}}*/
    95 /*FUNCTION DatasetInput::MarshallSize{{{1*/
    96 int   DatasetInput::MarshallSize(){
    97        
    98         int size=0;
    99 
    100         size=sizeof(enum_type)+
    101           +inputs->MarshallSize()
    102           +sizeof(int); //sizeof(int) for enum value
    103 
    104         return size;
    105 }
    106 /*}}}*/
    107 /*FUNCTION DatasetInput::Demarshall{{{1*/
    108 void  DatasetInput::Demarshall(char** pmarshalled_dataset){
    109         char* marshalled_dataset=NULL;
    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         /*Demarshal values*/
    119         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    120 
    121         /*return: */
    122         *pmarshalled_dataset=marshalled_dataset;
    123         return;
    124 }
    125 /*}}}*/
    126 #endif
    12763/*FUNCTION DatasetInput::ObjectEnum{{{1*/
    12864int DatasetInput::ObjectEnum(void){
  • issm/trunk/src/c/objects/Inputs/DatasetInput.h

    r12299 r12330  
    3131                int   Id();
    3232                int   MyRank();
    33                 #ifdef _SERIAL_
    34                 void  Marshall(char** pmarshalled_dataset);
    35                 int   MarshallSize();
    36                 void  Demarshall(char** pmarshalled_dataset);
    37                 #endif
    3833                int   ObjectEnum();
    3934                Object* copy();
  • issm/trunk/src/c/objects/Inputs/DoubleInput.cpp

    r11995 r12330  
    5959}
    6060/*}}}*/
    61 #ifdef _SERIAL_
    62 /*FUNCTION DoubleInput::Marshall{{{1*/
    63 void  DoubleInput::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 DoubleInput: */
    72         enum_value=DoubleInputEnum;
    73        
    74         /*marshall enum: */
    75         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    76        
    77         /*marshall DoubleInput data: */
    78         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    79         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    80 
    81         *pmarshalled_dataset=marshalled_dataset;
    82 }
    83 /*}}}*/
    84 /*FUNCTION DoubleInput::MarshallSize{{{1*/
    85 int   DoubleInput::MarshallSize(){
    86        
    87         return sizeof(value)+
    88                 +sizeof(enum_type)+
    89                 +sizeof(int); //sizeof(int) for enum value
    90 }
    91 /*}}}*/
    92 /*FUNCTION DoubleInput::Demarshall{{{1*/
    93 void  DoubleInput::Demarshall(char** pmarshalled_dataset){
    94 
    95         char* marshalled_dataset=NULL;
    96         int   i;
    97 
    98         /*recover marshalled_dataset: */
    99         marshalled_dataset=*pmarshalled_dataset;
    100 
    101         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    102          *object data (thanks to DataSet::Demarshall):*/
    103         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    104         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    105 
    106         /*return: */
    107         *pmarshalled_dataset=marshalled_dataset;
    108         return;
    109 }
    110 /*}}}*/
    111 #endif
    11261/*FUNCTION DoubleInput::ObjectEnum{{{1*/
    11362int DoubleInput::ObjectEnum(void){
     
    159108/*FUNCTION DoubleInput::GetInputValue(bool* pvalue) {{{1*/
    160109void DoubleInput::GetInputValue(bool* pvalue){
    161 #ifdef _SERIAL_
    162         *pvalue=(bool)value;
    163 #else
    164110        _error_("Double input of enum %s cannot return a boolean",EnumToStringx(enum_type));
    165 #endif
    166111
    167112}
     
    169114/*FUNCTION DoubleInput::GetInputValue(int* pvalue){{{1*/
    170115void DoubleInput::GetInputValue(int* pvalue){
    171 #ifdef _SERIAL_
    172         *pvalue=(int)value;
    173 #else
    174116        _error_("Double input of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));
    175 #endif
    176117
    177118}
  • issm/trunk/src/c/objects/Inputs/DoubleInput.h

    r12299 r12330  
    3030                int   Id();
    3131                int   MyRank();
    32                 #ifdef _SERIAL_
    33                 void  Marshall(char** pmarshalled_dataset);
    34                 int   MarshallSize();
    35                 void  Demarshall(char** pmarshalled_dataset);
    36                 #endif
    3732                int   ObjectEnum();
    3833                Object* copy();
  • issm/trunk/src/c/objects/Inputs/IntInput.cpp

    r11995 r12330  
    5454}
    5555/*}}}*/
    56 #ifdef _SERIAL_
    57 /*FUNCTION IntInput::Marshall{{{1*/
    58 void  IntInput::Marshall(char** pmarshalled_dataset){
    59 
    60         char* marshalled_dataset=NULL;
    61         int   enum_value=0;
    62 
    63         /*recover marshalled_dataset: */
    64         marshalled_dataset=*pmarshalled_dataset;
    65 
    66         /*get enum value of IntInput: */
    67         enum_value=IntInputEnum;
    68        
    69         /*marshall enum: */
    70         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    71        
    72         /*marshall IntInput data: */
    73         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    74         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    75 
    76         *pmarshalled_dataset=marshalled_dataset;
    77 }
    78 /*}}}*/
    79 /*FUNCTION IntInput::MarshallSize{{{1*/
    80 int   IntInput::MarshallSize(){
    81        
    82         return sizeof(value)+
    83                 +sizeof(enum_type)+
    84                 +sizeof(int); //sizeof(int) for enum value
    85 }
    86 /*}}}*/
    87 /*FUNCTION IntInput::Demarshall{{{1*/
    88 void  IntInput::Demarshall(char** pmarshalled_dataset){
    89 
    90         char* marshalled_dataset=NULL;
    91         int   i;
    92 
    93         /*recover marshalled_dataset: */
    94         marshalled_dataset=*pmarshalled_dataset;
    95 
    96         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    97          *object data (thanks to DataSet::Demarshall):*/
    98         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    99         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    100 
    101         /*return: */
    102         *pmarshalled_dataset=marshalled_dataset;
    103         return;
    104 }
    105 /*}}}*/
    106 #endif
    10756/*FUNCTION IntInput::ObjectEnum{{{1*/
    10857int IntInput::ObjectEnum(void){
  • issm/trunk/src/c/objects/Inputs/IntInput.h

    r12299 r12330  
    3131                int   Id();
    3232                int   MyRank();
    33                 #ifdef _SERIAL_
    34                 void  Marshall(char** pmarshalled_dataset);
    35                 int   MarshallSize();
    36                 void  Demarshall(char** pmarshalled_dataset);
    37                 #endif
    3833                int   ObjectEnum();
    3934                Object* copy();
  • issm/trunk/src/c/objects/Inputs/PentaP1Input.cpp

    r11995 r12330  
    7070}
    7171/*}}}*/
    72 #ifdef _SERIAL_
    73 /*FUNCTION PentaP1Input::Marshall{{{1*/
    74 void  PentaP1Input::Marshall(char** pmarshalled_dataset){
    75 
    76         char* marshalled_dataset=NULL;
    77         int   enum_value=0;
    78 
    79         /*recover marshalled_dataset: */
    80         marshalled_dataset=*pmarshalled_dataset;
    81 
    82         /*get enum value of PentaP1Input: */
    83         enum_value=PentaP1InputEnum;
    84        
    85         /*marshall enum: */
    86         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    87        
    88         /*marshall PentaP1Input data: */
    89         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    90         memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);
    91 
    92         *pmarshalled_dataset=marshalled_dataset;
    93 }
    94 /*}}}*/
    95 /*FUNCTION PentaP1Input::MarshallSize{{{1*/
    96 int   PentaP1Input::MarshallSize(){
    97        
    98         return sizeof(values)+
    99                 +sizeof(enum_type)+
    100                 +sizeof(int); //sizeof(int) for enum value
    101 }
    102 /*}}}*/
    103 /*FUNCTION PentaP1Input::Demarshall{{{1*/
    104 void  PentaP1Input::Demarshall(char** pmarshalled_dataset){
    105 
    106         char* marshalled_dataset=NULL;
    107         int   i;
    108 
    109         /*recover marshalled_dataset: */
    110         marshalled_dataset=*pmarshalled_dataset;
    111 
    112         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    113          *object data (thanks to DataSet::Demarshall):*/
    114         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    115         memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);
    116 
    117         /*return: */
    118         *pmarshalled_dataset=marshalled_dataset;
    119         return;
    120 }
    121 /*}}}*/
    122 #endif
    12372/*FUNCTION PentaP1Input::ObjectEnum{{{1*/
    12473int PentaP1Input::ObjectEnum(void){
  • issm/trunk/src/c/objects/Inputs/PentaP1Input.h

    r12299 r12330  
    3131                int   Id();
    3232                int   MyRank();
    33                 #ifdef _SERIAL_
    34                 void  Marshall(char** pmarshalled_dataset);
    35                 int   MarshallSize();
    36                 void  Demarshall(char** pmarshalled_dataset);
    37                 #endif
    3833                int   ObjectEnum();
    3934                Object* copy();
  • issm/trunk/src/c/objects/Inputs/TransientInput.cpp

    r12299 r12330  
    8585}
    8686/*}}}*/
    87 #ifdef _SERIAL_
    88 /*FUNCTION TransientInput::Marshall{{{*/
    89 void  TransientInput::Marshall(char** pmarshalled_dataset){
    90 
    91         char* marshalled_dataset=NULL;
    92         char* marshalled_inputs=NULL;
    93         int   marshalled_inputs_size;
    94         int   enum_value=0;
    95 
    96         /*recover marshalled_dataset: */
    97         marshalled_dataset=*pmarshalled_dataset;
    98 
    99         /*get enum value of TransientInput: */
    100         enum_value=TransientInputEnum;
    101        
    102         /*marshall enum: */
    103         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    104 
    105         /*marshall TransientInput data: */
    106         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    107         memcpy(marshalled_dataset,&numtimesteps,sizeof(numtimesteps));marshalled_dataset+=sizeof(numtimesteps);
    108         memcpy(marshalled_dataset,timesteps,numtimesteps*sizeof(double));marshalled_dataset+=numtimesteps*sizeof(double);
    109 
    110         /*marshal inputs*/
    111         marshalled_inputs_size=inputs->MarshallSize();
    112         marshalled_inputs=inputs->Marshall();
    113         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    114         marshalled_dataset+=marshalled_inputs_size;
    115 
    116         /*clean up and assign output pointer*/
    117         xfree((void**)&marshalled_inputs);
    118         *pmarshalled_dataset=marshalled_dataset;
    119 
    120 }
    121 /*}}}*
    122 /*FUNCTION TransientInput::MarshallSize{{{*/
    123 int   TransientInput::MarshallSize(){
    124 
    125         return
    126                 +sizeof(enum_type)+
    127                 +sizeof(numtimesteps)+
    128                 +inputs->MarshallSize()
    129                 +numtimesteps*sizeof(double)+
    130                 +sizeof(int); //sizeof(int) for enum value
    131 }
    132 /*}}}*/
    133 /*FUNCTION TransientInput::Demarshall{{{*/
    134 void  TransientInput::Demarshall(char** pmarshalled_dataset){
    135 
    136         char* marshalled_dataset=NULL;
    137 
    138         /*recover marshalled_dataset: */
    139         marshalled_dataset=*pmarshalled_dataset;
    140 
    141         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    142          *object data (thanks to DataSet::Demarshall):*/
    143         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    144         memcpy(&numtimesteps,marshalled_dataset,sizeof(numtimesteps));marshalled_dataset+=sizeof(numtimesteps);
    145 
    146         /*allocate: */
    147         timesteps=(double*)xmalloc(numtimesteps*sizeof(double));
    148         memcpy(timesteps,marshalled_dataset,numtimesteps*sizeof(double));marshalled_dataset+=numtimesteps*sizeof(double);
    149 
    150         /*Demarshal values*/
    151         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    152 
    153         /*return: */
    154         *pmarshalled_dataset=marshalled_dataset;
    155         return;
    156 
    157 }
    158 /*}}}*/
    159 #endif
    16087/*FUNCTION TransientInput::ObjectEnum{{{*/
    16188int TransientInput::ObjectEnum(void){
  • issm/trunk/src/c/objects/Inputs/TransientInput.h

    r12299 r12330  
    3434                int   Id();
    3535                int   MyRank();
    36                 #ifdef _SERIAL_
    37                 void  Marshall(char** pmarshalled_dataset);
    38                 int   MarshallSize();
    39                 void  Demarshall(char** pmarshalled_dataset);
    40                 #endif
    4136                int   ObjectEnum();
    4237                Object* copy();
  • issm/trunk/src/c/objects/Inputs/TriaP1Input.cpp

    r11995 r12330  
    7070}
    7171/*}}}*/
    72 #ifdef _SERIAL_
    73 /*FUNCTION TriaP1Input::Marshall{{{1*/
    74 void  TriaP1Input::Marshall(char** pmarshalled_dataset){
    75 
    76         char* marshalled_dataset=NULL;
    77         int   enum_value=0;
    78 
    79         /*recover marshalled_dataset: */
    80         marshalled_dataset=*pmarshalled_dataset;
    81 
    82         /*get enum value of TriaP1Input: */
    83         enum_value=TriaP1InputEnum;
    84        
    85         /*marshall enum: */
    86         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    87        
    88         /*marshall TriaP1Input data: */
    89         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    90         memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);
    91 
    92         *pmarshalled_dataset=marshalled_dataset;
    93 }
    94 /*}}}*/
    95 /*FUNCTION TriaP1Input::MarshallSize{{{1*/
    96 int   TriaP1Input::MarshallSize(){
    97        
    98         return sizeof(values)+
    99                 +sizeof(enum_type)+
    100                 +sizeof(int); //sizeof(int) for enum value
    101 }
    102 /*}}}*/
    103 /*FUNCTION TriaP1Input::Demarshall{{{1*/
    104 void  TriaP1Input::Demarshall(char** pmarshalled_dataset){
    105 
    106         char* marshalled_dataset=NULL;
    107         int   i;
    108 
    109         /*recover marshalled_dataset: */
    110         marshalled_dataset=*pmarshalled_dataset;
    111 
    112         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    113          *object data (thanks to DataSet::Demarshall):*/
    114         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    115         memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);
    116 
    117         /*return: */
    118         *pmarshalled_dataset=marshalled_dataset;
    119         return;
    120 }
    121 /*}}}*/
    122 #endif
    12372/*FUNCTION TriaP1Input::ObjectEnum{{{1*/
    12473int TriaP1Input::ObjectEnum(void){
  • issm/trunk/src/c/objects/Inputs/TriaP1Input.h

    r12299 r12330  
    3131                int   Id();
    3232                int   MyRank();
    33                 #ifdef _SERIAL_
    34                 void  Marshall(char** pmarshalled_dataset);
    35                 int   MarshallSize();
    36                 void  Demarshall(char** pmarshalled_dataset);
    37                 #endif
    3833                int   ObjectEnum();
    3934                Object* copy();
  • issm/trunk/src/c/objects/IoModel.cpp

    r10390 r12330  
    4545        this->fid=iomodel_handle;
    4646
     47        /*Check that Enums are Synchronized*/
     48        this->CheckEnumSync();
     49
    4750        /*Initialize and read constants:*/
    4851        this->constants=new Parameters();
     
    8992/*}}}*/
    9093
     94/*FUNCTION IoModel::CheckEnumSync{{{1*/
     95void  IoModel::CheckEnumSync(void){
     96
     97        extern int my_rank;
     98        int record_enum = 0;
     99
     100
     101        /*Check that some fields have been allocated*/
     102        _assert_(this->fid || my_rank);
     103
     104
     105        /*Go find in the binary file, the position of the data we want to fetch: */
     106        if(my_rank==0){ //cpu 0
     107
     108                /*First set FILE* position to the beginning of the file: */
     109                fseek(this->fid,0,SEEK_SET);
     110
     111                /*Get first Enum*/
     112                if(fread(&record_enum,sizeof(int),1,this->fid)==0){
     113                        _error_("Marshalled file is empty");
     114                }
     115                else{
     116                        if(record_enum!=MaximumNumberOfEnums){
     117                                printf("\n");
     118                                printf("=========================================================================\n");
     119                                printf(" Enums in marshalled file are not compatible with compiled code          \n");
     120                                printf("                                                                         \n");
     121                                printf("   * If you are running ISSM on a remote cluster:                        \n");
     122                                printf("     make sure that you are using the same version of ISSM on your local \n");
     123                                printf("     machine and remote cluster (you might need to run svn update)       \n");
     124                                printf("   * If you are running ISSM on your local machine:                      \n");
     125                                printf("     make sure that all the code is compiled (modules and executables)   \n");
     126                                printf("   * If you are a developer and just added a new Enum:                   \n");
     127                                printf("     you might need to run ./Synchronize.sh in src/c/EnumDefinitions     \n");
     128                                printf("     and recompile                                                       \n");
     129                                printf("=========================================================================\n");
     130                                printf("\n");
     131                                _error_("Enums not consistent (See error message above)");
     132                        }
     133                }
     134        }
     135}
     136/*}}}*/
    91137/*FUNCTION IoModel::Constant(bool* poutput,int constant_enum){{{1*/
    92138void IoModel::Constant(bool* poutput,int constant_enum){
     
    198244                                /*Ok, we have reached the end of the file. break: */
    199245                                record_code=0; //0 means bailout
     246                                #ifdef _HAVE_MPI_
    200247                                MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);  /*tell others cpus we are bailing: */
     248                                #endif
    201249                                break;
    202250                        }
     
    207255                                fread(&record_code,sizeof(int),1,this->fid);
    208256                                       
     257                                #ifdef _HAVE_MPI_
    209258                                /*Tell other cpus what we are doing: */
    210259                                MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);  /*tell other cpus what we are going to do: */
     
    213262                                MPI_Bcast(&record_enum,1,MPI_INT,0,MPI_COMM_WORLD); 
    214263                                MPI_Bcast(&record_length,1,MPI_INT,0,MPI_COMM_WORLD); 
     264                                #endif
    215265                               
    216 
    217266                                switch(record_code){
    218267                                        case 1:
    219268                                                /*Read the boolean and broadcast it to other cpus:*/
    220269                                                if(fread(&booleanint,sizeof(int),1,this->fid)!=1) _error_(" could not read boolean ");
     270                                                #ifdef _HAVE_MPI_
    221271                                                MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     272                                                #endif
    222273
    223274                                                /*create BoolParam: */
     
    228279                                                /*Read the integer and broadcast it to other cpus:*/
    229280                                                if(fread(&integer,sizeof(int),1,this->fid)!=1) _error_(" could not read integer ");
     281                                                #ifdef _HAVE_MPI_
    230282                                                MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     283                                                #endif
    231284
    232285                                                /*create IntParam: */
     
    237290                                                /*Read the scalar and broadcast it to other cpus:*/
    238291                                                if(fread(&scalar,sizeof(double),1,this->fid)!=1) _error_(" could not read scalar ");
     292                                                #ifdef _HAVE_MPI_
    239293                                                MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     294                                                #endif
    240295
    241296                                                /*create DoubleParam: */
     
    246301                                                /*We have to read a string from disk. First read the dimensions of the string, then the string: */
    247302                                                if(fread(&string_size,sizeof(int),1,this->fid)!=1) _error_(" could not read length of string ");
     303                                                #ifdef _HAVE_MPI_
    248304                                                MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     305                                                #endif
    249306
    250307                                                if(string_size){
     
    254311                                                        /*Read string, then broadcast: */
    255312                                                        if(fread(string,string_size*sizeof(char),1,this->fid)!=1)_error_("  could not read string ");
     313                                                        #ifdef _HAVE_MPI_
    256314                                                        MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     315                                                        #endif
    257316                                                }
    258317                                                else{
     
    308367                }
    309368        } //}}}
     369        #ifdef _HAVE_MPI_
    310370        else{ //cpu ~0 {{{2
    311371                for(;;){ //wait on cpu 0
     
    377437                }
    378438        } //}}}
     439        #endif
    379440}
    380441/*}}}*/
     
    399460                if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_(" could not read boolean ");
    400461        }
     462        #ifdef _HAVE_MPI_
    401463        MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     464        #endif
    402465
    403466        /*cast to bool: */
     
    428491        }
    429492
     493        #ifdef _HAVE_MPI_
    430494        MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     495        #endif
    431496
    432497        /*Assign output pointers: */
     
    456521                if(fread(&scalar,sizeof(double),1,fid)!=1)_error_(" could not read scalar ");
    457522        }
     523        #ifdef _HAVE_MPI_
    458524        MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     525        #endif
    459526
    460527        /*Assign output pointers: */
     
    487554        }
    488555
     556        #ifdef _HAVE_MPI_
    489557        MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     558        #endif
    490559
    491560        /*Now allocate string: */
     
    498567                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
    499568                }
     569                #ifdef _HAVE_MPI_
    500570                MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     571                #endif
    501572        }
    502573        else{
     
    538609        }
    539610
     611        #ifdef _HAVE_MPI_
    540612        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     613        #endif
    541614
    542615        if(my_rank==0){ 
    543616                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    544617        }
    545         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     618        #ifdef _HAVE_MPI_
     619        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     620        #endif
    546621
    547622        /*Now allocate matrix: */
     
    554629                }
    555630               
     631                #ifdef _HAVE_MPI_
    556632                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     633                #endif
    557634        }
    558635
     
    602679                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    603680        }
     681        #ifdef _HAVE_MPI_
    604682        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     683        #endif
    605684
    606685        if(my_rank==0){ 
    607686                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    608687        }
     688        #ifdef _HAVE_MPI_
    609689        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     690        #endif
    610691
    611692        /*Now allocate matrix: */
     
    617698                        if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
    618699                }
     700                #ifdef _HAVE_MPI_
    619701                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     702                #endif
    620703        }
    621704
     
    652735                if(fread(&numstrings,sizeof(int),1,fid)!=1) _error_(" could not read length of string array");
    653736        }
     737        #ifdef _HAVE_MPI_
    654738        MPI_Bcast(&numstrings,1,MPI_INT,0,MPI_COMM_WORLD);
     739        #endif
    655740
    656741        /*Now allocate string array: */
     
    665750                                if(fread(&string_size,sizeof(int),1,fid)!=1) _error_(" could not read length of string ");
    666751                        }
     752                        #ifdef _HAVE_MPI_
    667753                        MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     754                        #endif
    668755                        if(string_size){
    669756                                string=(char*)xmalloc((string_size+1)*sizeof(char));
     
    674761                                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
    675762                                }
     763                                #ifdef _HAVE_MPI_
    676764                                MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     765                                #endif
    677766                        }
    678767                        else{
     
    717806                if(fread(&numrecords,sizeof(int),1,fid)!=1) _error_("could not read number of records in matrix array ");
    718807        }
     808        #ifdef _HAVE_MPI_
    719809        MPI_Bcast(&numrecords,1,MPI_INT,0,MPI_COMM_WORLD);
     810        #endif
    720811
    721812        if(numrecords){
     
    738829                                if(fread(&M,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of rows in ",i,"th matrix of matrix array");
    739830                        }
     831                        #ifdef _HAVE_MPI_
    740832                        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     833                        #endif
    741834
    742835                        if(my_rank==0){ 
    743836                                if(fread(&N,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of columns in ",i,"th matrix of matrix array");
    744837                        }
     838                        #ifdef _HAVE_MPI_
    745839                        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     840                        #endif
    746841
    747842                        /*Now allocate matrix: */
     
    754849                                }
    755850
     851                                #ifdef _HAVE_MPI_
    756852                                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     853                                #endif
    757854                        }
    758855
     
    10471144                }
    10481145        }
     1146        #ifdef _HAVE_MPI_
    10491147        MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD);
    10501148        if(!found)_error_("%s %s ","could not find data with name",EnumToStringx(data_enum));
     1149        #endif
    10511150
    10521151        /*Broadcast code and vector type: */
     1152        #ifdef _HAVE_MPI_
    10531153        MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);
    10541154        MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
    10551155        if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
     1156        #endif
    10561157
    10571158        /*Assign output pointers:*/
  • issm/trunk/src/c/objects/IoModel.h

    r9476 r12330  
    1919        private:
    2020                FILE        *fid;         //pointer to input file
    21                 double     **data;        //this dataset holds temporary data, memory intensive.
    22                 Parameters  *constants;   //this dataset holds all double, int, bool and char *parameters read in from the input file.*
     21                IssmDouble     **data;        //this dataset holds temporary data, memory intensive.
     22                Parameters  *constants;   //this dataset holds all IssmDouble, int, bool and char *parameters read in from the input file.*
    2323
    2424        public:
     
    4141
    4242                /*Input/Output*/
    43                 void        Constant(bool   *poutput,int constant_enum);
    44                 void        Constant(int    *poutput,int constant_enum);
    45                 void        Constant(double *poutput,int constant_enum);
    46                 void        Constant(char  **poutput,int constant_enum);
    47                 Param      *CopyConstantObject(int constant_enum);
    48                 double     *Data(int dataenum);
    49                 void        DeleteData(int num,...);
    50                 void        FetchConstants(void);
    51                 void        FetchData(bool*     pboolean,int data_enum);
    52                 void        FetchData(int*      pinteger,int data_enum);
    53                 void        FetchData(double*   pscalar,int data_enum);
    54                 void        FetchData(char**    pstring,int data_enum);
    55                 void        FetchData(int** pmatrix,int* pM,int* pN,int data_enum);
    56                 void        FetchData(double**  pscalarmatrix,int* pM,int* pN,int data_enum);
    57                 void        FetchData(char***   pstringarray,int* pnumstrings,int data_enum);
    58                 void        FetchData(double*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
    59                 void        FetchData(int num,...);
    60                 void        FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum=NoneEnum,double default_value=0);
    61                 FILE*       SetFilePointerToData(int* pcode,int* pvector_type, int data_enum);
     43                void    CheckEnumSync(void);
     44                void    Constant(bool   *poutput,int constant_enum);
     45                void    Constant(int    *poutput,int constant_enum);
     46                void    Constant(IssmDouble *poutput,int constant_enum);
     47                void    Constant(char  **poutput,int constant_enum);
     48                Param  *CopyConstantObject(int constant_enum);
     49                IssmDouble *Data(int dataenum);
     50                void    DeleteData(int num,...);
     51                void    FetchConstants(void);
     52                void    FetchData(bool*     pboolean,int data_enum);
     53                void    FetchData(int*      pinteger,int data_enum);
     54                void    FetchData(IssmDouble*   pscalar,int data_enum);
     55                void    FetchData(char**    pstring,int data_enum);
     56                void    FetchData(int** pmatrix,int* pM,int* pN,int data_enum);
     57                void    FetchData(IssmDouble**  pscalarmatrix,int* pM,int* pN,int data_enum);
     58                void    FetchData(char***   pstringarray,int* pnumstrings,int data_enum);
     59                void    FetchData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
     60                void    FetchData(int num,...);
     61                void    FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum=NoneEnum,IssmDouble default_value=0);
     62                FILE*   SetFilePointerToData(int* pcode,int* pvector_type, int data_enum);
    6263};
    6364
  • issm/trunk/src/c/objects/Loads/Icefront.cpp

    r11995 r12330  
    163163}
    164164/*}}}*/
    165 #ifdef _SERIAL_
    166 /*FUNCTION Icefront::Marshall {{{1*/
    167 void  Icefront::Marshall(char** pmarshalled_dataset){
    168 
    169         char* marshalled_dataset=NULL;
    170         int   enum_type=0;
    171         char* marshalled_inputs=NULL;
    172         int   marshalled_inputs_size;
    173 
    174         /*recover marshalled_dataset: */
    175         marshalled_dataset=*pmarshalled_dataset;
    176 
    177         /*get enum type of Icefront: */
    178         enum_type=IcefrontEnum;
    179 
    180         /*marshall enum: */
    181         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    182 
    183         /*marshall Icefront data: */
    184         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    185         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    186 
    187         /*Marshall hooks: */
    188         hnodes->Marshall(&marshalled_dataset);
    189         helement->Marshall(&marshalled_dataset);
    190         hmatpar->Marshall(&marshalled_dataset);
    191 
    192         /*Marshall inputs: */
    193         marshalled_inputs_size=inputs->MarshallSize();
    194         marshalled_inputs=inputs->Marshall();
    195         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    196         marshalled_dataset+=marshalled_inputs_size;
    197 
    198         /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
    199 
    200         xfree((void**)&marshalled_inputs);
    201 
    202         *pmarshalled_dataset=marshalled_dataset;
    203 }
    204 /*}}}*/
    205 /*FUNCTION Icefront::MarshallSize {{{1*/
    206 int   Icefront::MarshallSize(){
    207        
    208         return sizeof(id)
    209                 +sizeof(analysis_type)
    210                 +hnodes->MarshallSize()
    211                 +helement->MarshallSize()
    212                 +hmatpar->MarshallSize()
    213                 +inputs->MarshallSize()
    214                 +sizeof(int); //sizeof(int) for enum type
    215 }
    216 /*}}}*/
    217 /*FUNCTION Icefront::Demarshall {{{1*/
    218 void  Icefront::Demarshall(char** pmarshalled_dataset){
    219 
    220         char* marshalled_dataset=NULL;
    221         int   i;
    222 
    223         /*recover marshalled_dataset: */
    224         marshalled_dataset=*pmarshalled_dataset;
    225 
    226         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    227          *object data (thanks to DataSet::Demarshall):*/
    228         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    229         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    230 
    231         /*demarshall hooks: */
    232         hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset);
    233         helement=new Hook(); helement->Demarshall(&marshalled_dataset);
    234         hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset);
    235        
    236         /*pointers are garbabe, until configuration is carried out: */
    237         nodes=NULL;
    238         element=NULL;
    239         matpar=NULL;
    240 
    241         /*demarshall inputs: */
    242         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    243 
    244         /*parameters: may not exist even yet, so let Configure handle it: */
    245         this->parameters=NULL;
    246 
    247         /*return: */
    248         *pmarshalled_dataset=marshalled_dataset;
    249         return;
    250 }
    251 /*}}}*/
    252 #endif
    253165/*FUNCTION Icefront::ObjectEnum{{{1*/
    254166int Icefront::ObjectEnum(void){
  • issm/trunk/src/c/objects/Loads/Icefront.h

    r11995 r12330  
    4949                int   Id();
    5050                int   MyRank();
    51                 #ifdef _SERIAL_
    52                 void  Marshall(char** pmarshalled_dataset);
    53                 int   MarshallSize();
    54                 void  Demarshall(char** pmarshalled_dataset);
    55                 #endif
    5651                int   ObjectEnum();
    5752                Object* copy();
  • issm/trunk/src/c/objects/Loads/Numericalflux.cpp

    r11995 r12330  
    189189}
    190190/*}}}*/
    191 #ifdef _SERIAL_
    192 /*FUNCTION Numericalflux::Marshall {{{1*/
    193 void  Numericalflux::Marshall(char** pmarshalled_dataset){
    194 
    195         char* marshalled_dataset=NULL;
    196         int   enum_type=0;
    197         char* marshalled_inputs=NULL;
    198         int   marshalled_inputs_size;
    199 
    200         /*recover marshalled_dataset: */
    201         marshalled_dataset=*pmarshalled_dataset;
    202 
    203         /*get enum type of Numericalflux: */
    204         enum_type=NumericalfluxEnum;
    205 
    206         /*marshall enum: */
    207         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    208 
    209         /*marshall Numericalflux data: */
    210         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    211         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    212 
    213         /*Marshall hooks: */
    214         hnodes->Marshall(&marshalled_dataset);
    215         helement->Marshall(&marshalled_dataset);
    216 
    217         /*Marshall inputs: */
    218         marshalled_inputs_size=inputs->MarshallSize();
    219         marshalled_inputs=inputs->Marshall();
    220         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    221         marshalled_dataset+=marshalled_inputs_size;
    222 
    223         /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
    224 
    225         xfree((void**)&marshalled_inputs);
    226 
    227         *pmarshalled_dataset=marshalled_dataset;
    228         return;
    229 }
    230 /*}}}*/
    231 /*FUNCTION Numericalflux::MarshallSize{{{1*/
    232 int   Numericalflux::MarshallSize(){
    233 
    234         return sizeof(id)
    235                 +sizeof(analysis_type)
    236                 +hnodes->MarshallSize()
    237                 +helement->MarshallSize()
    238                 +inputs->MarshallSize()
    239                 +sizeof(int); //sizeof(int) for enum type
    240 }
    241 /*}}}*/
    242 /*FUNCTION Numericalflux::Demarshall {{{1*/
    243 void  Numericalflux::Demarshall(char** pmarshalled_dataset){
    244 
    245         char* marshalled_dataset=NULL;
    246         int   i;
    247 
    248         /*recover marshalled_dataset: */
    249         marshalled_dataset=*pmarshalled_dataset;
    250 
    251         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    252          *object data (thanks to DataSet::Demarshall):*/
    253         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    254         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    255 
    256         /*demarshall hooks: */
    257         hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset);
    258         helement=new Hook(); helement->Demarshall(&marshalled_dataset);
    259        
    260         /*demarshall inputs: */
    261         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    262 
    263         /*parameters: may not exist even yet, so let Configure handle it: */
    264         this->parameters=NULL;
    265         this->element=NULL;
    266         this->nodes=NULL;
    267 
    268         /*return: */
    269         *pmarshalled_dataset=marshalled_dataset;
    270         return;
    271 }
    272 /*}}}*/
    273 #endif
    274191/*FUNCTION Numericalflux::ObjectEnum{{{1*/
    275192int Numericalflux::ObjectEnum(void){
  • issm/trunk/src/c/objects/Loads/Numericalflux.h

    r11995 r12330  
    4545                int   Id();
    4646                int   MyRank();
    47                 #ifdef _SERIAL_
    48                 void  Marshall(char** pmarshalled_dataset);
    49                 int   MarshallSize();
    50                 void  Demarshall(char** pmarshalled_dataset);
    51                 #endif
    5247                int   ObjectEnum();
    5348                Object* copy();
  • issm/trunk/src/c/objects/Loads/Pengrid.cpp

    r11995 r12330  
    132132}
    133133/*}}}1*/
    134 #ifdef _SERIAL_
    135 /*FUNCTION Pengrid::Marshall {{{1*/
    136 void  Pengrid::Marshall(char** pmarshalled_dataset){
    137 
    138         char* marshalled_dataset=NULL;
    139         int   enum_type=0;
    140         char* marshalled_inputs=NULL;
    141         int   marshalled_inputs_size;
    142 
    143         /*recover marshalled_dataset: */
    144         marshalled_dataset=*pmarshalled_dataset;
    145 
    146         /*get enum type of Tria: */
    147         enum_type=PengridEnum;
    148 
    149         /*marshall enum: */
    150         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    151 
    152         /*marshall Tria data: */
    153         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    154         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    155         memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active);
    156         memcpy(marshalled_dataset,&zigzag_counter,sizeof(zigzag_counter));marshalled_dataset+=sizeof(zigzag_counter);
    157 
    158         /*Marshall hooks: */
    159         hnode->Marshall(&marshalled_dataset);
    160         helement->Marshall(&marshalled_dataset);
    161         hmatpar->Marshall(&marshalled_dataset);
    162 
    163         /*Marshall inputs: */
    164         marshalled_inputs_size=inputs->MarshallSize();
    165         marshalled_inputs=inputs->Marshall();
    166         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    167         marshalled_dataset+=marshalled_inputs_size;
    168 
    169         /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
    170 
    171         xfree((void**)&marshalled_inputs);
    172 
    173         *pmarshalled_dataset=marshalled_dataset;
    174         return;
    175 }
    176 /*}}}*/
    177 /*FUNCTION Pengrid::MarshallSize {{{1*/
    178 int   Pengrid::MarshallSize(){
    179        
    180         return sizeof(id)
    181                 +sizeof(analysis_type)
    182                 +sizeof(active)
    183                 +sizeof(zigzag_counter)
    184                 +hnode->MarshallSize()
    185                 +helement->MarshallSize()
    186                 +hmatpar->MarshallSize()
    187                 +inputs->MarshallSize()
    188                 +sizeof(int); //sizeof(int) for enum type
    189 }
    190 /*}}}*/
    191 /*FUNCTION Pengrid::Demarshall {{{1*/
    192 void  Pengrid::Demarshall(char** pmarshalled_dataset){
    193 
    194         char* marshalled_dataset=NULL;
    195         int   i;
    196 
    197         /*recover marshalled_dataset: */
    198         marshalled_dataset=*pmarshalled_dataset;
    199 
    200         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    201          *object data (thanks to DataSet::Demarshall):*/
    202 
    203         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    204         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    205         memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active);
    206         memcpy(&zigzag_counter,marshalled_dataset,sizeof(zigzag_counter));marshalled_dataset+=sizeof(zigzag_counter);
    207 
    208         /*demarshall hooks: */
    209         hnode=new Hook(); hnode->Demarshall(&marshalled_dataset);
    210         helement=new Hook(); helement->Demarshall(&marshalled_dataset);
    211         hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset);
    212        
    213         /*demarshall inputs: */
    214         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    215 
    216         /*parameters: may not exist even yet, so let Configure handle it: */
    217         this->parameters=NULL;
    218         this->node=NULL;
    219         this->element=NULL;
    220         this->matpar=NULL;
    221 
    222         /*return: */
    223         *pmarshalled_dataset=marshalled_dataset;
    224         return;
    225 }
    226 /*}}}*/
    227 #endif
    228134/*FUNCTION Pengrid::ObjectEnum{{{1*/
    229135int Pengrid::ObjectEnum(void){
  • issm/trunk/src/c/objects/Loads/Pengrid.h

    r11995 r12330  
    5050                int   Id();
    5151                int   MyRank();
    52                 #ifdef _SERIAL_
    53                 void  Marshall(char** pmarshalled_dataset);
    54                 int   MarshallSize();
    55                 void  Demarshall(char** pmarshalled_dataset);
    56                 #endif
    5752                int   ObjectEnum();
    5853                Object* copy();
  • issm/trunk/src/c/objects/Loads/Penpair.cpp

    r11995 r12330  
    8585}
    8686/*}}}1*/
    87 #ifdef _SERIAL_
    88 /*FUNCTION Penpair::Marshall {{{1*/
    89 void  Penpair::Marshall(char** pmarshalled_dataset){
    90 
    91         char* marshalled_dataset=NULL;
    92         int   enum_type=0;
    93 
    94         /*recover marshalled_dataset: */
    95         marshalled_dataset=*pmarshalled_dataset;
    96 
    97         /*get enum type of Penpair: */
    98         enum_type=PenpairEnum;
    99        
    100         /*marshall enum: */
    101         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    102        
    103         /*marshall Penpair data: */
    104         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    105         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    106 
    107         /*Marshall hooks*/
    108         hnodes->Marshall(&marshalled_dataset);
    109 
    110         *pmarshalled_dataset=marshalled_dataset;
    111         return;
    112 }
    113 /*}}}1*/
    114 /*FUNCTION Penpair::MarshallSize {{{1*/
    115 int   Penpair::MarshallSize(){
    116 
    117         return sizeof(id)+
    118                 +sizeof(analysis_type)
    119                 +hnodes->MarshallSize()
    120                 +sizeof(int); //sizeof(int) for enum type
    121 }
    122 /*}}}1*/
    123 /*FUNCTION Penpair::Demarshall {{{1*/
    124 void  Penpair::Demarshall(char** pmarshalled_dataset){
    125 
    126         int i;
    127         char* marshalled_dataset=NULL;
    128 
    129         /*recover marshalled_dataset: */
    130         marshalled_dataset=*pmarshalled_dataset;
    131 
    132         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    133          *object data (thanks to DataSet::Demarshall):*/
    134         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    135         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    136 
    137         /*demarshall hooks: */
    138         hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset);
    139 
    140         /*pointers are garbabe, until configuration is carried out: */
    141         nodes=NULL;
    142         parameters=NULL;
    143 
    144         /*return: */
    145         *pmarshalled_dataset=marshalled_dataset;
    146         return;
    147 }
    148 /*}}}1*/
    149 #endif
    15087/*FUNCTION Penpair::ObjectEnum{{{1*/
    15188int Penpair::ObjectEnum(void){
  • issm/trunk/src/c/objects/Loads/Penpair.h

    r11995 r12330  
    3737                int   Id();
    3838                int   MyRank();
    39                 #ifdef _SERIAL_
    40                 void  Marshall(char** pmarshalled_dataset);
    41                 int   MarshallSize();
    42                 void  Demarshall(char** pmarshalled_dataset);
    43                 #endif
    4439                int   ObjectEnum();
    4540                Object* copy();
  • issm/trunk/src/c/objects/Loads/Riftfront.cpp

    r11995 r12330  
    192192}
    193193/*}}}1*/
    194 #ifdef _SERIAL_
    195 /*FUNCTION Riftfront::Marshall {{{1*/
    196 void  Riftfront::Marshall(char** pmarshalled_dataset){
    197 
    198         char* marshalled_dataset=NULL;
    199         int   enum_type=0;
    200         char* marshalled_inputs=NULL;
    201         int   marshalled_inputs_size;
    202 
    203         /*recover marshalled_dataset: */
    204         marshalled_dataset=*pmarshalled_dataset;
    205 
    206         /*get enum type of Riftfront: */
    207         enum_type=RiftfrontEnum;
    208 
    209         /*marshall enum: */
    210         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    211 
    212         /*marshall Riftfront data: */
    213         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    214         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    215         memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active);
    216         memcpy(marshalled_dataset,&normal,sizeof(normal));marshalled_dataset+=sizeof(normal);
    217         memcpy(marshalled_dataset,&length,sizeof(length));marshalled_dataset+=sizeof(length);
    218         memcpy(marshalled_dataset,&fraction,sizeof(fraction));marshalled_dataset+=sizeof(fraction);
    219         memcpy(marshalled_dataset,&frozen,sizeof(frozen));marshalled_dataset+=sizeof(frozen);
    220         memcpy(marshalled_dataset,&state,sizeof(state));marshalled_dataset+=sizeof(state);
    221         memcpy(marshalled_dataset,&counter,sizeof(counter));marshalled_dataset+=sizeof(counter);
    222         memcpy(marshalled_dataset,&prestable,sizeof(prestable));marshalled_dataset+=sizeof(prestable);
    223         memcpy(marshalled_dataset,&penalty_lock,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock);
    224         memcpy(marshalled_dataset,&material_converged,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged);
    225 
    226         /*Marshall hooks: */
    227         hnodes->Marshall(&marshalled_dataset);
    228         helements->Marshall(&marshalled_dataset);
    229         hmatpar->Marshall(&marshalled_dataset);
    230 
    231         /*Marshall inputs: */
    232         marshalled_inputs_size=inputs->MarshallSize();
    233         marshalled_inputs=inputs->Marshall();
    234         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    235         marshalled_dataset+=marshalled_inputs_size;
    236 
    237         /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
    238 
    239         xfree((void**)&marshalled_inputs);
    240 
    241         *pmarshalled_dataset=marshalled_dataset;
    242         return;
    243 }
    244 /*}}}*/
    245 /*FUNCTION Riftfront::MarshallSize {{{1*/
    246 int   Riftfront::MarshallSize(){
    247        
    248         return sizeof(id)
    249                 +sizeof(analysis_type)
    250                 +sizeof(active)
    251                 +sizeof(normal)
    252                 +sizeof(length)
    253                 +sizeof(fraction)
    254                 +sizeof(frozen)
    255                 +sizeof(state)
    256                 +sizeof(counter)
    257                 +sizeof(prestable)
    258                 +sizeof(penalty_lock)
    259                 +sizeof(material_converged)
    260                 +hnodes->MarshallSize()
    261                 +helements->MarshallSize()
    262                 +hmatpar->MarshallSize()
    263                 +inputs->MarshallSize()
    264                 +sizeof(int); //sizeof(int) for enum type
    265 }
    266 /*}}}*/
    267 /*FUNCTION Riftfront::Demarshall {{{1*/
    268 void  Riftfront::Demarshall(char** pmarshalled_dataset){
    269 
    270         char* marshalled_dataset=NULL;
    271         int   i;
    272 
    273         /*recover marshalled_dataset: */
    274         marshalled_dataset=*pmarshalled_dataset;
    275 
    276         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    277          *object data (thanks to DataSet::Demarshall):*/
    278 
    279         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    280         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    281         memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active);
    282         memcpy(&normal,marshalled_dataset,sizeof(normal));marshalled_dataset+=sizeof(normal);
    283         memcpy(&length,marshalled_dataset,sizeof(length));marshalled_dataset+=sizeof(length);
    284         memcpy(&fraction,marshalled_dataset,sizeof(fraction));marshalled_dataset+=sizeof(fraction);
    285         memcpy(&frozen,marshalled_dataset,sizeof(frozen));marshalled_dataset+=sizeof(frozen);
    286         memcpy(&state,marshalled_dataset,sizeof(state));marshalled_dataset+=sizeof(state);
    287         memcpy(&counter,marshalled_dataset,sizeof(counter));marshalled_dataset+=sizeof(counter);
    288         memcpy(&prestable,marshalled_dataset,sizeof(prestable));marshalled_dataset+=sizeof(prestable);
    289         memcpy(&penalty_lock,marshalled_dataset,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock);
    290         memcpy(&material_converged,marshalled_dataset,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged);
    291 
    292         /*demarshall hooks: */
    293         hnodes=new Hook();    hnodes->Demarshall(&marshalled_dataset);
    294         helements=new Hook(); helements->Demarshall(&marshalled_dataset);
    295         hmatpar=new Hook();   hmatpar->Demarshall(&marshalled_dataset);
    296 
    297         /*pointers are garbabe, until configuration is carried out: */
    298         nodes=NULL;
    299         elements=NULL;
    300         matpar=NULL;
    301        
    302         /*demarshall inputs: */
    303         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    304 
    305         /*parameters: may not exist even yet, so let Configure handle it: */
    306         this->parameters=NULL;
    307 
    308         /*return: */
    309         *pmarshalled_dataset=marshalled_dataset;
    310 }
    311 /*}}}*/
    312 #endif
    313194/*FUNCTION Riftfront::ObjectEnum{{{1*/
    314195int Riftfront::ObjectEnum(void){
  • issm/trunk/src/c/objects/Loads/Riftfront.h

    r11995 r12330  
    5757                int   Id();
    5858                int   MyRank();
    59                 #ifdef _SERIAL_
    60                 void  Marshall(char** pmarshalled_dataset);
    61                 int   MarshallSize();
    62                 void  Demarshall(char** pmarshalled_dataset);
    63                 #endif
    6459                int   ObjectEnum();
    6560                Object* copy();
  • issm/trunk/src/c/objects/Materials/Matice.cpp

    r11995 r12330  
    8888}
    8989/*}}}*/
    90 #ifdef _SERIAL_
    91 /*FUNCTION Matice::Marshall {{{1*/
    92 void  Matice::Marshall(char** pmarshalled_dataset){
    93 
    94         /*Intermediaries*/
    95         char* marshalled_dataset=NULL;
    96         int   enum_type=0;
    97         char* marshalled_inputs=NULL;
    98         int   marshalled_inputs_size;
    99 
    100         /*recover marshalled_dataset: */
    101         marshalled_dataset=*pmarshalled_dataset;
    102 
    103         /*get enum type of Matice: */
    104         enum_type=MaticeEnum;
    105        
    106         /*marshall enum: */
    107         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    108        
    109         /*marshall Matice data: */
    110         memcpy(marshalled_dataset,&mid,sizeof(mid));marshalled_dataset+=sizeof(mid);
    111 
    112         /*Marshall hooks: */
    113         helement->Marshall(&marshalled_dataset);
    114 
    115         /*Marshall inputs: */
    116         marshalled_inputs_size=inputs->MarshallSize();
    117         marshalled_inputs=inputs->Marshall();
    118         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
    119         marshalled_dataset+=marshalled_inputs_size;
    120 
    121         *pmarshalled_dataset=marshalled_dataset;
    122 
    123         /*clean up and return*/
    124         xfree((void**)&marshalled_inputs);
    125 }
    126 /*}}}*/
    127 /*FUNCTION Matice::MarshallSize{{{1*/
    128 int   Matice::MarshallSize(){
    129 
    130         return sizeof(mid)
    131           +helement->MarshallSize()
    132           +inputs->MarshallSize()
    133           +sizeof(int); //sizeof(int) for enum type
    134 }
    135 /*}}}*/
    136 /*FUNCTION Matice::Demarshall {{{1*/
    137 void  Matice::Demarshall(char** pmarshalled_dataset){
    138 
    139         char* marshalled_dataset=NULL;
    140 
    141         /*recover marshalled_dataset: */
    142         marshalled_dataset=*pmarshalled_dataset;
    143 
    144         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    145          *object data (thanks to DataSet::Demarshall):*/
    146         memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid);
    147 
    148         /*demarshall hooks: */
    149         helement=new Hook(); helement->Demarshall(&marshalled_dataset);
    150 
    151         /*demarshall inputs: */
    152         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    153 
    154         /*return: */
    155         *pmarshalled_dataset=marshalled_dataset;
    156         return;
    157 }
    158 /*}}}*/
    159 #endif
    16090/*FUNCTION Matice::ObjectEnum{{{1*/
    16191int Matice::ObjectEnum(void){
  • issm/trunk/src/c/objects/Materials/Matice.h

    r11995 r12330  
    3535                int   Id();
    3636                int   MyRank();
    37                 #ifdef _SERIAL_
    38                 void  Marshall(char** pmarshalled_dataset);
    39                 int   MarshallSize();
    40                 void  Demarshall(char** pmarshalled_dataset);
    41                 #endif
    4237                int   ObjectEnum();
    4338                Object* copy();
  • issm/trunk/src/c/objects/Materials/Matpar.cpp

    r12301 r12330  
    9090}
    9191/*}}}1*/
    92 #ifdef _SERIAL_
    93 /*FUNCTION Matpar::Marshall {{{1*/
    94 void  Matpar::Marshall(char** pmarshalled_dataset){
    95 
    96         char* marshalled_dataset=NULL;
    97         int   enum_type=0;
    98 
    99         /*recover marshalled_dataset: */
    100         marshalled_dataset=*pmarshalled_dataset;
    101 
    102         /*get enum type of Matpar: */
    103         enum_type=MatparEnum;
    104        
    105         /*marshall enum: */
    106         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    107        
    108         /*marshall Matpar data: */
    109         memcpy(marshalled_dataset,&mid,sizeof(mid));marshalled_dataset+=sizeof(mid);
    110         memcpy(marshalled_dataset,&rho_ice,sizeof(rho_ice));marshalled_dataset+=sizeof(rho_ice);
    111         memcpy(marshalled_dataset,&rho_water,sizeof(rho_water));marshalled_dataset+=sizeof(rho_water);
    112         memcpy(marshalled_dataset,&rho_freshwater,sizeof(rho_freshwater));marshalled_dataset+=sizeof(rho_freshwater);
    113         memcpy(marshalled_dataset,&mu_water,sizeof(mu_water));marshalled_dataset+=sizeof(mu_water);
    114         memcpy(marshalled_dataset,&heatcapacity,sizeof(heatcapacity));marshalled_dataset+=sizeof(heatcapacity);
    115         memcpy(marshalled_dataset,&thermalconductivity,sizeof(thermalconductivity));marshalled_dataset+=sizeof(thermalconductivity);
    116         memcpy(marshalled_dataset,&latentheat,sizeof(latentheat));marshalled_dataset+=sizeof(latentheat);
    117         memcpy(marshalled_dataset,&beta,sizeof(beta));marshalled_dataset+=sizeof(beta);
    118         memcpy(marshalled_dataset,&meltingpoint,sizeof(meltingpoint));marshalled_dataset+=sizeof(meltingpoint);
    119         memcpy(marshalled_dataset,&referencetemperature,sizeof(referencetemperature));marshalled_dataset+=sizeof(referencetemperature);
    120         memcpy(marshalled_dataset,&mixed_layer_capacity,sizeof(mixed_layer_capacity));marshalled_dataset+=sizeof(mixed_layer_capacity);
    121         memcpy(marshalled_dataset,&thermal_exchange_velocity,sizeof(thermal_exchange_velocity));marshalled_dataset+=sizeof(thermal_exchange_velocity);
    122         memcpy(marshalled_dataset,&g,sizeof(g));marshalled_dataset+=sizeof(g);
    123 
    124         *pmarshalled_dataset=marshalled_dataset;
    125         return;
    126 }
    127 /*}}}1*/
    128 /*FUNCTION Matpar::MarshallSize {{{1*/
    129 int   Matpar::MarshallSize(){
    130 
    131         return sizeof(mid)+
    132                 sizeof(rho_ice)+
    133                 sizeof(rho_water)+
    134                 sizeof(rho_freshwater)+
    135                 sizeof(mu_water)+
    136                 sizeof(heatcapacity)+
    137                 sizeof(thermalconductivity)+
    138                 sizeof(latentheat)+
    139                 sizeof(beta)+
    140                 sizeof(meltingpoint)+
    141                 sizeof(referencetemperature)+
    142                 sizeof(mixed_layer_capacity)+
    143                 sizeof(thermal_exchange_velocity)+
    144                 sizeof(g)+
    145                 sizeof(int); //sizeof(int) for enum type
    146 }
    147 /*}}}1*/
    148 /*FUNCTION Matpar::Demarshall {{{1*/
    149 void  Matpar::Demarshall(char** pmarshalled_dataset){
    150 
    151         char* marshalled_dataset=NULL;
    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 
    159         memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid);
    160         memcpy(&rho_ice,marshalled_dataset,sizeof(rho_ice));marshalled_dataset+=sizeof(rho_ice);
    161         memcpy(&rho_water,marshalled_dataset,sizeof(rho_water));marshalled_dataset+=sizeof(rho_water);
    162         memcpy(&rho_freshwater,marshalled_dataset,sizeof(rho_freshwater));marshalled_dataset+=sizeof(rho_freshwater);
    163         memcpy(&mu_water,marshalled_dataset,sizeof(mu_water));marshalled_dataset+=sizeof(mu_water);
    164         memcpy(&heatcapacity,marshalled_dataset,sizeof(heatcapacity));marshalled_dataset+=sizeof(heatcapacity);
    165         memcpy(&thermalconductivity,marshalled_dataset,sizeof(thermalconductivity));marshalled_dataset+=sizeof(thermalconductivity);
    166         memcpy(&latentheat,marshalled_dataset,sizeof(latentheat));marshalled_dataset+=sizeof(latentheat);
    167         memcpy(&beta,marshalled_dataset,sizeof(beta));marshalled_dataset+=sizeof(beta);
    168         memcpy(&meltingpoint,marshalled_dataset,sizeof(meltingpoint));marshalled_dataset+=sizeof(meltingpoint);
    169         memcpy(&referencetemperature,marshalled_dataset,sizeof(referencetemperature));marshalled_dataset+=sizeof(referencetemperature);
    170         memcpy(&mixed_layer_capacity,marshalled_dataset,sizeof(mixed_layer_capacity));marshalled_dataset+=sizeof(mixed_layer_capacity);
    171         memcpy(&thermal_exchange_velocity,marshalled_dataset,sizeof(thermal_exchange_velocity));marshalled_dataset+=sizeof(thermal_exchange_velocity);
    172         memcpy(&g,marshalled_dataset,sizeof(g));marshalled_dataset+=sizeof(g);
    173 
    174         /*return: */
    175         *pmarshalled_dataset=marshalled_dataset;
    176         return;
    177 }
    178 /*}}}1*/
    179 #endif
    18092/*FUNCTION Matpar::ObjectEnum{{{1*/
    18193int Matpar::ObjectEnum(void){
  • issm/trunk/src/c/objects/Materials/Matpar.h

    r12301 r12330  
    4747                int   Id();
    4848                int   MyRank();
    49                 #ifdef _SERIAL_
    50                 void  Marshall(char** pmarshalled_dataset);
    51                 int   MarshallSize();
    52                 void  Demarshall(char** pmarshalled_dataset);
    53                 #endif
    5449                int   ObjectEnum();
    5550                Object* copy();
  • issm/trunk/src/c/objects/Node.cpp

    r11995 r12330  
    193193}
    194194/*}}}*/
    195 #ifdef _SERIAL_
    196 /*FUNCTION Node::Marshall{{{1*/
    197 void  Node::Marshall(char** pmarshalled_dataset){
    198 
    199         char* marshalled_dataset=NULL;
    200         int   enum_type=0;
    201         char* marshalled_inputs=NULL;
    202         int   marshalled_inputssize;
    203 
    204         /*recover marshalled_dataset: */
    205         marshalled_dataset=*pmarshalled_dataset;
    206 
    207         /*get enum type of Node: */
    208         enum_type=NodeEnum;
    209        
    210         /*marshall enum: */
    211         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    212        
    213         /*marshall Node data: */
    214         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    215         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    216         memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    217         memcpy(marshalled_dataset,&coord_system,9*sizeof(double));marshalled_dataset+=9*sizeof(double); 
    218 
    219         /*marshall objects: */
    220         indexing.Marshall(&marshalled_dataset);
    221         hvertex->Marshall(&marshalled_dataset);
    222 
    223         /*Marshall inputs: */
    224         marshalled_inputssize=inputs->MarshallSize();
    225         marshalled_inputs=inputs->Marshall();
    226         memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputssize*sizeof(char));
    227         marshalled_dataset+=marshalled_inputssize;
    228 
    229         /*Free ressources:*/
    230         xfree((void**)&marshalled_inputs);
    231 
    232         *pmarshalled_dataset=marshalled_dataset;
    233         return;
    234 }
    235 /*}}}*/
    236 /*FUNCTION Node::MarshallSize{{{1*/
    237 int   Node::MarshallSize(){
    238 
    239         return sizeof(id)+
    240                 sizeof(sid)+
    241                 indexing.MarshallSize()+
    242                 hvertex->MarshallSize()+
    243                 inputs->MarshallSize()+
    244                 sizeof(analysis_type)+
    245                 9*sizeof(double)+
    246                 sizeof(int); //sizeof(int) for enum type
    247 }
    248 /*}}}*/
    249 /*FUNCTION Node::Demarshall{{{1*/
    250 void  Node::Demarshall(char** pmarshalled_dataset){
    251 
    252         char* marshalled_dataset=NULL;
    253 
    254         /*recover marshalled_dataset: */
    255         marshalled_dataset=*pmarshalled_dataset;
    256 
    257         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    258          *object data (thanks to DataSet::Demarshall):*/
    259 
    260         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    261         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    262         memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    263         memcpy(&coord_system,marshalled_dataset,9*sizeof(double));marshalled_dataset+=9*sizeof(double);
    264        
    265         /*demarshall objects: */
    266         indexing.Demarshall(&marshalled_dataset);
    267         hvertex=new Hook(); hvertex->Demarshall(&marshalled_dataset);
    268 
    269         /*demarshall inputs: */
    270         inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset);
    271 
    272         /*return: */
    273         *pmarshalled_dataset=marshalled_dataset;
    274         return;
    275 }
    276 /*}}}*/
    277 #endif
    278195/*FUNCTION Node::ObjectEnum{{{1*/
    279196int Node::ObjectEnum(void){
  • issm/trunk/src/c/objects/Node.h

    r11995 r12330  
    3232                Inputs*        inputs; //properties of this node
    3333                int            analysis_type;
    34                 double         coord_system[3][3];
     34                IssmDouble         coord_system[3][3];
    3535
    3636                /*Node constructors, destructors {{{1*/
     
    4444                int   Id();
    4545                int   MyRank();
    46                 #ifdef _SERIAL_
    47                 void  Marshall(char** pmarshalled_dataset);
    48                 int   MarshallSize();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 #endif
    5146                int   ObjectEnum();
    5247                Object* copy(){_error_("Not implemented yet (similar to Elements)");};
     
    5449                /*Update virtual functions definitions: {{{1*/
    5550               
    56                 void  InputUpdateFromVector(double* vector, int name, int type);
     51                void  InputUpdateFromVector(IssmDouble* vector, int name, int type);
    5752                void  InputUpdateFromVector(int* vector, int name, int type);
    5853                void  InputUpdateFromVector(bool* vector, int name, int type);
    59                 void  InputUpdateFromMatrixDakota(double* matrix,int nrows, int ncols, int name, int type);
    60                 void  InputUpdateFromVectorDakota(double* vector, int name, int type);
     54                void  InputUpdateFromMatrixDakota(IssmDouble* matrix,int nrows, int ncols, int name, int type);
     55                void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
    6156                void  InputUpdateFromVectorDakota(int* vector, int name, int type);
    6257                void  InputUpdateFromVectorDakota(bool* vector, int name, int type);
    63                 void  InputUpdateFromConstant(double constant, int name);
     58                void  InputUpdateFromConstant(IssmDouble constant, int name);
    6459                void  InputUpdateFromConstant(int constant, int name);
    6560                void  InputUpdateFromConstant(bool constant, int name);
    66                 void  InputUpdateFromSolution(double* solution){_error_("Not implemented yet!");}
     61                void  InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");}
    6762                void  InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("Not implemented yet!");}
    6863                /*}}}*/
     
    7570                int    GetVertexId(void);
    7671#ifdef _HAVE_DIAGNOSTIC_
    77                 void   GetCoordinateSystem(double* coord_system_out);
     72                void   GetCoordinateSystem(IssmDouble* coord_system_out);
    7873#endif
    7974                void   SetVertexDof(int in_dof);
     
    8277                int    GetNumberOfDofs(int approximation_enum,int setenum);
    8378                int    IsClone();
    84                 void   ApplyConstraint(int dof,double value);
     79                void   ApplyConstraint(int dof,IssmDouble value);
    8580                void   RelaxConstraint(int dof);
    8681                void   DofInSSet(int dof);
     
    9388                int    GetDofList1(void);
    9489                int    GetSidList(void);
    95                 double GetX();
    96                 double GetY();
    97                 double GetZ();
    98                 double GetSigma();
     90                IssmDouble GetX();
     91                IssmDouble GetY();
     92                IssmDouble GetZ();
     93                IssmDouble GetSigma();
    9994                int    IsOnBed();
    10095                int    IsOnSurface();
     
    10297                int    IsFloating();
    10398                int    IsGrounded();
    104                 void   UpdateSpcs(double* ys);
    105                 void   VecMerge(Vector* ug, double* vector_serial,int setenum);
    106                 void   VecReduce(Vector* vector, double* ug_serial,int setnum);
     99                void   UpdateSpcs(IssmDouble* ys);
     100                void   VecMerge(Vector* ug, IssmDouble* vector_serial,int setenum);
     101                void   VecReduce(Vector* vector, IssmDouble* ug_serial,int setnum);
    107102               
    108103                /*}}}*/
  • issm/trunk/src/c/objects/Numerics/ElementVector.cpp

    r11995 r12330  
    166166        double* localvalues=NULL;
    167167
     168        /*In debugging mode, check consistency (no NaN, and values not too big)*/
     169        this->CheckConsistency();
     170
    168171        if(this->fsize){
    169172                /*first, retrieve values that are in the f-set from the g-set values vector: */
     
    200203        }
    201204
     205}
     206/*}}}*/
     207/*FUNCTION ElementVector::CheckConsistency{{{1*/
     208void ElementVector::CheckConsistency(void){
     209        /*Check element matrix values, only in debugging mode*/
     210#ifdef _ISSM_DEBUG_
     211        for (int i=0;i<this->nrows;i++){
     212                if (isnan(this->values[i])) _error_("NaN found in Element Vector");
     213                if (fabs( this->values[i])>1.e+50) _error_("Element Vector values exceeds 1.e+50");
     214        }
     215#endif
    202216}
    203217/*}}}*/
  • issm/trunk/src/c/objects/Numerics/ElementVector.h

    r11995 r12330  
    4343                void InsertIntoGlobal(Vector* pf);
    4444                void Echo(void);
     45                void CheckConsistency(void);
    4546                void Init(ElementVector* pe);
    4647                void SetValue(double scalar);
  • issm/trunk/src/c/objects/Numerics/Matrix.cpp

    r11995 r12330  
    140140}
    141141/*}}}*/
    142 
    143 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    144 /*FUNCTION Matrix::ToMatlabMatrix{{{1*/
    145 mxArray* Matrix::ToMatlabMatrix(void){
    146 
    147         mxArray* dataref=NULL;
    148         #ifdef _HAVE_PETSC_
    149         PetscMatrixToMatlabMatrix(&dataref,this->matrix);
    150         #else
    151         dataref=this->matrix->ToMatlabMatrix();
    152         #endif
    153         return dataref;
    154 
    155 }
    156 /*}}}*/
    157 /*FUNCTION MatlabMatrixToMatrix{{{1*/
    158 Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix){
    159 
    160         int dummy;
    161         Matrix* matrix=NULL;
    162 
    163         /*allocate matrix object: */
    164         matrix=new Matrix();
    165 
    166         #ifdef _HAVE_PETSC_
    167         MatlabMatrixToPetscMatrix(&matrix->matrix,NULL,NULL,mxmatrix);
    168         #else
    169         matrix->matrix=MatlabMatrixToSeqMat(mxmatrix);
    170         #endif
    171        
    172         return matrix;
    173 }
    174 /*}}}*/
    175 #endif
    176142/*FUNCTION Matrix::Assemble{{{1*/
    177143void Matrix::Assemble(void){
  • issm/trunk/src/c/objects/Numerics/Matrix.h

    r11995 r12330  
    2121#endif
    2222
    23 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    24 #include "mex.h"
    25 #endif
    2623class Vector;
    2724
     
    5148                /*Matrix specific routines {{{1*/
    5249                void Echo(void);
    53                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    54                 mxArray* ToMatlabMatrix(void);
    55                 #endif
    5650                void Assemble(void);
    5751                double Norm(NormMode norm_type);
     
    6660
    6761};
    68 /*API: */
    69 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    70 Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix);
    71 #endif
    7262
    7363#endif //#ifndef _MATRIX_H_
  • issm/trunk/src/c/objects/Numerics/Vector.cpp

    r11995 r12330  
    8585/*}}}*/
    8686#endif
    87 #ifdef _HAVE_GSL_
     87#if defined(_HAVE_GSL_) && !defined(_HAVE_PETSC_)
    8888/*FUNCTION Vector::Vector(SeqVec* seq_vec){{{1*/
    8989Vector::Vector(SeqVec*  seq_vec){
     
    132132}
    133133/*}}}*/
    134 
    135 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    136 /*FUNCTION Vector::ToMatlabVector{{{1*/
    137 mxArray* Vector::ToMatlabVector(void){
    138 
    139         mxArray* dataref=NULL;
    140         #ifdef _HAVE_PETSC_
    141         PetscVectorToMatlabVector(&dataref,this->vector);
    142         #else
    143         dataref=this->vector->ToMatlabVector();
    144         #endif
    145         return dataref;
    146 
    147 }
    148 /*}}}*/
    149 /*FUNCTION MatlabVectorToVector{{{1*/
    150 Vector* MatlabVectorToVector(const mxArray* mxvector){
    151 
    152         int dummy;
    153         Vector* vector=NULL;
    154 
    155         /*allocate vector object: */
    156         vector=new Vector();
    157 
    158         #ifdef _HAVE_PETSC_
    159         MatlabVectorToPetscVector(&vector->vector,&dummy,mxvector);
    160         #else
    161         vector->vector=MatlabVectorToSeqVec(mxvector);
    162         #endif
    163        
    164         return vector;
    165 }
    166 /*}}}*/
    167 #endif
    168134/*FUNCTION Vector::Assemble{{{1*/
    169135void Vector::Assemble(void){
  • issm/trunk/src/c/objects/Numerics/Vector.h

    r11995 r12330  
    2121#endif
    2222               
    23 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    24 #include "mex.h"
    25 #endif
    26 
    2723/*}}}*/
    2824
     
    4743                Vector(Vec petsc_vec);
    4844                #endif
    49                 #ifdef _HAVE_GSL_
     45                #if defined(_HAVE_GSL_) && !defined(_HAVE_PETSC_)
    5046                Vector(SeqVec*  seq_vec);
    5147                #endif
     
    5450                /*Vector specific routines {{{1*/
    5551                void Echo(void);
    56                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    57                 mxArray* ToMatlabVector(void);
    58                 #endif
    5952                void    AXPY(Vector *X, double a);
    6053                void    AYPX(Vector *X, double a);
     
    7770};
    7871
    79 /*API: */
    80 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    81 Vector* MatlabVectorToVector(const mxArray* mxvector);
    82 #endif
    8372
    8473#endif //#ifndef _VECTOR_H_
  • issm/trunk/src/c/objects/Object.h

    r9883 r12330  
    2121                virtual int   Id()=0;
    2222                virtual int   MyRank()=0;
    23                 #ifdef _SERIAL_
    24                 virtual void  Marshall(char** pmarshalled_dataset)=0;
    25                 virtual int   MarshallSize()=0;
    26                 virtual void  Demarshall(char** pmarshalled_dataset)=0;
    27                 #endif
    2823                virtual int   ObjectEnum()=0;
    2924                virtual Object* copy()=0;
  • issm/trunk/src/c/objects/OptArgs.h

    r11995 r12330  
    66#define _OPTARGS_H_
    77
    8 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    9 
    10 #include "mex.h"
    11 struct OptArgs{
    12         char* function_name;
    13         mxArray* femmodel;
    14 };
    15 
    16 #else
    17 
    188class Model;
    199struct OptArgs{
    2010        FemModel* femmodel;
    2111};
    22 #endif
    2312
    2413#endif
  • issm/trunk/src/c/objects/OptPars.h

    r9563 r12330  
    88struct OptPars{
    99
    10         double xmin;
    11         double xmax;
    12         double cm_jump;
     10        IssmDouble xmin;
     11        IssmDouble xmax;
     12        IssmDouble cm_jump;
    1313        int maxiter;
    1414
  • issm/trunk/src/c/objects/Options/Option.h

    r9883 r12330  
    3333                int   Id(){_error_("Not implemented yet");};
    3434                int   MyRank(){_error_("Not implemented yet");};
    35                 #ifdef _SERIAL_
    36                 void  Marshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    37                 int   MarshallSize(){_error_("Not implemented yet");};
    38                 void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    39                 #endif
    4035                int   ObjectEnum(){return OptionEnum;};
    4136                Object* copy(){_error_("Not implemented yet");};
     
    4742                virtual int   NDims()=0;
    4843                virtual int*  Size()=0;
     44                virtual void  Get(int* pvalue)=0;
    4945                virtual void  Get(double* pvalue)=0;
    5046                virtual void  Get(bool* pvalue)=0;
  • issm/trunk/src/c/objects/Options/OptionCell.h

    r9883 r12330  
    3030                int   Id(){_error_("Not implemented yet");};
    3131                int   MyRank(){_error_("Not implemented yet");};
    32                 #ifdef _SERIAL_
    33                 void  Marshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    34                 int   MarshallSize(){_error_("Not implemented yet");};
    35                 void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    36                 #endif
    3732                int   ObjectEnum(){return OptionCellEnum;};
    3833                Object* copy(){_error_("Not implemented yet");};
     
    4439                int   NDims();
    4540                int*  Size();
     41                void  Get(int* pvalue){_error_("An OptionCell object cannot return a int");};
    4642                void  Get(double* pvalue){_error_("An OptionCell object cannot return a double");};
    4743                void  Get(bool* pvalue){  _error_("An OptionCell object cannot return a bool");};
  • issm/trunk/src/c/objects/Options/OptionChar.h

    r9883 r12330  
    3030                int   Id(){_error_("Not implemented yet");};
    3131                int   MyRank(){_error_("Not implemented yet");};
    32                 #ifdef _SERIAL_
    33                 void  Marshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    34                 int   MarshallSize(){_error_("Not implemented yet");};
    35                 void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    36                 #endif
    3732                int   ObjectEnum(){return OptionCharEnum;};
    3833                Object* copy(){_error_("Not implemented yet");};
     
    4439                int   NDims();
    4540                int*  Size();
     41                void  Get(int* pvalue){_error_("An OptionChar object cannot return a int");};
    4642                void  Get(double* pvalue){_error_("An OptionChar object cannot return a double");};
    4743                void  Get(bool* pvalue){  _error_("An OptionChar object cannot return a bool");};
  • issm/trunk/src/c/objects/Options/OptionDouble.cpp

    r9761 r12330  
    120120}
    121121/*}}}*/
     122/*FUNCTION OptionDouble::Get(int* pvalue) {{{1*/
     123void OptionDouble::Get(int* pvalue){
     124
     125        /*We should first check that the size is one*/
     126        if(this->NumEl()!=1){
     127                _error_("option \"%s\" has %i elements and cannot return a single int",this->name,this->NumEl());
     128        }
     129
     130        /*Assign output pointer*/
     131        *pvalue=(int)this->values[0];
     132}
     133/*}}}*/
    122134/*FUNCTION OptionDouble::Get(double* pvalue) {{{1*/
    123135void OptionDouble::Get(double* pvalue){
  • issm/trunk/src/c/objects/Options/OptionDouble.h

    r9883 r12330  
    3030                int   Id(){_error_("Not implemented yet");};
    3131                int   MyRank(){_error_("Not implemented yet");};
    32                 #ifdef _SERIAL_
    33                 void  Marshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    34                 int   MarshallSize(){_error_("Not implemented yet");};
    35                 void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    36                 #endif
    3732                int   ObjectEnum(){return OptionDoubleEnum;};
    3833                Object* copy(){_error_("Not implemented yet");};
     
    4439                int   NDims();
    4540                int*  Size();
     41                void  Get(int* pvalue);
    4642                void  Get(double* pvalue);
    4743                void  Get(bool* pvalue){  _error_("An OptionDouble object cannot return a bool");};
  • issm/trunk/src/c/objects/Options/OptionLogical.h

    r9883 r12330  
    3030                int   Id(){_error_("Not implemented yet");};
    3131                int   MyRank(){_error_("Not implemented yet");};
    32                 #ifdef _SERIAL_
    33                 void  Marshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    34                 int   MarshallSize(){_error_("Not implemented yet");};
    35                 void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    36                 #endif
    3732                int   ObjectEnum(){return OptionLogicalEnum;};
    3833                Object* copy(){_error_("Not implemented yet");};
     
    4439                int   NDims();
    4540                int*  Size();
     41                void  Get(int* pvalue){_error_("An OptionLogical object cannot return a int");};
    4642                void  Get(double* pvalue){_error_("An OptionLogical object cannot return a double");};
    4743                void  Get(bool* pvalue);
  • issm/trunk/src/c/objects/Options/OptionStruct.h

    r9883 r12330  
    3030                int   Id(){_error_("Not implemented yet");};
    3131                int   MyRank(){_error_("Not implemented yet");};
    32                 #ifdef _SERIAL_
    33                 void  Marshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    34                 int   MarshallSize(){_error_("Not implemented yet");};
    35                 void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet");};
    36                 #endif
    3732                int   ObjectEnum(){return OptionStructEnum;};
    3833                Object* copy(){_error_("Not implemented yet");};
     
    4439                int   NDims();
    4540                int*  Size();
     41                void  Get(int* pvalue){_error_("An OptionStruct object cannot return a int");};
    4642                void  Get(double* pvalue){_error_("An OptionStruct object cannot return a double");};
    4743                void  Get(bool* pvalue){  _error_("An OptionStruct object cannot return a bool");};
  • issm/trunk/src/c/objects/Params/BoolParam.cpp

    r11995 r12330  
    6262}
    6363/*}}}*/
    64 #ifdef _SERIAL_
    65 /*FUNCTION BoolParam::Marshall{{{1*/
    66 void  BoolParam::Marshall(char** pmarshalled_dataset){
    67 
    68         char* marshalled_dataset=NULL;
    69         int   enum_value=0;
    70 
    71         /*recover marshalled_dataset: */
    72         marshalled_dataset=*pmarshalled_dataset;
    73 
    74         /*get enum value of BoolParam: */
    75         enum_value=BoolParamEnum;
    76        
    77         /*marshall enum: */
    78         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    79        
    80         /*marshall BoolParam data: */
    81         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    82         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    83 
    84         *pmarshalled_dataset=marshalled_dataset;
    85 }
    86 /*}}}*/
    87 /*FUNCTION BoolParam::MarshallSize{{{1*/
    88 int   BoolParam::MarshallSize(){
    89        
    90         return sizeof(value)+
    91                 +sizeof(enum_type)+
    92                 +sizeof(int); //sizeof(int) for enum value
    93 }
    94 /*}}}*/
    95 /*FUNCTION BoolParam::Demarshall{{{1*/
    96 void  BoolParam::Demarshall(char** pmarshalled_dataset){
    97 
    98         char* marshalled_dataset=NULL;
    99         int   i;
    100 
    101         /*recover marshalled_dataset: */
    102         marshalled_dataset=*pmarshalled_dataset;
    103 
    104         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    105          *object data (thanks to DataSet::Demarshall):*/
    106         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    107         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    108 
    109         /*return: */
    110         *pmarshalled_dataset=marshalled_dataset;
    111         return;
    112 }
    113 /*}}}*/
    114 #endif
    11564/*FUNCTION BoolParam::ObjectEnum{{{1*/
    11665int BoolParam::ObjectEnum(void){
     
    13483}
    13584/*}}}*/
    136 /*FUNCTION BoolParam::SetMatlabField{{{1*/
    137 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    138 void  BoolParam::SetMatlabField(mxArray* dataref){
    139         char* name=NULL;
    140         this->GetParameterName(&name);
    141         mxSetField( dataref, 0, name,mxCreateDoubleScalar((double)value));
    142 }
    143 #endif
    144 /*}}}*/
    14585/*FUNCTION BoolParam::UnitConversion{{{1*/
    14686void  BoolParam::UnitConversion(int direction_enum){
  • issm/trunk/src/c/objects/Params/BoolParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4137                int   Id();
    4238                int   MyRank();
    43                 #ifdef _SERIAL_
    44                 void  Marshall(char** pmarshalled_dataset);
    45                 int   MarshallSize();
    46                 void  Demarshall(char** pmarshalled_dataset);
    47                 #endif
    4839                int   ObjectEnum();
    4940                Object* copy();
     
    8172               
    8273                void GetParameterName(char**pname);
    83                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    84                 void  SetMatlabField(mxArray* dataref);
    85                 #endif
    8674                /*}}}*/
    8775};
  • issm/trunk/src/c/objects/Params/DoubleMatArrayParam.cpp

    r11995 r12330  
    127127}
    128128/*}}}*/
    129 #ifdef _SERIAL_
    130 /*FUNCTION DoubleMatArrayParam::Marshall{{{1*/
    131 void  DoubleMatArrayParam::Marshall(char** pmarshalled_dataset){
    132 
    133         char* marshalled_dataset=NULL;
    134         int   enum_value=0;
    135         int   i;
    136 
    137         /*recover marshalled_dataset: */
    138         marshalled_dataset=*pmarshalled_dataset;
    139 
    140         /*get enum value of DoubleMatArrayParam: */
    141         enum_value=DoubleMatArrayParamEnum;
    142        
    143         /*marshall enum: */
    144         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    145        
    146         /*marshall DoubleMatArrayParam data: */
    147         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    148         memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    149         if(M){
    150                 memcpy(marshalled_dataset,mdim_array,M*sizeof(int));marshalled_dataset+=M*sizeof(int);
    151                 memcpy(marshalled_dataset,ndim_array,M*sizeof(int));marshalled_dataset+=M*sizeof(int);
    152                 for(i=0;i<M;i++){
    153                         double* matrix=this->array[i];
    154                         int     m=this->mdim_array[i];
    155                         int     n=this->ndim_array[i];
    156                         memcpy(marshalled_dataset,&m,sizeof(m));marshalled_dataset+=sizeof(m);
    157                         memcpy(marshalled_dataset,&n,sizeof(n));marshalled_dataset+=sizeof(n);
    158                         if(m*n)memcpy(marshalled_dataset,matrix,m*n*sizeof(double));marshalled_dataset+=m*n*sizeof(double);
    159                 }
    160         }
    161        
    162         *pmarshalled_dataset=marshalled_dataset;
    163 }
    164 /*}}}*/
    165 /*FUNCTION DoubleMatArrayParam::MarshallSize{{{1*/
    166 int   DoubleMatArrayParam::MarshallSize(){
    167 
    168         int size=0;
    169         int i;
    170 
    171         size+=sizeof(enum_type)+
    172                 sizeof(M)+
    173                 M*sizeof(int)+
    174                 M*sizeof(int);
    175 
    176         for(i=0;i<M;i++){
    177                 int     m=this->mdim_array[i];
    178                 int     n=this->ndim_array[i];
    179                 size+=sizeof(m)+sizeof(n)+m*n*sizeof(double);
    180         }
    181         size+=sizeof(int); //sizeof(int) for enum value
    182 
    183         return  size;
    184 }
    185 /*}}}*/
    186 /*FUNCTION DoubleMatArrayParam::Demarshall{{{1*/
    187 void  DoubleMatArrayParam::Demarshall(char** pmarshalled_dataset){
    188 
    189         char* marshalled_dataset=NULL;
    190         int   i;
    191         double* matrix=NULL;
    192         int     m,n;
    193 
    194         /*recover marshalled_dataset: */
    195         marshalled_dataset=*pmarshalled_dataset;
    196 
    197         /*this time, no need to get enum value, the pointer directly points to the beginning of the
    198          *object data (thanks to DataSet::Demarshall):*/
    199        
    200         /*data: */
    201         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    202        
    203         memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    204         if(M){
    205                 this->mdim_array=(int*)xmalloc(M*sizeof(int));
    206                 this->ndim_array=(int*)xmalloc(M*sizeof(int));
    207                 memcpy(this->mdim_array,marshalled_dataset,M*sizeof(int));marshalled_dataset+=M*sizeof(int);
    208                 memcpy(this->ndim_array,marshalled_dataset,M*sizeof(int));marshalled_dataset+=M*sizeof(int);
    209 
    210                 this->array=(double**)xmalloc(M*sizeof(double*));
    211                 for(i=0;i<M;i++){
    212                         memcpy(&m,marshalled_dataset,sizeof(m));marshalled_dataset+=sizeof(m);
    213                         memcpy(&n,marshalled_dataset,sizeof(n));marshalled_dataset+=sizeof(n);
    214                         if(m*n){
    215                                 matrix=(double*)xmalloc(m*n*sizeof(double));
    216                                 memcpy(matrix,marshalled_dataset,m*n*sizeof(double));marshalled_dataset+=m*n*sizeof(double);
    217                         }
    218                         else{
    219                                 matrix=NULL;
    220                         }
    221                         this->array[i]=matrix;
    222                 }
    223         }
    224         else{
    225                 this->array=NULL;
    226                 this->mdim_array=NULL;
    227                 this->ndim_array=NULL;
    228         }
    229 
    230         /*return: */
    231         *pmarshalled_dataset=marshalled_dataset;
    232         return;
    233 }
    234 /*}}}*/
    235 #endif
    236129/*FUNCTION DoubleMatArrayParam::ObjectEnum{{{1*/
    237130int DoubleMatArrayParam::ObjectEnum(void){
     
    307200        EnumToStringx(pname,this->enum_type);
    308201}
    309 /*}}}*/
    310 /*FUNCTION StringArrayParam::SetMatlabField{{{1*/
    311 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    312 void  DoubleMatArrayParam::SetMatlabField(mxArray* dataref){
    313        
    314         int      i,m,n;
    315         double*  matrix=NULL;
    316         double*  outmatrix=NULL;
    317         char*    name=NULL;
    318         mwSize   dims[2]={0};
    319         mxArray* pfield=NULL;
    320         mxArray* pfield2=NULL;
    321         mxArray* pfield3=NULL;
    322        
    323         this->GetParameterName(&name);
    324         dims[0]=this->M;
    325         dims[1]=1;
    326         pfield=mxCreateCellArray(2,dims);
    327 
    328         for(i=0;i<this->M;i++){
    329                 matrix=this->array[i];
    330                 m=this->mdim_array[i];
    331                 n=this->ndim_array[i];
    332                 outmatrix=(double*)xmalloc(m*n*sizeof(double));
    333                 memcpy(outmatrix,matrix,m*n*sizeof(double));
    334        
    335                 pfield2=mxCreateDoubleMatrix(0,0,mxREAL);
    336                 mxSetM(pfield2,n);
    337                 mxSetN(pfield2,m);
    338                 mxSetPr(pfield2,outmatrix);
    339 
    340                 //transpose the outmatrix, written directly to matlab! from C to matlab.
    341                 mexCallMATLAB(1,&pfield3, 1, &pfield2, "transpose");
    342        
    343                 mxSetCell(pfield,i,pfield3);
    344         }
    345        
    346         mxSetField( dataref, 0, name,pfield);
    347 }
    348 #endif
    349202/*}}}*/
    350203/*FUNCTION DoubleMatArrayParam::SetValue(double** array, int M, int* mdim_array, int* ndim_array){{{1*/
  • issm/trunk/src/c/objects/Params/DoubleMatArrayParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4440                int   Id();
    4541                int   MyRank();
    46                 #ifdef _SERIAL_
    47                 void  Marshall(char** pmarshalled_dataset);
    48                 int   MarshallSize();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 #endif
    5142                int   ObjectEnum();
    5243                Object* copy();
     
    8475
    8576                void GetParameterName(char**pname);
    86                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    87                 void  SetMatlabField(mxArray* dataref);
    88                 #endif
    8977
    9078                /*}}}*/
  • issm/trunk/src/c/objects/Params/DoubleMatParam.cpp

    r11995 r12330  
    7878}
    7979/*}}}*/
    80 #ifdef _SERIAL_
    81 /*FUNCTION DoubleMatParam::Marshall{{{1*/
    82 void  DoubleMatParam::Marshall(char** pmarshalled_dataset){
    83 
    84         char* marshalled_dataset=NULL;
    85         int   enum_value=0;
    86 
    87         /*recover marshalled_dataset: */
    88         marshalled_dataset=*pmarshalled_dataset;
    89 
    90         /*get enum value of DoubleMatParam: */
    91         enum_value=DoubleMatParamEnum;
    92        
    93         /*marshall enum: */
    94         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    95        
    96         /*marshall DoubleMatParam data: */
    97         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    98         memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    99         memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N);
    100         memcpy(marshalled_dataset,value,M*N*sizeof(double));marshalled_dataset+=M*N*sizeof(double);
    101 
    102         *pmarshalled_dataset=marshalled_dataset;
    103 }
    104 /*}}}*/
    105 /*FUNCTION DoubleMatParam::MarshallSize{{{1*/
    106 int   DoubleMatParam::MarshallSize(){
    107        
    108         return sizeof(M)
    109                 +sizeof(N)
    110                 +M*N*sizeof(double)
    111                 +sizeof(enum_type)+
    112                 +sizeof(int); //sizeof(int) for enum value
    113 }
    114 /*}}}*/
    115 /*FUNCTION DoubleMatParam::Demarshall{{{1*/
    116 void  DoubleMatParam::Demarshall(char** pmarshalled_dataset){
    117 
    118         char* marshalled_dataset=NULL;
    119         int   i;
    120 
    121         /*recover marshalled_dataset: */
    122         marshalled_dataset=*pmarshalled_dataset;
    123 
    124         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    125          *object data (thanks to DataSet::Demarshall):*/
    126         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    127        
    128         /*data: */
    129         memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    130         memcpy(&N,marshalled_dataset,sizeof(N));marshalled_dataset+=sizeof(N);
    131         value=(double*)xmalloc(M*N*sizeof(double));
    132         memcpy(value,marshalled_dataset,M*N*sizeof(double));marshalled_dataset+=M*N*sizeof(double);
    133 
    134         /*return: */
    135         *pmarshalled_dataset=marshalled_dataset;
    136         return;
    137 }
    138 /*}}}*/
    139 #endif
    14080/*FUNCTION DoubleMatParam::ObjectEnum{{{1*/
    14181int DoubleMatParam::ObjectEnum(void){
     
    169109/*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
    170110void  DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){
    171 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    172         int* output=NULL;
    173         int  i;
    174 
    175         output=(int*)xmalloc((int)(M*N*sizeof(int)));
    176         for(i=0;i<M*N;i++) output[i]=(int)value[i];
    177 
    178         /*Assign output pointers:*/
    179         if(pM) *pM=M;
    180         if(pN) *pN=N;
    181         *pintarray=output;
    182 #else
    183111        _error_("DoubleMat of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type));
    184 #endif
    185112}
    186113/*}}}*/
     
    189116        EnumToStringx(pname,this->enum_type);
    190117}
    191 /*}}}*/
    192 /*FUNCTION DoubleMatParam::SetMatlabField{{{1*/
    193 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    194 void  DoubleMatParam::SetMatlabField(mxArray* dataref){
    195 
    196         mxArray* pfield=NULL;
    197         mxArray* pfield2=NULL;
    198         double* doublemat=NULL;
    199         char* name=NULL;
    200        
    201         this->GetParameterName(&name);
    202         this->GetParameterValue(&doublemat,NULL,NULL);
    203                                
    204         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    205         mxSetM(pfield,N);
    206         mxSetN(pfield,M);
    207         mxSetPr(pfield,doublemat);
    208        
    209         //transpose the matrix, written directly to matlab! from C to matlab.
    210         mexCallMATLAB(1,&pfield2, 1, &pfield, "transpose");
    211         mxSetField( dataref, 0, name,pfield2);
    212 }
    213 #endif
    214118/*}}}*/
    215119/*FUNCTION DoubleMatParam::SetValue{{{1*/
  • issm/trunk/src/c/objects/Params/DoubleMatParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4339                int   Id();
    4440                int   MyRank();
    45                 #ifdef _SERIAL_
    46                 void  Marshall(char** pmarshalled_dataset);
    47                 int   MarshallSize();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 #endif
    5041                int   ObjectEnum();
    5142                Object* copy();
     
    8475
    8576                void GetParameterName(char**pname);
    86                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    87                 void  SetMatlabField(mxArray* dataref);
    88                 #endif
    8977
    9078                /*}}}*/
  • issm/trunk/src/c/objects/Params/DoubleParam.cpp

    r11995 r12330  
    5959}
    6060/*}}}*/
    61 #ifdef _SERIAL_
    62 /*FUNCTION DoubleParam::Marshall{{{1*/
    63 void  DoubleParam::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 DoubleParam: */
    72         enum_value=DoubleParamEnum;
    73        
    74         /*marshall enum: */
    75         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    76        
    77         /*marshall DoubleParam data: */
    78         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    79         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    80 
    81         *pmarshalled_dataset=marshalled_dataset;
    82 }
    83 /*}}}*/
    84 /*FUNCTION DoubleParam::MarshallSize{{{1*/
    85 int   DoubleParam::MarshallSize(){
    86        
    87         return sizeof(value)+
    88                 +sizeof(enum_type)+
    89                 +sizeof(int); //sizeof(int) for enum value
    90 }
    91 /*}}}*/
    92 /*FUNCTION DoubleParam::Demarshall{{{1*/
    93 void  DoubleParam::Demarshall(char** pmarshalled_dataset){
    94 
    95         char* marshalled_dataset=NULL;
    96         int   i;
    97 
    98         /*recover marshalled_dataset: */
    99         marshalled_dataset=*pmarshalled_dataset;
    100 
    101         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    102          *object data (thanks to DataSet::Demarshall):*/
    103         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    104         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    105 
    106         /*return: */
    107         *pmarshalled_dataset=marshalled_dataset;
    108         return;
    109 }
    110 /*}}}*/
    111 #endif
    11261/*FUNCTION DoubleParam::ObjectEnum{{{1*/
    11362int DoubleParam::ObjectEnum(void){
     
    13382/*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{1*/
    13483void DoubleParam::GetParameterValue(int* pinteger){
    135 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    136         *pinteger=(int)value;
    137 #else
    13884        _error_("Double param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));
    139 #endif
    14085}
    14186/*}}}*/
    14287/*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{1*/
    14388void DoubleParam::GetParameterValue(bool* pbool){
    144 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    145 
    146         /*If debugging mode, cheeck that the double is 0 or 1*/
    147         _assert_(value==0 || value==1);
    148         *pbool=(bool)value;
    149 
    150 #else
    15189        _error_("Double param of enum %i (%s) cannot return an bool",enum_type,EnumToStringx(enum_type));
    152 #endif
    15390}
    15491/*}}}*/
    15592/*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{1*/
    15693void DoubleParam::GetParameterValue(int** pintarray,int* pM){
    157 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    158         int* output=NULL;
    159 
    160         output=(int*)xmalloc(1*sizeof(int));
    161         *output=(int)value;
    162 
    163         /*Assign output pointers:*/
    164         if(pM) *pM=1;
    165         *pintarray=output;
    166 #else
    16794        _error_("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));
    168 #endif
    16995}
    17096/*}}}*/
    17197/*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
    17298void DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){
    173 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    174         int* output=NULL;
    175 
    176         output=(int*)xmalloc(1*sizeof(int));
    177         *output=(int)value;
    178 
    179         /*Assign output pointers:*/
    180         if(pM) *pM=1;
    181         if(pN) *pN=1;
    182         *pintarray=output;
    183 #else
    18499        _error_("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));
    185 #endif
    186100}
    187101/*}}}*/
    188102/*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM){{{1*/
    189103void DoubleParam::GetParameterValue(double** pdoublearray,int* pM){
    190 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    191         double* output=NULL;
    192 
    193         output=(double*)xmalloc(1*sizeof(double));
    194         *output=(double)value;
    195 
    196         /*Assign output podoubleers:*/
    197         if(pM) *pM=1;
    198         *pdoublearray=output;
    199 #else
    200104        _error_("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type));
    201 #endif
    202105}
    203106/*}}}*/
    204107/*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){{{1*/
    205108void DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){
    206 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    207         double* output=NULL;
    208 
    209         output=(double*)xmalloc(1*sizeof(double));
    210         *output=(double)value;
    211 
    212         /*Assign output podoubleers:*/
    213         if(pM) *pM=1;
    214         if(pN) *pN=1;
    215         *pdoublearray=output;
    216 #else
    217109        _error_("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type));
    218 #endif
    219110}
    220 /*}}}*/
    221 /*FUNCTION DoubleParam::SetMatlabField{{{1*/
    222 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    223 void  DoubleParam::SetMatlabField(mxArray* dataref){
    224 
    225         char* name=NULL;
    226         this->GetParameterName(&name);
    227         mxSetField( dataref, 0, name,mxCreateDoubleScalar(value));
    228 }
    229 #endif
    230111/*}}}*/
    231112/*FUNCTION DoubleParam::UnitConversion{{{1*/
  • issm/trunk/src/c/objects/Params/DoubleParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4238                int   Id();
    4339                int   MyRank();
    44                 #ifdef _SERIAL_
    45                 void  Marshall(char** pmarshalled_dataset);
    46                 int   MarshallSize();
    47                 void  Demarshall(char** pmarshalled_dataset);
    48                 #endif
    4940                int   ObjectEnum();
    5041                Object* copy();
     
    8273
    8374                void GetParameterName(char**pname);
    84                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    85                 void  SetMatlabField(mxArray* dataref);
    86                 #endif
    8775
    8876                /*}}}*/
  • issm/trunk/src/c/objects/Params/DoubleTransientMatParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
  • issm/trunk/src/c/objects/Params/DoubleVecParam.cpp

    r11995 r12330  
    7575}
    7676/*}}}*/
    77 #ifdef _SERIAL_
    78 /*FUNCTION DoubleVecParam::Marshall{{{1*/
    79 void  DoubleVecParam::Marshall(char** pmarshalled_dataset){
    80 
    81         char* marshalled_dataset=NULL;
    82         int   enum_value=0;
    83 
    84         /*recover marshalled_dataset: */
    85         marshalled_dataset=*pmarshalled_dataset;
    86 
    87         /*get enum value of DoubleVecParam: */
    88         enum_value=DoubleVecParamEnum;
    89        
    90         /*marshall enum: */
    91         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    92        
    93         /*marshall DoubleVecParam data: */
    94         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    95         memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    96         memcpy(marshalled_dataset,values,M*sizeof(double));marshalled_dataset+=M*sizeof(double);
    97 
    98         *pmarshalled_dataset=marshalled_dataset;
    99 }
    100 /*}}}*/
    101 /*FUNCTION DoubleVecParam::MarshallSize{{{1*/
    102 int   DoubleVecParam::MarshallSize(){
    103        
    104         return sizeof(M)
    105                 +M*sizeof(double)
    106                 +sizeof(enum_type)+
    107                 +sizeof(int); //sizeof(int) for enum value
    108 }
    109 /*}}}*/
    110 /*FUNCTION DoubleVecParam::Demarshall{{{1*/
    111 void  DoubleVecParam::Demarshall(char** pmarshalled_dataset){
    112 
    113         char* marshalled_dataset=NULL;
    114         int   i;
    115 
    116         /*recover marshalled_dataset: */
    117         marshalled_dataset=*pmarshalled_dataset;
    118 
    119         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    120          *object data (thanks to DataSet::Demarshall):*/
    121         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    122        
    123         /*data: */
    124         memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    125         values=(double*)xmalloc(M*sizeof(double));
    126         memcpy(values,marshalled_dataset,M*sizeof(double));marshalled_dataset+=M*sizeof(double);
    127 
    128         /*return: */
    129         *pmarshalled_dataset=marshalled_dataset;
    130         return;
    131 }
    132 /*}}}*/
    133 #endif
    13477/*FUNCTION DoubleVecParam::ObjectEnum{{{1*/
    13578int DoubleVecParam::ObjectEnum(void){
     
    181124/*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{1*/
    182125void  DoubleVecParam::GetParameterValue(int** pintarray,int* pM){
    183 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    184         int* output=NULL;
    185         int i;
    186 
    187         /*Cast values into integers*/
    188         output=(int*)xmalloc(M*sizeof(int));
    189         for(i=0;i<M;i++) output[i]=(int)values[i];
    190 
    191         /*Assign output pointers:*/
    192         if(pM) *pM=M;
    193         *pintarray=output;
    194 #else
    195126        _error_("DoubleVec param of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type));
    196 #endif
    197127}
    198128/*}}}*/
     
    201131        EnumToStringx(pname,this->enum_type);
    202132}
    203 /*}}}*/
    204 /*FUNCTION DoubleVecParam::SetMatlabField{{{1*/
    205 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    206 void  DoubleVecParam::SetMatlabField(mxArray* dataref){
    207 
    208         char* name=NULL;
    209         double* doublevec=NULL;
    210         mxArray* pfield=NULL;
    211 
    212         this->GetParameterValue(&doublevec,NULL);
    213         this->GetParameterName(&name);
    214                                
    215         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    216         mxSetM(pfield,M);
    217         mxSetN(pfield,1);
    218         mxSetPr(pfield,doublevec);
    219        
    220         mxSetField( dataref, 0, name, pfield);
    221 }
    222 #endif
    223133/*}}}*/
    224134/*FUNCTION DoubleVecParam::SetValue{{{1*/
  • issm/trunk/src/c/objects/Params/DoubleVecParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4238                int   Id();
    4339                int   MyRank();
    44                 #ifdef _SERIAL_
    45                 void  Marshall(char** pmarshalled_dataset);
    46                 int   MarshallSize();
    47                 void  Demarshall(char** pmarshalled_dataset);
    48                 #endif
    4940                int   ObjectEnum();
    5041                Object* copy();
     
    8273               
    8374                void GetParameterName(char**pname);
    84                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    85                 void  SetMatlabField(mxArray* dataref);
    86                 #endif
    8775                /*}}}*/
    8876};
  • issm/trunk/src/c/objects/Params/FileParam.cpp

    r11995 r12330  
    6262}
    6363/*}}}*/
    64 #ifdef _SERIAL_
    65 /*FUNCTION FileParam::Marshall{{{1*/
    66 void  FileParam::Marshall(char** pmarshalled_dataset){
    67 
    68         _error_("FileParam is a pointer and cannot be marshalled");
    69 }
    70 /*}}}*/
    71 /*FUNCTION FileParam::MarshallSize{{{1*/
    72 int   FileParam::MarshallSize(){
    73         _error_("FileParam is a pointer and cannot be marshalled");
    74 }
    75 /*}}}*/
    76 /*FUNCTION FileParam::Demarshall{{{1*/
    77 void  FileParam::Demarshall(char** pmarshalled_dataset){
    78         _error_("FileParam is a pointer and cannot be marshalled");
    79 }
    80 /*}}}*/
    81 #endif
    8264/*FUNCTION FileParam::ObjectEnum{{{1*/
    8365int FileParam::ObjectEnum(void){
     
    10183}
    10284/*}}}*/
    103 /*FUNCTION FileParam::SetMatlabField{{{1*/
    104 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    105 void  FileParam::SetMatlabField(mxArray* dataref){
    106        
    107         _error_("FileParam is a pointer and cannot be converted into a matlab object");
    108 }
    109 #endif
    110 /*}}}*/
    11185/*FUNCTION FileParam::UnitConversion{{{1*/
    11286void  FileParam::UnitConversion(int direction_enum){
  • issm/trunk/src/c/objects/Params/FileParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4137                int   Id();
    4238                int   MyRank();
    43                 #ifdef _SERIAL_
    44                 void  Marshall(char** pmarshalled_dataset);
    45                 int   MarshallSize();
    46                 void  Demarshall(char** pmarshalled_dataset);
    47                 #endif
    4839                int   ObjectEnum();
    4940                Object* copy();
     
    8172
    8273                void GetParameterName(char**pname);
    83                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    84                 void  SetMatlabField(mxArray* dataref);
    85                 #endif
    8674
    8775                /*}}}*/
  • issm/trunk/src/c/objects/Params/IntMatParam.cpp

    r11995 r12330  
    7878}
    7979/*}}}*/
    80 #ifdef _SERIAL_
    81 /*FUNCTION IntMatParam::Marshall{{{1*/
    82 void  IntMatParam::Marshall(char** pmarshalled_dataset){
    83 
    84         char* marshalled_dataset=NULL;
    85         int   enum_value=0;
    86 
    87         /*recover marshalled_dataset: */
    88         marshalled_dataset=*pmarshalled_dataset;
    89 
    90         /*get enum value of IntMatParam: */
    91         enum_value=IntMatParamEnum;
    92        
    93         /*marshall enum: */
    94         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    95        
    96         /*marshall IntMatParam data: */
    97         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    98         memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    99         memcpy(marshalled_dataset,&N,sizeof(N));marshalled_dataset+=sizeof(N);
    100         memcpy(marshalled_dataset,value,M*N*sizeof(int));marshalled_dataset+=M*N*sizeof(int);
    101 
    102         *pmarshalled_dataset=marshalled_dataset;
    103 }
    104 /*}}}*/
    105 /*FUNCTION IntMatParam::MarshallSize{{{1*/
    106 int   IntMatParam::MarshallSize(){
    107        
    108         return sizeof(M)
    109                 +sizeof(N)
    110                 +M*N*sizeof(int)
    111                 +sizeof(enum_type)+
    112                 +sizeof(int); //sizeof(int) for enum value
    113 }
    114 /*}}}*/
    115 /*FUNCTION IntMatParam::Demarshall{{{1*/
    116 void  IntMatParam::Demarshall(char** pmarshalled_dataset){
    117 
    118         char* marshalled_dataset=NULL;
    119         int   i;
    120 
    121         /*recover marshalled_dataset: */
    122         marshalled_dataset=*pmarshalled_dataset;
    123 
    124         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    125          *object data (thanks to DataSet::Demarshall):*/
    126         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    127        
    128         /*data: */
    129         memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    130         memcpy(&N,marshalled_dataset,sizeof(N));marshalled_dataset+=sizeof(N);
    131         value=(int*)xmalloc(M*N*sizeof(int));
    132         memcpy(value,marshalled_dataset,M*N*sizeof(int));marshalled_dataset+=M*N*sizeof(int);
    133 
    134         /*return: */
    135         *pmarshalled_dataset=marshalled_dataset;
    136         return;
    137 }
    138 /*}}}*/
    139 #endif
    14080/*FUNCTION IntMatParam::ObjectEnum{{{1*/
    14181int IntMatParam::ObjectEnum(void){
     
    172112}
    173113/*}}}*/
    174 /*FUNCTION IntMatParam::SetMatlabField{{{1*/
    175 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    176 void  IntMatParam::SetMatlabField(mxArray* dataref){
    177 
    178         char    *name        = NULL;
    179         double  *doublearray = NULL;
    180         int     *intarray    = NULL;
    181         mxArray *pfield      = NULL;
    182         mxArray *pfield2     = NULL;
    183 
    184         this->GetParameterValue(&intarray,NULL,NULL);
    185         this->GetParameterName(&name);
    186 
    187         /*cast intarray into doublearray for Matlab*/
    188         doublearray=(double*)xmalloc(M*N*sizeof(double));
    189         for(int i=0;i<M*N;i++)doublearray[i]=(double)intarray[i];
    190         xfree((void**)&intarray);
    191 
    192         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    193         mxSetM(pfield,M);
    194         mxSetN(pfield,N);
    195         mxSetPr(pfield,doublearray);
    196 
    197         //transpose the matrix, written directly to matlab! from C to matlab.
    198         mexCallMATLAB(1,&pfield2, 1, &pfield, "transpose");
    199         mxSetField( dataref, 0, name,pfield2);
    200 }
    201 #endif
    202 /*}}}*/
    203114/*FUNCTION IntMatParam::SetValue{{{1*/
    204115void  IntMatParam::SetValue(int* intarray,int in_M,int in_N){
  • issm/trunk/src/c/objects/Params/IntMatParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4339                int   Id();
    4440                int   MyRank();
    45                 #ifdef _SERIAL_
    46                 void  Marshall(char** pmarshalled_dataset);
    47                 int   MarshallSize();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 #endif
    5041                int   ObjectEnum();
    5142                Object* copy();
     
    8374
    8475                void GetParameterName(char**pname);
    85                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    86                 void  SetMatlabField(mxArray* dataref);
    87                 #endif
    8876
    8977                /*}}}*/
  • issm/trunk/src/c/objects/Params/IntParam.cpp

    r11995 r12330  
    6262}
    6363/*}}}*/
    64 #ifdef _SERIAL_
    65 /*FUNCTION IntParam::Marshall{{{1*/
    66 void  IntParam::Marshall(char** pmarshalled_dataset){
    67 
    68         char* marshalled_dataset=NULL;
    69         int   enum_value=0;
    70 
    71         /*recover marshalled_dataset: */
    72         marshalled_dataset=*pmarshalled_dataset;
    73 
    74         /*get enum value of IntParam: */
    75         enum_value=IntParamEnum;
    76        
    77         /*marshall enum: */
    78         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    79        
    80         /*marshall IntParam data: */
    81         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    82         memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
    83 
    84         *pmarshalled_dataset=marshalled_dataset;
    85 }
    86 /*}}}*/
    87 /*FUNCTION IntParam::MarshallSize{{{1*/
    88 int   IntParam::MarshallSize(){
    89        
    90         return sizeof(value)+
    91                 +sizeof(enum_type)+
    92                 +sizeof(int); //sizeof(int) for enum value
    93 }
    94 /*}}}*/
    95 /*FUNCTION IntParam::Demarshall{{{1*/
    96 void  IntParam::Demarshall(char** pmarshalled_dataset){
    97 
    98         char* marshalled_dataset=NULL;
    99         int   i;
    100 
    101         /*recover marshalled_dataset: */
    102         marshalled_dataset=*pmarshalled_dataset;
    103 
    104         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    105          *object data (thanks to DataSet::Demarshall):*/
    106         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    107         memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
    108 
    109         /*return: */
    110         *pmarshalled_dataset=marshalled_dataset;
    111         return;
    112 }
    113 /*}}}*/
    114 #endif
    11564/*FUNCTION IntParam::ObjectEnum{{{1*/
    11665int IntParam::ObjectEnum(void){
     
    13483}
    13584/*}}}*/
    136 /*FUNCTION IntParam::SetMatlabField{{{1*/
    137 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    138 void  IntParam::SetMatlabField(mxArray* dataref){
    139        
    140         char* name=NULL;
    141         this->GetParameterName(&name);
    142         mxSetField( dataref, 0, name,mxCreateDoubleScalar((double)value));
    143 }
    144 #endif
    145 /*}}}*/
    14685/*FUNCTION IntParam::UnitConversion{{{1*/
    14786void  IntParam::UnitConversion(int direction_enum){
  • issm/trunk/src/c/objects/Params/IntParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4238                int   Id();
    4339                int   MyRank();
    44                 #ifdef _SERIAL_
    45                 void  Marshall(char** pmarshalled_dataset);
    46                 int   MarshallSize();
    47                 void  Demarshall(char** pmarshalled_dataset);
    48                 #endif
    4940                int   ObjectEnum();
    5041                Object* copy();
     
    8273
    8374                void GetParameterName(char**pname);
    84                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    85                 void  SetMatlabField(mxArray* dataref);
    86                 #endif
    8775
    8876                /*}}}*/
  • issm/trunk/src/c/objects/Params/IntVecParam.cpp

    r11995 r12330  
    9191}
    9292/*}}}*/
    93 #ifdef _SERIAL_
    94 /*FUNCTION IntVecParam::Marshall{{{1*/
    95 void  IntVecParam::Marshall(char** pmarshalled_dataset){
    96 
    97         char* marshalled_dataset=NULL;
    98         int   enum_value=0;
    99 
    100         /*recover marshalled_dataset: */
    101         marshalled_dataset=*pmarshalled_dataset;
    102 
    103         /*get enum value of IntVecParam: */
    104         enum_value=IntVecParamEnum;
    105        
    106         /*marshall enum: */
    107         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    108        
    109         /*marshall IntVecParam data: */
    110         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    111         memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    112         if(M)memcpy(marshalled_dataset,values,M*sizeof(int));marshalled_dataset+=M*sizeof(int);
    113 
    114         *pmarshalled_dataset=marshalled_dataset;
    115 }
    116 /*}}}*/
    117 /*FUNCTION IntVecParam::MarshallSize{{{1*/
    118 int   IntVecParam::MarshallSize(){
    119        
    120         return sizeof(M)+
    121                 +M*sizeof(int)
    122                 +sizeof(enum_type)+
    123                 +sizeof(int); //sizeof(int) for enum value
    124 }
    125 /*}}}*/
    126 /*FUNCTION IntVecParam::Demarshall{{{1*/
    127 void  IntVecParam::Demarshall(char** pmarshalled_dataset){
    128 
    129         char* marshalled_dataset=NULL;
    130         int   i;
    131 
    132         /*recover marshalled_dataset: */
    133         marshalled_dataset=*pmarshalled_dataset;
    134 
    135         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    136          *object data (thanks to DataSet::Demarshall):*/
    137         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    138        
    139         /*data: */
    140         memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M);
    141         if(M) {
    142                 values=(int*)xmalloc(M*sizeof(int));
    143                 memcpy(values,marshalled_dataset,M*sizeof(int));marshalled_dataset+=M*sizeof(int);
    144         }
    145 
    146         /*return: */
    147         *pmarshalled_dataset=marshalled_dataset;
    148         return;
    149 }
    150 /*}}}*/
    151 #endif
    15293/*FUNCTION IntVecParam::ObjectEnum{{{1*/
    15394int IntVecParam::ObjectEnum(void){
     
    185126}
    186127/*}}}*/
    187 /*FUNCTION IntVecParam::SetMatlabField{{{1*/
    188 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    189 void  IntVecParam::SetMatlabField(mxArray* dataref){
    190 
    191         char    *name      = NULL;
    192         double  *doublevec = NULL;
    193         int     *intvec    = NULL;
    194         mxArray *pfield    = NULL;
    195 
    196         this->GetParameterValue(&intvec,NULL);
    197         this->GetParameterName(&name);
    198 
    199         /*cast intvec into doublevec for Matlab*/
    200         if(M){
    201                 doublevec=(double*)xmalloc(M*sizeof(double));
    202                 for(int i=0;i<M;i++)doublevec[i]=(double)intvec[i];
    203         }
    204         else doublevec=NULL;
    205         xfree((void**)&intvec);
    206                                
    207         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    208         mxSetM(pfield,M);
    209         mxSetN(pfield,1);
    210         mxSetPr(pfield,doublevec);
    211        
    212         mxSetField(dataref, 0, name, pfield);
    213 }
    214 #endif
    215 /*}}}*/
    216128/*FUNCTION IntVecParam::SetValue{{{1*/
    217129void  IntVecParam::SetValue(int* intarray,int in_M){
  • issm/trunk/src/c/objects/Params/IntVecParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4339                int   Id();
    4440                int   MyRank();
    45                 #ifdef _SERIAL_
    46                 void  Marshall(char** pmarshalled_dataset);
    47                 int   MarshallSize();
    48                 void  Demarshall(char** pmarshalled_dataset);
    49                 #endif
    5041                int   ObjectEnum();
    5142                Object* copy();
     
    8374               
    8475                void GetParameterName(char**pname);
    85                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    86                 void  SetMatlabField(mxArray* dataref);
    87                 #endif
    8876                /*}}}*/
    8977};
  • issm/trunk/src/c/objects/Params/MatrixParam.cpp

    r11995 r12330  
    7070}
    7171/*}}}*/
    72 #ifdef _SERIAL_
    73 /*FUNCTION MatrixParam::Marshall{{{1*/
    74 void  MatrixParam::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 MatrixParam: */
    85         enum_value=MatrixParamEnum;
    86        
    87         /*marshall enum: */
    88         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    89        
    90         /*marshall MatrixParam data: */
    91         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    92         if(value){
    93                 value->GetSize(&M,&N);
    94                 serial_mat=value->ToSerial();
    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 MatrixParam::MarshallSize{{{1*/
    114 int   MatrixParam::MarshallSize(){
    115 
    116         int M=0;
    117         int N=0;
    118         if(value)value->GetSize(&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
    125 }
    126 /*}}}*/
    127 /*FUNCTION MatrixParam::Demarshall{{{1*/
    128 void  MatrixParam::Demarshall(char** pmarshalled_dataset){
    129 
    130         char* marshalled_dataset=NULL;
    131         int   M,N;
    132         double* serial_mat=NULL;
    133 
    134         /*recover marshalled_dataset: */
    135         marshalled_dataset=*pmarshalled_dataset;
    136 
    137         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    138          *object data (thanks to DataSet::Demarshall):*/
    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         memcpy(&N,marshalled_dataset,sizeof(N));marshalled_dataset+=sizeof(N);
    144         if(M!=0 && N!=0){
    145                 serial_mat=(double*)xmalloc(M*N*sizeof(double));
    146                 memcpy(serial_mat,marshalled_dataset,M*N*sizeof(double));marshalled_dataset+=(M*N*sizeof(double));
    147                 value=new Matrix(serial_mat,M,N,.001);
    148         }
    149         else{
    150                 value=NULL;
    151         }
    152 
    153         /*Free ressources:*/
    154         xfree((void**)&serial_mat);
    155 
    156         /*return: */
    157         *pmarshalled_dataset=marshalled_dataset;
    158 }
    159 /*}}}*/
    160 #endif
    16172/*FUNCTION MatrixParam::ObjectEnum{{{1*/
    16273int MatrixParam::ObjectEnum(void){
     
    190101}
    191102/*}}}*/
    192 /*FUNCTION MatrixParam::SetMatlabField{{{1*/
    193 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    194 void  MatrixParam::SetMatlabField(mxArray* dataref){
    195        
    196         char* name=NULL;
    197         int   M,N;
    198         double* doublemat=NULL;
    199         mxArray* pfield=NULL;
    200 
    201         doublemat=value->ToSerial();
    202         value->GetSize(&M,&N);
    203         this->GetParameterName(&name);
    204                                
    205         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    206         mxSetM(pfield,M);
    207         mxSetN(pfield,N);
    208         mxSetPr(pfield,doublemat);
    209         mxSetField( dataref, 0, name, pfield);
    210 }
    211 #endif
    212 /*}}}*/
    213103/*FUNCTION MatrixParam::SetValue{{{1*/
    214104void  MatrixParam::SetValue(Matrix* matrix){
  • issm/trunk/src/c/objects/Params/MatrixParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4238                int   Id();
    4339                int   MyRank();
    44                 #ifdef _SERIAL_
    45                 void  Marshall(char** pmarshalled_dataset);
    46                 int   MarshallSize();
    47                 void  Demarshall(char** pmarshalled_dataset);
    48                 #endif
    4940                int   ObjectEnum();
    5041                Object* copy();
     
    8273
    8374                void GetParameterName(char**pname);
    84                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    85                 void  SetMatlabField(mxArray* dataref);
    86                 #endif
    8775
    8876                /*}}}*/
  • issm/trunk/src/c/objects/Params/Param.h

    r11995 r12330  
    1414#else
    1515#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    16 #endif
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include <mex.h>
    2016#endif
    2117
     
    6056                virtual void  UnitConversion(int direction_enum)=0;
    6157                virtual void  GetParameterName(char**pname)=0;
    62                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    63                 virtual void  SetMatlabField(mxArray* dataref)=0;
    64                 #endif
    6558};
    6659#endif
  • issm/trunk/src/c/objects/Params/StringArrayParam.cpp

    r11995 r12330  
    9292}
    9393/*}}}*/
    94 #ifdef _SERIAL_
    95 /*FUNCTION StringArrayParam::Marshall{{{1*/
    96 void  StringArrayParam::Marshall(char** pmarshalled_dataset){
    97 
    98         int   i;
    99         char* marshalled_dataset=NULL;
    100         int   enum_value=0;
    101         int   stringsize;
    102         char* string=NULL;
    103 
    104         /*recover marshalled_dataset: */
    105         marshalled_dataset=*pmarshalled_dataset;
    106 
    107         /*get enum value of StringArrayParam: */
    108         enum_value=StringArrayParamEnum;
    109        
    110         /*marshall enum: */
    111         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    112        
    113         /*marshall data: */
    114         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    115         memcpy(marshalled_dataset,&numstrings,sizeof(numstrings));marshalled_dataset+=sizeof(numstrings);
    116         for(i=0;i<numstrings;i++){
    117                 string=this->value[i];
    118                 stringsize=strlen(string)+1;
    119                
    120                 memcpy(marshalled_dataset,&stringsize,sizeof(stringsize));marshalled_dataset+=sizeof(stringsize);
    121                 memcpy(marshalled_dataset,string,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);
    122         }
    123 
    124         *pmarshalled_dataset=marshalled_dataset;
    125 }
    126 /*}}}*/
    127 /*FUNCTION StringArrayParam::MarshallSize{{{1*/
    128 int   StringArrayParam::MarshallSize(){
    129 
    130         int i;
    131         int marshallsize=0;
    132         int stringsize;
    133         char* string=NULL;
    134 
    135         marshallsize+=sizeof(numstrings);
    136 
    137         for(i=0;i<numstrings;i++){
    138                 string=this->value[i];
    139                 stringsize=strlen(string)+1;
    140                 marshallsize+=sizeof(stringsize);
    141                 marshallsize+=stringsize*sizeof(char);
    142         }
    143        
    144         marshallsize+=sizeof(enum_type);
    145         marshallsize+=sizeof(int); //sizeof(int) for enum value
    146 
    147         return marshallsize;
    148 }
    149 /*}}}*/
    150 /*FUNCTION StringArrayParam::Demarshall{{{1*/
    151 void  StringArrayParam::Demarshall(char** pmarshalled_dataset){
    152 
    153         char* marshalled_dataset=NULL;
    154         int   i;
    155         int   stringsize;
    156         char* string=NULL;
    157 
    158         /*recover marshalled_dataset: */
    159         marshalled_dataset=*pmarshalled_dataset;
    160 
    161         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    162          *object data (thanks to DataSet::Demarshall):*/
    163         memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    164 
    165         memcpy(&numstrings,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    166         if(numstrings){
    167                 this->value=(char**)xmalloc(numstrings*sizeof(char*));
    168 
    169                 for(i=0;i<numstrings;i++){
    170                         memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    171 
    172                         string=(char*)xmalloc(stringsize*sizeof(char));
    173                         memcpy(string,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);
    174 
    175                         this->value[i]=string;
    176                 }
    177         }
    178         else this->value=NULL;
    179 
    180         /*return: */
    181         *pmarshalled_dataset=marshalled_dataset;
    182         return;
    183 }
    184 /*}}}*/
    185 #endif
    18694/*FUNCTION StringArrayParam::ObjectEnum{{{1*/
    18795int StringArrayParam::ObjectEnum(void){
     
    236144}
    237145/*}}}*/
    238 /*FUNCTION StringArrayParam::SetMatlabField{{{1*/
    239 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    240 void  StringArrayParam::SetMatlabField(mxArray* dataref){
    241        
    242         int      i;
    243         char*    name=NULL;
    244         mwSize   dims[2]={0};
    245         mxArray* pfield=NULL;
    246        
    247         this->GetParameterName(&name);
    248 
    249         dims[0]=this->numstrings;
    250         dims[1]=1;
    251         pfield=mxCreateCellArray(2,dims);
    252         for(i=0;i<this->numstrings;i++){
    253                 char* string=value[i];
    254                 mxSetCell(pfield,i,mxCreateString(string));
    255         }
    256         mxSetField( dataref, 0, name,pfield);
    257 }
    258 #endif
    259 /*}}}*/
    260146/*FUNCTION StringArrayParam::SetValue{{{1*/
    261147void  StringArrayParam::SetValue(char** stringarray,int M){
  • issm/trunk/src/c/objects/Params/StringArrayParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4440                int   Id();
    4541                int   MyRank();
    46                 #ifdef _SERIAL_
    47                 void  Marshall(char** pmarshalled_dataset);
    48                 int   MarshallSize();
    49                 void  Demarshall(char** pmarshalled_dataset);
    50                 #endif
    5142                int   ObjectEnum();
    5243                Object* copy();
     
    8475
    8576                void GetParameterName(char**pname);
    86                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    87                 void  SetMatlabField(mxArray* dataref);
    88                 #endif
    8977                /*}}}*/
    9078};
  • issm/trunk/src/c/objects/Params/StringParam.cpp

    r11995 r12330  
    6464}
    6565/*}}}*/
    66 #ifdef _SERIAL_
    67 /*FUNCTION StringParam::Marshall{{{1*/
    68 void  StringParam::Marshall(char** pmarshalled_dataset){
    69 
    70         char* marshalled_dataset=NULL;
    71         int   enum_value=0;
    72         int   stringsize;
    73 
    74         /*recover marshalled_dataset: */
    75         marshalled_dataset=*pmarshalled_dataset;
    76 
    77         /*get enum value of StringParam: */
    78         enum_value=StringParamEnum;
    79        
    80         /*marshall enum: */
    81         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    82 
    83         /*marshall data: */
    84         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    85         stringsize=strlen(this->value)+1;
    86        
    87         memcpy(marshalled_dataset,&stringsize,sizeof(stringsize));marshalled_dataset+=sizeof(stringsize);
    88         memcpy(marshalled_dataset,this->value,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);
    89 
    90         *pmarshalled_dataset=marshalled_dataset;
    91 }
    92 /*}}}*/
    93 /*FUNCTION StringParam::MarshallSize{{{1*/
    94 int   StringParam::MarshallSize(){
    95 
    96         int stringsize;
    97         stringsize=strlen(this->value)+1;
    98        
    99         return sizeof(int)+
    100                 stringsize*sizeof(char)+
    101                 sizeof(enum_type)+
    102                 sizeof(int); //sizeof(int) for enum value
    103 }
    104 /*}}}*/
    105 /*FUNCTION StringParam::Demarshall{{{1*/
    106 void  StringParam::Demarshall(char** pmarshalled_dataset){
    107 
    108         char* marshalled_dataset=NULL;
    109         int   i;
    110         int   stringsize;
    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(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    118 
    119         memcpy(&stringsize,marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
    120        
    121         this->value=(char*)xmalloc(stringsize*sizeof(char));
    122         memcpy(this->value,marshalled_dataset,stringsize*sizeof(char));marshalled_dataset+=stringsize*sizeof(char);
    123 
    124         /*return: */
    125         *pmarshalled_dataset=marshalled_dataset;
    126         return;
    127 }
    128 /*}}}*/
    129 #endif
    13066/*FUNCTION StringParam::ObjectEnum{{{1*/
    13167int StringParam::ObjectEnum(void){
     
    164100}
    165101/*}}}*/
    166 /*FUNCTION StringParam::SetMatlabField{{{1*/
    167 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    168 void  StringParam::SetMatlabField(mxArray* dataref){
    169        
    170         char* name=NULL;
    171 
    172         this->GetParameterName(&name);
    173         mxSetField( dataref, 0, name, mxCreateString(value));
    174 }
    175 #endif
    176 /*}}}*/
    177102/*FUNCTION StringParam::SetValue{{{1*/
    178103void  StringParam::SetValue(char* string){
  • issm/trunk/src/c/objects/Params/StringParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4238                int   Id();
    4339                int   MyRank();
    44                 #ifdef _SERIAL_
    45                 void  Marshall(char** pmarshalled_dataset);
    46                 int   MarshallSize();
    47                 void  Demarshall(char** pmarshalled_dataset);
    48                 #endif
    4940                int   ObjectEnum();
    5041                Object* copy();
     
    8273
    8374                void GetParameterName(char**pname);
    84                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    85                 void  SetMatlabField(mxArray* dataref);
    86                 #endif
    8775
    8876                /*}}}*/
  • issm/trunk/src/c/objects/Params/VectorParam.cpp

    r11995 r12330  
    7272}
    7373/*}}}*/
    74 #ifdef _SERIAL_
    75 /*FUNCTION VectorParam::Marshall{{{1*/
    76 void  VectorParam::Marshall(char** pmarshalled_dataset){
    77 
    78         char* marshalled_dataset=NULL;
    79         int   enum_value=0;
    80         int   M;
    81         double* serial_value=NULL;
    82 
    83         /*recover marshalled_dataset: */
    84         marshalled_dataset=*pmarshalled_dataset;
    85 
    86         /*get enum value of VectorParam: */
    87         enum_value=VectorParamEnum;
    88        
    89         /*marshall enum: */
    90         memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
    91        
    92         /*marshall VectorParam data: */
    93         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    94         if(value){
    95                 value->GetSize(&M);
    96                 serial_value=value->ToMPISerial();
    97                 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    98                 memcpy(marshalled_dataset,serial_value,M*sizeof(double));marshalled_dataset+=(M*sizeof(double));
    99         }
    100         else{
    101                 M=0;
    102                 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M);
    103         }
    104         /*Free ressources:*/
    105         xfree((void**)&serial_value);
    106 
    107         /*return:*/
    108         *pmarshalled_dataset=marshalled_dataset;
    109 }
    110 /*}}}*/
    111 /*FUNCTION VectorParam::MarshallSize{{{1*/
    112 int   VectorParam::MarshallSize(){
    113 
    114         int M=0;
    115         if(value)value->GetSize(&M);
    116 
    117         return sizeof(M)+M*sizeof(double)
    118                 +sizeof(enum_type)+
    119                 +sizeof(int); //sizeof(int) for enum value
    120 }
    121 /*}}}*/
    122 /*FUNCTION VectorParam::Demarshall{{{1*/
    123 void  VectorParam::Demarshall(char** pmarshalled_dataset){
    124 
    125         char* marshalled_dataset=NULL;
    126         int   i;
    127         double* serial_vec=NULL;
    128         int   M;
    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=new Vector(serial_vec,M);
    145         }
    146         else{
    147                 value=NULL;
    148         }
    149 
    150         /*Free ressources:*/
    151         xfree((void**)&serial_vec);
    152 
    153         /*return: */
    154         *pmarshalled_dataset=marshalled_dataset;
    155 }
    156 /*}}}*/
    157 #endif
    15874/*FUNCTION VectorParam::ObjectEnum{{{1*/
    15975int VectorParam::ObjectEnum(void){
     
    188104}
    189105/*}}}*/
    190 /*FUNCTION VectorParam::SetMatlabField{{{1*/
    191 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    192 void  VectorParam::SetMatlabField(mxArray* dataref){
    193 
    194         mxArray* pfield=NULL;
    195         char* name=NULL;
    196         double* doublevec=NULL;
    197         int M;
    198        
    199         doublevec=value->ToMPISerial();
    200         value->GetSize(&M);
    201         this->GetParameterName(&name);
    202        
    203         pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    204         mxSetM(pfield,M);
    205         mxSetN(pfield,1);
    206         mxSetPr(pfield,doublevec);
    207        
    208         mxSetField( dataref, 0, name, pfield);
    209 }
    210 #endif
    211 /*}}}*/
    212106/*FUNCTION VectorParam::SetValue{{{1*/
    213107void  VectorParam::SetValue(Vector* vector){
  • issm/trunk/src/c/objects/Params/VectorParam.h

    r11995 r12330  
    1313#else
    1414#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    15 #endif
    16 
    17 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    18 #include <mex.h>
    1915#endif
    2016
     
    4238                int   Id();
    4339                int   MyRank();
    44                 #ifdef _SERIAL_
    45                 void  Marshall(char** pmarshalled_dataset);
    46                 int   MarshallSize();
    47                 void  Demarshall(char** pmarshalled_dataset);
    48                 #endif
    4940                int   ObjectEnum();
    5041                Object* copy();
     
    8273
    8374                void GetParameterName(char**pname);
    84                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    85                 void  SetMatlabField(mxArray* dataref);
    86                 #endif
    8775
    8876                /*}}}*/
  • issm/trunk/src/c/objects/Patch.cpp

    r11527 r12330  
    120120        int         node_numrows;
    121121        double     *total_values  = NULL;
     122        #ifdef _HAVE_MPI_
    122123        MPI_Status  status;
     124        #endif
    123125
    124         #ifdef _SERIAL_
    125         return; //nothing to be done
    126         #endif
    127        
    128126        /*First, figure out total number of rows combining all the cpus: */
     127        #ifdef _HAVE_MPI_
    129128        MPI_Reduce(&this->numrows,&total_numrows,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    130129        MPI_Bcast(&total_numrows,1,MPI_INT,0,MPI_COMM_WORLD);
     130        #else
     131        total_numrows=this->numrows;
     132        #endif
    131133
    132134        /*return if patch empty*/
     
    144146
    145147        /*Now, ask other nodes to send their values: */
     148        #ifdef _HAVE_MPI_
    146149        for (i=1;i<num_procs;i++){
    147150                if (my_rank==i){
     
    155158                }
    156159        }       
     160        #endif
    157161
    158162        /*Now, node 0 has total_values, of size total_numrows*this->numcols. Update the fields in the patch, to reflect this new
     
    163167                this->values=total_values;
    164168        }
     169        #ifdef _HAVE_MPI_
    165170        else{
    166171                this->numrows=0;
    167172                xfree((void**)&this->values);
    168173        }
     174        #endif
    169175}/*}}}*/
  • issm/trunk/src/c/objects/Patch.h

    r10400 r12330  
    3434                int     maxnodes;    // maxnodes corresponds to the largest amout of nodes on a given element, determined by the interpolation type.
    3535               
    36                 double* values;  //result values
     36                IssmDouble* values;  //result values
    3737
    3838                Patch();
     
    4040                ~Patch();
    4141                void fillelementinfo(int row, int element_id, int* vertices_ids, int num_vertices);
    42                 void fillresultinfo(int row,int enum_type,int step, double time, int interpolation, double* nodal_values, int num_nodes);
     42                void fillresultinfo(int row,int enum_type,int step, IssmDouble time, int interpolation, IssmDouble* nodal_values, int num_nodes);
    4343                void Gather(void);
    4444
  • issm/trunk/src/c/objects/Segment.cpp

    r9883 r12330  
    7171}
    7272/*}}}*/
    73 #ifdef _SERIAL_
    74 /*FUNCTION Segment::Marshall{{{1*/
    75 void  Segment::Marshall(char** pmarshalled_dataset){
    76 
    77         _error_(" not supported yet!");
    78 }
    79 /*}}}*/
    80 /*FUNCTION Segment::MarshallSize{{{1*/
    81 int   Segment::MarshallSize(){
    82         _error_(" not supported yet!");
    83 }
    84 /*}}}*/
    85 /*FUNCTION Segment::Demarshall{{{1*/
    86 void  Segment::Demarshall(char** pmarshalled_dataset){
    87         _error_(" not supported yet!");
    88 }
    89 /*}}}*/
    90 #endif
    9173/*FUNCTION Segment::ObjectEnum{{{1*/
    9274int Segment::ObjectEnum(void){
  • issm/trunk/src/c/objects/Segment.h

    r9883 r12330  
    1515        public:
    1616                int eid;
    17                 double x1;
    18                 double y1;
    19                 double x2;
    20                 double y2;
     17                IssmDouble x1;
     18                IssmDouble y1;
     19                IssmDouble x2;
     20                IssmDouble y2;
    2121
    2222                /*Segment constructors, destructors {{{1*/
    2323                Segment();
    24                 Segment(int eid,double x1,double y1, double x2, double y2);
     24                Segment(int eid,IssmDouble x1,IssmDouble y1, IssmDouble x2, IssmDouble y2);
    2525                ~Segment();
    2626                /*}}}*/
     
    3030                int   Id();
    3131                int   MyRank();
    32                 #ifdef _SERIAL_
    33                 void  Marshall(char** pmarshalled_dataset);
    34                 int   MarshallSize();
    35                 void  Demarshall(char** pmarshalled_dataset);
    36                 #endif
    3732                int   ObjectEnum();
    3833                Object* copy();
  • issm/trunk/src/c/objects/Update.h

    r10576 r12330  
    1515        public:
    1616
    17                 virtual void  InputUpdateFromVector(double* vector, int name, int type)=0;
     17                virtual void  InputUpdateFromVector(IssmDouble* vector, int name, int type)=0;
    1818                virtual void  InputUpdateFromVector(int* vector, int name, int type)=0;
    1919                virtual void  InputUpdateFromVector(bool* vector, int name, int type)=0;
    2020                #ifdef _HAVE_DAKOTA_
    21                 virtual void  InputUpdateFromMatrixDakota(double* matrix, int rows, int ncols, int name, int type)=0;
    22                 virtual void  InputUpdateFromVectorDakota(double* vector, int name, int type)=0;
     21                virtual void  InputUpdateFromMatrixDakota(IssmDouble* matrix, int rows, int ncols, int name, int type)=0;
     22                virtual void  InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type)=0;
    2323                virtual void  InputUpdateFromVectorDakota(int* vector, int name, int type)=0;
    2424                virtual void  InputUpdateFromVectorDakota(bool* vector, int name, int type)=0;
    2525                #endif
    26                 virtual void  InputUpdateFromConstant(double constant, int name)=0;
     26                virtual void  InputUpdateFromConstant(IssmDouble constant, int name)=0;
    2727                virtual void  InputUpdateFromConstant(int constant, int name)=0;
    2828                virtual void  InputUpdateFromConstant(bool constant, int name)=0;
    29                 virtual void  InputUpdateFromSolution(double* solution)=0;
     29                virtual void  InputUpdateFromSolution(IssmDouble* solution)=0;
    3030                virtual void  InputUpdateFromIoModel(int index, IoModel* iomodel)=0;
    3131
  • issm/trunk/src/c/objects/Vertex.cpp

    r11995 r12330  
    9292}
    9393/*}}}*/
    94 #ifdef _SERIAL_
    95 /*FUNCTION Vertex::Marshall {{{1*/
    96 void  Vertex::Marshall(char** pmarshalled_dataset){
    97 
    98         char* marshalled_dataset=NULL;
    99         int   enum_type=0;
    100 
    101         /*recover marshalled_dataset: */
    102         marshalled_dataset=*pmarshalled_dataset;
    103 
    104         /*get enum type of Vertex: */
    105         enum_type=VertexEnum;
    106 
    107         /*marshall enum: */
    108         memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
    109 
    110         /*marshall Vertex data: */
    111         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
    112         memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
    113         memcpy(marshalled_dataset,&x,sizeof(x));marshalled_dataset+=sizeof(x);
    114         memcpy(marshalled_dataset,&y,sizeof(y));marshalled_dataset+=sizeof(y);
    115         memcpy(marshalled_dataset,&z,sizeof(z));marshalled_dataset+=sizeof(z);
    116         memcpy(marshalled_dataset,&sigma,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
    117         memcpy(marshalled_dataset,&connectivity,sizeof(connectivity));marshalled_dataset+=sizeof(connectivity);
    118         memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
    119         memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone);
    120 
    121         *pmarshalled_dataset=marshalled_dataset;
    122         return;
    123 }
    124 /*}}}*/
    125 /*FUNCTION Vertex::MarshallSize {{{1*/
    126 int   Vertex::MarshallSize(){
    127        
    128         return sizeof(id)+
    129                 sizeof(sid)+
    130                 sizeof(x)+
    131                 sizeof(y)+
    132                 sizeof(z)+
    133                 sizeof(sigma)+
    134                 sizeof(connectivity)+
    135                 sizeof(dof)+
    136                 sizeof(clone)+
    137                 +sizeof(int); //sizeof(int) for enum type
    138 }
    139 /*}}}*/
    140 /*FUNCTION Vertex::Demarshall {{{1*/
    141 void  Vertex::Demarshall(char** pmarshalled_dataset){
    142 
    143         char* marshalled_dataset=NULL;
    144         int   i;
    145 
    146         /*recover marshalled_dataset: */
    147         marshalled_dataset=*pmarshalled_dataset;
    148 
    149         /*this time, no need to get enum type, the pointer directly points to the beginning of the
    150          *object data (thanks to DataSet::Demarshall):*/
    151 
    152         memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
    153         memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
    154         memcpy(&x,marshalled_dataset,sizeof(x));marshalled_dataset+=sizeof(x);
    155         memcpy(&y,marshalled_dataset,sizeof(y));marshalled_dataset+=sizeof(y);
    156         memcpy(&z,marshalled_dataset,sizeof(z));marshalled_dataset+=sizeof(z);
    157         memcpy(&sigma,marshalled_dataset,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
    158         memcpy(&connectivity,marshalled_dataset,sizeof(connectivity));marshalled_dataset+=sizeof(connectivity);
    159         memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
    160         memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone);
    161 
    162         /*return: */
    163         *pmarshalled_dataset=marshalled_dataset;
    164         return;
    165 }
    166 /*}}}*/
    167 #endif
    16894/*FUNCTION Vertex::ObjectEnum{{{1*/
    16995int Vertex::ObjectEnum(void){
  • issm/trunk/src/c/objects/Vertex.h

    r11995 r12330  
    2525                int    id;
    2626                int    sid;            //sid for "serial" id, ie the rank of this vertex in the vertices dataset, if the dataset was serial on 1 cpu.
    27                 double x;
    28                 double y;
    29                 double z;
    30                 double sigma;          //sigma coordinate: (z-bed)/thickness
     27                IssmDouble x;
     28                IssmDouble y;
     29                IssmDouble z;
     30                IssmDouble sigma;          //sigma coordinate: (z-bed)/thickness
    3131                int    connectivity;   //number of vertices connected to this vertex
    3232
     
    3737                /*Vertex constructors, destructors {{{1*/
    3838                Vertex();
    39                 Vertex(int id, int sid,double x, double y, double z, double sigma, int connectivity);
    40                 void Init(int id, int sid, double x, double y, double z, double sigma,int connectivity);
     39                Vertex(int id, int sid,IssmDouble x, IssmDouble y, IssmDouble z, IssmDouble sigma, int connectivity);
     40                void Init(int id, int sid, IssmDouble x, IssmDouble y, IssmDouble z, IssmDouble sigma,int connectivity);
    4141                Vertex(int id, int sid, int i, IoModel* iomodel);
    4242                ~Vertex();
     
    4747                int   Id();
    4848                int   MyRank();
    49                 #ifdef _SERIAL_
    50                 void  Marshall(char** pmarshalled_dataset);
    51                 int   MarshallSize();
    52                 void  Demarshall(char** pmarshalled_dataset);
    53                 #endif
    5449                int   ObjectEnum();
    5550                Object* copy();
     
    6560                int   Sid(void);
    6661                int   Connectivity(void);
    67                 void  UpdatePosition(Vector* vz,Parameters* parameters,double* thickness,double* bed);
     62                void  UpdatePosition(Vector* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed);
    6863                /*}}}*/
    6964};
  • issm/trunk/src/c/objects/objects.h

    r11995 r12330  
    170170#include "./Bamg/Mesh.h"
    171171#include "./Bamg/Geometry.h"
    172 #include "./Bamg/QuadTree.h"
     172#include "./Bamg/BamgQuadtree.h"
    173173#include "./Bamg/SetOfE4.h"
    174174
     175/*Kriging*/
     176#include "./Kriging/Variogram.h"
     177#include "./Kriging/GaussianVariogram.h"
     178#include "./Kriging/ExponentialVariogram.h"
     179#include "./Kriging/SphericalVariogram.h"
     180#include "./Kriging/PowerVariogram.h"
     181#include "./Kriging/Quadtree.h"
     182#include "./Kriging/Observation.h"
     183
    175184#endif
  • issm/trunk/src/c/shared/Alloc/alloc.cpp

    r11995 r12330  
    1919#endif
    2020
    21 #if defined(_SERIAL_) && defined(_HAVE_MATLAB_)
    22 #include "mex.h"
    23 #endif
    24 
    2521#include <stdio.h>
    2622#include <stdlib.h>
     
    3733        if(!size)_error_(" attempting to 0 size allocation!");
    3834
    39         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    40         /* Use the matlab api to do the allocation: */
    41         memptr=mxMalloc(size);
    42         #else
    4335        /* Use the c library to do the allocation: */
    4436        memptr=malloc(size);
    45         #endif
    4637        if(!memptr) _error_("memory allocation failed!");
    4738
     
    5546        if(!size)_error_("attempting to 0 size allocation!");
    5647
    57         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    58         /* Use the matlab api to do the allocation: */
    59         memptr=mxCalloc(n,size);
    60         #else
    6148        /* Use the c library to do the allocation: */
    6249        memptr=calloc(n,size);
    63         #endif
    6450        if(!memptr) _error_("memory allocation failed!");
    6551
     
    7056
    7157        if (pv && *pv){
    72                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    73                         mxFree(*pv);
    74                 #else
    75                         free(*pv);
    76                 #endif
     58                free(*pv);
    7759
    7860                *pv=NULL;
     
    8365       
    8466        if (pv && *pv){
    85                 #ifdef _PARALLEL_
    8667                /*There is no mxDelete in the Matlab API -> using delete trips up Matlab. So we
    8768                 * don't actually free memory in Matlab, we let the memory manager do that. We only
    8869                 * free in parallel: */
    8970                delete *pv;
    90                 #else
    91                 /*Actually, still get rid of internal Petsc matrix. Quick fix until Matlab handles C++
    92                  * correctly: */
    93                 #ifdef _HAVE_PETSC_
    94                         MatFree(&(*pv)->matrix);
    95                 #endif
    96                 #endif
    9771                *pv=NULL;
    9872        }
     
    10276
    10377        if (pv && *pv){
    104                 #ifdef _PARALLEL_
    10578                /*There is no mxDelete in the Matlab API -> using delete trips up Matlab. So we
    10679                 * don't actually free memory in Matlab, we let the memory manager do that. We only
    10780                 * free in parallel: */
    10881                delete *pv;
    109                 #else
    110                 /*Actually, still get rid of internal Petsc vector. Quick fix until Matlab handles C++
    111                  * correctly: */
    112                 #ifdef _HAVE_PETSC_
    113                         VecFree(&(*pv)->vector);
    114                 #endif
    115                 #endif
    11682                *pv=NULL;
    11783        }
     
    12490       
    12591        if(!size)_error_("attempting to realloc to zero");
    126 
    127         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    128         value = (void*)mxRealloc(pv,size);
    129         #else
    13092        value = (void*)realloc(pv,size);
    131         #endif
    13293
    13394        if (value == NULL) {
  • issm/trunk/src/c/shared/Elements/elements.h

    r11995 r12330  
    4747        printf("\n");
    4848}
     49inline void printbinary(int n) {
     50        unsigned int i=1L<<(sizeof(n)*8-1);
     51
     52        while (i>0) {
     53                if (n&i)
     54                 printf("1");
     55                else
     56                 printf("0");
     57                i>>=1;
     58        }
     59}
    4960
    5061#endif //ifndef _SHARED_ELEMENTS_H_
  • issm/trunk/src/c/shared/Exceptions/Exceptions.cpp

    r11995 r12330  
    1111#include "../shared.h"
    1212#include "../../include/include.h"
    13 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    14 #include "mex.h"
    15 #endif
    1613
    1714ErrorException::ErrorException(const string &what_arg){
     
    3229
    3330ErrorException::~ErrorException() throw(){
     31        extern int num_procs;
     32        /*We want the report only for matlab modules, otherwise we get twice the report
     33         * We assume that if num_procs==1, it is a module (FIXME)*/
     34        if(num_procs==1) this->Report();
    3435}
    3536
     
    4041void ErrorException::Report(){
    4142        extern int my_rank;
     43        extern int num_procs;
    4244
    4345        if (function_name=="" || file_line==0){ //WINDOWS
     
    4547        }
    4648        else{
    47                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    48                         mexErrMsgTxt(exprintf("\n??? Error using ==> %s at %i\n%s error message: %s\n",
    49                                                         file_name.c_str(),file_line,function_name.c_str(),what()));
    50                 #else
     49                if(num_procs==1){
     50                        printf("\n??? Error using ==> %s:%i\n",file_name.c_str(),file_line);
     51                        printf("%s error message: %s\n\n",function_name.c_str(),what());
     52                }
     53                else{
    5154                        printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line);
    5255                        printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what());
    53                 #endif
     56                }
    5457        }
    5558        return;
  • issm/trunk/src/c/shared/Exceptions/exceptions.h

    r11237 r12330  
    2323
    2424        public:
    25 
    2625        ErrorException(const string &what_arg); //for windows
    2726        ErrorException(string what_file,string what_function,int what_line,string what_arg);//UNIX
    2827        ~ErrorException() throw();
    29 
    3028        virtual const char *what() const throw();
    31 
    3229        void Report();
    3330
  • issm/trunk/src/c/shared/Exp/DomainOutlineRead.cpp

    r11995 r12330  
    1313#include "../../Container/DataSet.h"
    1414
    15 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole=true){
    16 
     15int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname){
    1716       
    1817        /*indexing: */
     
    102101                if((x[0]==x[n-1]) && (y[0]==y[n-1])){
    103102                        cl=true;
    104                         if (!whole) {
    105                                 n=n-1;
    106                         }
    107103                }
    108104
     
    126122}
    127123
    128 DataSet* DomainOutlineRead(char* domainname,bool whole=true){
    129 
    130         /*indexing: */
    131         int i;
     124DataSet* DomainOutlineRead(char* domainname){
    132125
    133126        /*intermediary: */
    134         int nprof;
    135         int* profnvertices=NULL;
    136         double** pprofx=NULL;
    137         double** pprofy=NULL;
    138 
    139         Contour* contour=NULL;
     127        int       nprof;
     128        int      *profnvertices = NULL;
     129        double  **pprofx        = NULL;
     130        double  **pprofy        = NULL;
     131        Contour  *contour       = NULL;
    140132
    141133        /*output: */
    142134        DataSet* domain=NULL;
    143135
    144         /*get domain outline from intermediary function:*/
    145         DomainOutlineRead(&nprof,&profnvertices,&pprofx, &pprofy, NULL,domainname,whole);
     136        /*If domainname is an empty string, return empty dataset*/
     137        if (strcmp(domainname,"")==0){
     138                nprof=0;
     139        }
     140        else{
     141                DomainOutlineRead(&nprof,&profnvertices,&pprofx, &pprofy, NULL,domainname);
     142        }
    146143
    147144        /*now create dataset of contours: */
    148145        domain=new DataSet(0);
    149146
    150         for(i=0;i<nprof;i++){
     147        for(int i=0;i<nprof;i++){
    151148                domain->AddObject(new Contour(i,profnvertices[i],pprofx[i],pprofy[i],1));
    152149        }
    153 
    154150        return domain;
    155151}
  • issm/trunk/src/c/shared/Exp/DomainOutlineWrite.cpp

    r9320 r12330  
    1111#include "../Exceptions/exceptions.h"
    1212
    13 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname,bool whole=true){
     13int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname){
    1414
    1515       
     
    2020        /*I/O: */
    2121        FILE* fid=NULL;
    22 
    23         /*input: */
    24 //      int nprof; //number of profiles in the domainname file
    25 //      int* profnvertices=NULL; //array holding the number of vertices for the nprof profiles
    26 //      double** pprofx=NULL; //array of profiles x coordinates
    27 //      double** pprofy=NULL; //array of profiles y coordinates
    28 //      bool* closed=NULL; //array holding closed flags for the nprof profiles
    2922
    3023        /*open domain outline file for writing: */
     
    4336               
    4437                /*Write number of profile vertices: */
    45                 if(closed[counter] && !whole)
    46                         fprintf(fid,"%u %s\n",profnvertices[counter]+1,"1.");
    47                 else
    48                         fprintf(fid,"%u %s\n",profnvertices[counter]  ,"1.");
     38                fprintf(fid,"%u %s\n",profnvertices[counter]  ,"1.");
    4939       
    5040                /*Write next line: */
     
    5545                        fprintf(fid,"%lf\t%lf\n",pprofx[counter][i],pprofy[counter][i]);
    5646                }
    57 
    58                 /*Now check that we are dealing with open contours: */
    59                 if(closed[counter] && !whole)
    60                         fprintf(fid,"%lf\t%lf\n",pprofx[counter][0],pprofy[counter][0]);
    6147
    6248                /*Write blank line: */
  • issm/trunk/src/c/shared/Exp/exp.h

    r11995 r12330  
    1313int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue);
    1414int IsInPolySerial(double* in,double* xc,double* yc,int numvertices,double* x,double* y,int nods, int edgevalue);
    15 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname,bool whole);
     15int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname);
    1616int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue);
    1717
    18 int      DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole);
    19 DataSet* DomainOutlineRead(char* domainname,bool whole);
     18int      DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname);
     19DataSet* DomainOutlineRead(char* domainname);
    2020
    2121
  • issm/trunk/src/c/shared/Numerics/OptionsFromAnalysis.cpp

    r11995 r12330  
    88#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    99#endif
     10
     11#include <cstring>
    1012
    1113#include "../../objects/objects.h"
     
    3032        parameters->FindParam(&strings,&numanalyses,PetscOptionsStringsEnum);
    3133
    32         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_) //do not take this away, because ISSM loads analyses as a Double Param instead of a DoubleVec Param  when running with only 1 analysis
    33         if(numanalyses==1){ analyses=(double*)xmalloc(1*sizeof(double)); parameters->FindParam(analyses,PetscOptionsAnalysesEnum);
    34         }
    35         else parameters->FindParam(&analyses,&dummy,PetscOptionsAnalysesEnum);
    36         #else
    3734        parameters->FindParam(&analyses,&dummy,PetscOptionsAnalysesEnum);
    38         #endif
    3935
    4036        if(numanalyses==0)return NULL; //we did not find petsc options, don't bother.
  • issm/trunk/src/c/shared/Numerics/Synchronize.sh

    r11527 r12330  
    22#Synchronize Verbosity
    33#first remove existing files
    4 rm $ISSM_TIER/src/m/shared/Verb*.m
     4rm $ISSM_DIR/src/m/shared/Verb*.m
    55
    66echo "Synchronizing Verbosity levels..."
     
    2929#include "../../include/macros.h"
    3030#include "../Exceptions/exceptions.h"
    31 #ifdef _SERIAL_
    32 #include <mex.h>
    33 #endif
    3431/*}}}*/
    3532
     
    5451
    5552        #Add Verbosity Matlab file{{{
    56         cat <<END > $ISSM_TIER"/src/m/shared/"$(echo $FILENAME".m")
     53        cat <<END > $ISSM_DIR"/src/m/shared/"$(echo $FILENAME".m")
    5754function bool=$(echo $FILENAME)()
    5855%$(echo $FILENAME | awk {'print toupper($1)'}) - Return true if $(echo $LEVELNAME | awk {'print tolower($1)'}) level is activated
     
    140137        if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
    141138
    142 #ifdef _SERIAL_
    143 
    144         mxArray* output=NULL;
    145         mxArray* input=NULL;
    146         input=mxCreateDoubleScalar((double)level);
    147 
    148         mexCallMATLAB(0,&output,1,&input,"SetVerbosityLevel");
    149 #else
    150 
    151139        verbositylevel = level;
    152140
    153 #endif
    154141}/*}}}*/
    155142/*FUNCTION GetVerbosityLevel {{{*/
    156143int  GetVerbosityLevel(void){
    157 #ifdef _SERIAL_
    158 
    159         mxArray* output=NULL;
    160         mxArray* input=NULL;
    161         double   level;
    162 
    163         mexCallMATLAB(1,&output,0,&input,"GetVerbosityLevel");
    164         level=mxGetScalar(output);
    165 
    166         verbositylevel = (int)level;
    167         return verbositylevel;
    168 
    169 #else
    170 
    171144        _assert_(verbositylevel>=0);
    172145        return verbositylevel;
    173 
    174 #endif
    175146}/*}}}*/
    176147END
    177148#}}}
    178149#Complete verbose.m {{{1
    179 VERBOSEPATH="$ISSM_TIER/src/m/classes/verbose.m"
     150VERBOSEPATH="$ISSM_DIR/src/m/classes/verbose.m"
    180151cat $VERBOSEPATH  | sed "/%BEGINFIELDS/,$ d"  > temp_begin
    181152cat $VERBOSEPATH  | sed "1,/%ENDFIELDS/d" > temp_end
  • issm/trunk/src/c/shared/Numerics/Verbosity.cpp

    r11995 r12330  
    1818#include "../../include/macros.h"
    1919#include "../Exceptions/exceptions.h"
    20 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    21 #include <mex.h>
    22 #endif
    2320/*}}}*/
    2421
     
    3936        if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
    4037
    41 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    42 
    43         mxArray* output=NULL;
    44         mxArray* input=NULL;
    45         input=mxCreateDoubleScalar((double)level);
    46 
    47         mexCallMATLAB(0,&output,1,&input,"SetVerbosityLevel");
    48 #else
    49 
    5038        verbositylevel = level;
    5139
    52 #endif
    5340}/*}}}*/
    5441/*FUNCTION GetVerbosityLevel {{{*/
    5542int  GetVerbosityLevel(void){
    56 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    57 
    58         mxArray* output=NULL;
    59         mxArray* input=NULL;
    60         double   level;
    61 
    62         mexCallMATLAB(1,&output,0,&input,"GetVerbosityLevel");
    63         level=mxGetScalar(output);
    64 
    65         verbositylevel = (int)level;
    66         return verbositylevel;
    67 
    68 #else
    6943
    7044        _assert_(verbositylevel>=0);
    7145        return verbositylevel;
    7246
    73 #endif
    7447}/*}}}*/
  • issm/trunk/src/c/shared/Numerics/XZvectorsToCoordinateSystem.cpp

    r11995 r12330  
    1 #include "../../io/Matlab/matlabio.h"
    21#include "../Alloc/alloc.h"
    32#include "../../include/include.h"
    43#include "../Exceptions/exceptions.h"
     4#include "./isnan.h"
    55#include <math.h>
    66
  • issm/trunk/src/c/shared/Sorting/binary_search.cpp

    r9320 r12330  
    1111#include <stdio.h>
    1212
    13 int binary_search(int* poffset,int target, int* sorted_integers,int num_integers){
     13int binary_search(int* poffset,int target,int* sorted_integers,int num_integers){
    1414
    1515        /*output: */
    1616        int offset;  //offset, if found
    17         int found=0;  //found=0 if target is not found, 1 otherwise.
     17        int found=0; //found=0 if target is not found, 1 otherwise.
    1818
    1919        /*intermediary: */
     
    6464        return found;
    6565}
    66 
  • issm/trunk/src/c/shared/Sorting/sorting.h

    r1 r12330  
    66#define  _SORTING_H_
    77
    8 int binary_search(int* poffset,int target, int* sorted_integers,int num_integers);
    9 
     8int binary_search(int* poffset,int target,int* sorted_integers,int num_integers);
    109
    1110#endif //ifndef _SORTING_H_
    12 
  • issm/trunk/src/c/shared/Threads/LaunchThread.cpp

    r9320 r12330  
    6767        function((void*)&handle);
    6868        #endif
    69 
    7069}
  • issm/trunk/src/c/shared/TriMesh/SplitMeshForRifts.cpp

    r8301 r12330  
    4747        segmentmarkerlist=*psegmentmarkerlist;
    4848
    49 
    5049        /*Establish list of segments that belong to a rift: */
    51         RiftSegmentsFromSegments(&nriftsegs,&riftsegments,nel,index,nsegs,segments); /*riftsegments of size nriftsegsx4 (4 for first element on segment,second element,
    52                                                                                                                                                                    first node and second snode)*/
     50        /*riftsegments of size nriftsegsx4 (4 for first element on segment,second element,first node and second snode)*/
     51        RiftSegmentsFromSegments(&nriftsegs,&riftsegments,nel,index,nsegs,segments);
    5352
    5453        /*Go through all nodes of the rift segments, and start splitting the mesh: */
     
    5756                for (j=0;j<2;j++){
    5857       
    59                         node=*(riftsegments+4*i+j+2);
     58                        node=riftsegments[4*i+j+2];
    6059                        if(flags[node-1]){
    6160                                /*This node was already split, skip:*/
     
    7069                                DetermineGridElementListOnOneSideOfRift(&NumGridElementListOnOneSideOfRift,&GridElementListOnOneSideOfRift,i,nriftsegs,riftsegments,node,index,nel);
    7170                       
    72                                 /*Summary: we have for node, a list of elements (GridElementListOnOneSideOfRift, of size NumGridElementListOnOneSideOfRift) that all contain node
    73                                  *and that are on the same side of the rift. For all these elements, we clone node into another node, and we swap all instances of node in the triangulation
    74                                  *for those elements, to the new node.*/
     71                                /*Summary: we have for node, a list of elements
     72                                 * (GridElementListOnOneSideOfRift, of size
     73                                 * NumGridElementListOnOneSideOfRift) that all contain node
     74                                 *and that are on the same side of the rift. For all these
     75                                 elements, we clone node into another node, and we swap all
     76                                 instances of node in the triangulation *for those elements, to the
     77                                 new node.*/
    7578                               
    7679                                //augment number of nodes
     
    9497
    9598        /*update segments: they got modified completely by adding new nodes.*/
    96         UpdateSegments(&segments,&segmentmarkerlist, &nsegs,index,x,y,riftsegments,nriftsegs);
     99        UpdateSegments(&segments,&segmentmarkerlist, &nsegs,index,x,y,riftsegments,nriftsegs,nods,nel);
    97100
    98101        /*Assign output pointers: */
  • issm/trunk/src/c/shared/TriMesh/TriMeshUtils.cpp

    r11527 r12330  
    1111
    1212#define RIFTPENALTYPAIRSWIDTH 8
     13/*FUNCTION IsGridOnRift{{{*/
    1314int IsGridOnRift(int* riftsegments, int nriftsegs, int node){
    1415
     
    3233                return 0;
    3334        }
    34 }
    35                                
    36 
     35}/*}}}*/
     36/*FUNCTION GridElementsList{{{*/
    3737int GridElementsList(int** pGridElements, int* pNumGridElements,int node,double * index,int nel){
    3838
     
    8787        *pNumGridElements=NumGridElements;
    8888        return noerr;
    89 }
    90 
    91 
     89}/*}}}*/
     90/*FUNCTION IsNeighbor{{{*/
    9291int IsNeighbor(int el1,int el2,double* index){
    9392        /*From a triangulation held in index, figure out if elements 1 and 2 have two nodes in common: */
     
    105104                return 0;
    106105        }
    107 }
    108                                                        
    109 
     106}/*}}}*/
     107/*FUNCTION IsOnRift{{{*/
    110108int IsOnRift(int el,int nriftsegs,int* riftsegments){
    111109        /*From a list of elements segments, figure out if el belongs to it: */
     
    117115        }
    118116        return 0;
    119 }
    120 
    121 
    122 /******************************************************************************************************************************
    123                                    RiftSegmentsFromSegments
    124 ******************************************************************************************************************************/
    125 
     117}/*}}}*/
     118/*FUNCTION RiftSegmentsFromSegments{{{*/
    126119void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel, double* index, int nsegs,double* segments){
    127120       
     
    189182        *priftsegments=riftsegments;
    190183        *pnriftsegs=nriftsegs;
    191 }
    192 
    193 /******************************************************************************************************************************
    194                                    DetermineGridElementListOnOneSideOfRift
    195 ******************************************************************************************************************************/
    196 
     184}/*}}}*/
     185/*FUNCTION DetermineGridElementListOnOneSideOfRift{{{*/
    197186int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift, int segmentnumber, int nriftsegs, int* riftsegments, int node,double* index,int nel){
    198187
     
    257246        *pGridElementListOnOneSideOfRift=GridElementListOnOneSideOfRift;
    258247        return noerr;
    259 }
    260 
    261 /******************************************************************************************************************************
    262                                    UpdateSegments
    263 ******************************************************************************************************************************/
    264 
    265 int UpdateSegments(double** psegments,double** psegmentmarkerlist, int* pnsegs, double* index, double* x,double* y,int* riftsegments,int nriftsegs){
     248}/*}}}*/
     249/*FUNCTION UpdateSegments{{{*/
     250int UpdateSegments(double** psegments,double** psegmentmarkerlist, int* pnsegs, double* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel){
    266251
    267252        int noerr=1;
     
    284269        /*First, update the existing segments to the new nodes :*/
    285270        for (i=0;i<nriftsegs;i++){
    286                 el1=*(riftsegments+4*i+0);
    287                 el2=*(riftsegments+4*i+1);
     271                el1=riftsegments[4*i+0];
     272                el2=riftsegments[4*i+1];
    288273                for (j=0;j<nsegs;j++){
    289                         if (*(segments+3*j+2)==(el1+1)){
     274                        if (segments[3*j+2]==(el1+1)){
    290275                                /*segment j is the same as rift segment i.Let's update segments[j][:] using  element el1 and the corresponding rift segment.
    291276                                 *Because riftsegments does not represent a list of rift segments anymore (it got heavily modified in SplitElementsForRifts,
     
    293278                                for (k=0;k<3;k++){
    294279                                        if ((x[(int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+0)-1])){
    295                                                 *(segments+3*j+0)=*(index+el1*3+k);
     280                                                *(segments+3*j+0)=*(index+el1*3+k); _assert_(segments[3*j+0]<nods+1);
    296281                                                break;
    297282                                        }
     
    299284                                for (k=0;k<3;k++){
    300285                                        if ((x[(int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+1)-1])  && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+1)-1])){
    301                                                 *(segments+3*j+1)=*(index+el1*3+k);
     286                                                *(segments+3*j+1)=*(index+el1*3+k); _assert_(segments[3*j+1]<nods+1);
    302287                                                break;
    303288                                        }
     
    308293                                for (k=0;k<3;k++){
    309294                                        if ((x[(int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+0)-1])){
    310                                                 *(segments+3*(nsegs+i)+0)=*(index+el2*3+k);
     295                                                *(segments+3*(nsegs+i)+0)=*(index+el2*3+k); _assert_(segments[3*(nsegs+i)+0]<nods+1);
    311296                                                break;
    312297                                        }
     
    314299                                for (k=0;k<3;k++){
    315300                                        if ((x[(int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+1)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+1)-1])){
    316                                                 *(segments+3*(nsegs+i)+1)=*(index+el2*3+k);
     301                                                *(segments+3*(nsegs+i)+1)=*(index+el2*3+k); _assert_(segments[3*(nsegs+i)+1]<nods+1);
    317302                                                break;
    318303                                        }
     
    324309                                for (k=0;k<3;k++){
    325310                                        if ((x[(int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+0)-1])){
    326                                                 *(segments+3*j+0)=*(index+el2*3+k);
     311                                                *(segments+3*j+0)=*(index+el2*3+k); _assert_(segments[3*j+0]<nods+1);
    327312                                                break;
    328313                                        }
     
    330315                                for (k=0;k<3;k++){
    331316                                        if ((x[(int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+1)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+1)-1])){
    332                                                 *(segments+3*j+1)=*(index+el2*3+k);
     317                                                *(segments+3*j+1)=*(index+el2*3+k);_assert_(segments[3*j+1]<nods+1);
    333318                                                break;
    334319                                        }
     
    339324                                for (k=0;k<3;k++){
    340325                                        if ((x[(int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+0)-1])){
    341                                                 *(segments+3*(nsegs+i)+0)=*(index+el1*3+k);
     326                                                *(segments+3*(nsegs+i)+0)=*(index+el1*3+k);_assert_(segments[3*(nsegs+i)+0]<nods+1);
    342327                                                break;
    343328                                        }
     
    345330                                for (k=0;k<3;k++){
    346331                                        if ((x[(int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+1)-1]) && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+1)-1])){
    347                                                 *(segments+3*(nsegs+i)+1)=*(index+el1*3+k);
     332                                                *(segments+3*(nsegs+i)+1)=*(index+el1*3+k);_assert_(segments[3*(nsegs+i)+1]<nods+1);
    348333                                                break;
    349334                                        }
     
    360345       
    361346        return noerr;
    362 }
    363 
    364 /******************************************************************************************************************************
    365                                    pnpoly
    366 ******************************************************************************************************************************/
     347}/*}}}*/
     348/*FUNCTION pnpoly{{{*/
    367349int pnpoly(int npol, double *xp, double *yp, double x, double y) {
    368350        int i, j, c = 0;
     
    374356        }
    375357        return c;
    376 }
    377 
    378 /******************************************************************************************************************************
    379                                    IsInPoly
    380 ******************************************************************************************************************************/
    381 //void IsInPoly(double* in,double* xc,double* yc,int numnodes,double* x,double* y,int nods){
    382 //
    383 //      int i;
    384 //      double x0,y0;
    385 //
    386 //      /*Go through all nodes of the mesh:*/
    387 //      for (i=0;i<nods;i++){
    388 //              if (in[i]){
    389 //                      /*this node already is inside one of the contours, continue*/
    390 //                      continue;
    391 //              }
    392 //              /*pick up node: */
    393 //              x0=x[i];
    394 //              y0=y[i];
    395 //              if (pnpoly(numnodes,xc,yc,x0,y0)){
    396 //                      in[i]=1;
    397 //              }
    398 //      }
    399 //}
    400 
    401 /******************************************************************************************************************************
    402                                    FindElement
    403 ******************************************************************************************************************************/
    404 
     358}/*}}}*/
     359/*FUNCTION FindElement{{{*/
    405360int FindElement(double A,double B,double* index,int nel){
    406361
     
    414369        }
    415370        return el;
    416 }
    417 /******************************************************************************************************************************
    418                                    SplitRiftSegments
    419 ******************************************************************************************************************************/
    420 
    421 int SplitRiftSegments(double** psegments,double** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,double*** priftssegments,int numrifts){
     371}/*}}}*/
     372/*FUNCTION SplitRiftSegments{{{*/
     373int SplitRiftSegments(double** psegments,double** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,double*** priftssegments,int numrifts,int nods,int nel){
    422374
    423375        /*Using segment markers, wring out the rift segments from the segments. Rift markers are
     
    461413        for (i=0;i<numsegs;i++){
    462414                if (segmentmarkerlist[i]==1){
    463                         *(new_segments+3*counter+0)=*(segments+3*i+0);
    464                         *(new_segments+3*counter+1)=*(segments+3*i+1);
    465                         *(new_segments+3*counter+2)=*(segments+3*i+2);
     415                        new_segments[3*counter+0]=segments[3*i+0];
     416                        new_segments[3*counter+1]=segments[3*i+1];
     417                        new_segments[3*counter+2]=segments[3*i+2];
    466418                        new_segmentmarkers[counter]=segmentmarkerlist[i];
    467419                        counter++;
     
    484436                for (j=0;j<numsegs;j++){
    485437                        if (segmentmarkerlist[j]==(2+i)){
    486                                 *(riftsegment+3*counter+0)=*(segments+3*j+0);
    487                                 *(riftsegment+3*counter+1)=*(segments+3*j+1);
    488                                 *(riftsegment+3*counter+2)=*(segments+3*j+2);
     438                                riftsegment[3*counter+0]=segments[3*j+0];_assert_(riftsegment[3*counter+0]<nods+1);
     439                                riftsegment[3*counter+1]=segments[3*j+1];_assert_(riftsegment[3*counter+1]<nods+1);
     440                                riftsegment[3*counter+2]=segments[3*j+2];_assert_(riftsegment[3*counter+2]<nel+1);
    489441                                counter++;
    490442                        }
     
    504456        *priftsnumsegs=riftsnumsegs;
    505457        return noerr;
    506 }
    507 
    508 /******************************************************************************************************************************
    509                                    PairRiftElements
    510 ******************************************************************************************************************************/
    511 
     458}/*}}}*/
     459/*FUNCTION PairRiftElements{{{*/
    512460int PairRiftElements(int** priftsnumpairs, double*** priftspairs,int numrifts,int* riftsnumsegments, double** riftssegments,double* x,double* y){
    513461
     
    558506
    559507        return noerr;
    560 }
    561 
    562 
    563 /******************************************************************************************************************************
    564                                    RemoveRifts
    565 ******************************************************************************************************************************/
    566 
    567 double dabs(double x){
    568         if (x<0)x=-x;
    569         return x;
    570 }
     508}/*}}}*/
     509/*FUNCTION RemoveRifts{{{*/
    571510int RemoveRifts(double** pindex,double** px,double** py,int* pnods,double** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,double** rifts1segments,double** rifts1pairs,int nel){
    572511
     
    615554                if (y[i]<ymin)ymin=y[i];
    616555        }
    617         xmin=xmin-dabs(xmin);
    618         ymin=ymin-dabs(ymin);
     556        xmin=xmin-fabs(xmin);
     557        ymin=ymin-fabs(ymin);
    619558
    620559        /*Initialize two arrays, one for nodes that are going to be merged, the other with corresponding nodes being merge into: */
     
    751690
    752691        return noerr;
    753 }
    754 
    755 /******************************************************************************************************************************
    756                                    IsRiftPresent
    757 ******************************************************************************************************************************/
    758 
     692}/*}}}*/
     693/*FUNCTION IsRiftPresent{{{*/
    759694int IsRiftPresent(int* priftflag,int* pnumrifts, double* segmentmarkerlist,int nsegs){
    760695
     
    783718
    784719        return noerr;
    785 }
    786 
    787 /******************************************************************************************************************************
    788                                    OrderRifts
    789 ******************************************************************************************************************************/
    790 
    791 int OrderRifts(double** priftstips, double** riftssegments,double** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y){
     720}/*}}}*/
     721/*FUNCTION OrderRifts{{{*/
     722int OrderRifts(double** priftstips, double** riftssegments,double** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels){
    792723       
    793724        int noerr=1;
     
    811742        /*output: */
    812743        double* riftstips=NULL;
    813 
    814744
    815745        /*Allocate byproduct of this routine, riftstips: */
     
    822752                numsegs=riftsnumsegments[i];
    823753       
    824                        
    825754                /*Allocate copy of riftsegments and riftpairs,
    826755                 *as well as ordering vector: */
     
    847776                        }
    848777                        /* Make sure node3 faces node1 and node4 faces node2: */
    849                         if ((x[node1]==x[node4]) && (y[node1]==y[node4])){
     778                        _assert_(node1<nods+1 && node4<nods+1);
     779                        _assert_(node1>0 && node4>0);
     780                        if ((x[node1-1]==x[node4-1]) && (y[node1-1]==y[node4-1])){
    850781                                /*Swap node3 and node4:*/
    851782                                temp_node=node3;
     
    943874        *priftstips=riftstips;
    944875        return noerr;
    945 }
    946 
    947 /******************************************************************************************************************************
    948                                    PenaltyPairs
    949 ******************************************************************************************************************************/
    950 
     876}/*}}}*/
     877/*FUNCTION PenaltyPairs{{{*/
    951878int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts,double** riftssegments,
    952879                int* riftsnumsegs,double** riftspairs,double* riftstips,double* x,double* y){
  • issm/trunk/src/c/shared/TriMesh/trimesh.h

    r11527 r12330  
    66#define _SHARED_TRIMESH_H
    77
    8 
    98#include <stdio.h>
    109#include <math.h>
    1110
    12 
    13 
    1411//#define REAL double //took  it out because it may conflict with stdlib.h defines. put back if necessary
    15 
    1612int AssociateSegmentToElement(double** psegments,int nseg, double* index,int nel);
    1713int OrderSegments(double** psegments,int nseg, double* index,int nel);
    18                
    1914int GridInsideHole(double* px0,double* py0,int n,double* x,double* y);
    2015int FindElement(double A,double B,double* index,int nel);
    21 
    2216int SplitMeshForRifts(int* pnel,double** pindex,int* pnods,double** px,double** py,int* pnsegs,double** psegments,double** psegmentmarkerlist);
    23 
    2417int IsGridOnRift(int* riftsegments, int nriftsegs, int node);
    2518int GridElementsList(int** pGridElements, int* pNumGridElements,int node,double * index,int nel);
     
    2821void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel, double* index, int nsegs,double* segments);
    2922int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift, int segmentnumber, int nriftsegs, int* riftsegments, int node,double* index,int nel);
    30 int UpdateSegments(double** psegments,double** psegmentmarkerlist, int* pnsegs, double* index, double* x,double* y,int* riftsegments,int nriftsegs);
     23int UpdateSegments(double** psegments,double** psegmentmarkerlist, int* pnsegs, double* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel);
    3124int pnpoly(int npol, double *xp, double *yp, double x, double y);
    3225int FindElement(double A,double B,double* index,int nel);
    3326int RemoveRifts(double** pindex,double** px,double** py,int* pnods,double** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,double** rifts1segments,double** rifts1pairs,int nel);
    3427int IsRiftPresent(int* priftflag,int* pnumrifts, double* segmentmarkerlist,int nsegs);
    35 int SplitRiftSegments(double** psegments,double** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,double*** priftssegments,int numrifts);
    36 int OrderRifts(double** priftstips, double** riftssegments,double** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y);
     28int SplitRiftSegments(double** psegments,double** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,double*** priftssegments,int numrifts,int nods,int nels);
     29int OrderRifts(double** priftstips, double** riftssegments,double** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels);
    3730int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts,double**  riftssegments,
    3831                int* riftsnumsegments,double** riftspairs,double* riftstips,double* x,double* y);
    39 
    4032int RemoveCornersFromRifts(double** pindex,int* pnel,double** px,double** py,int* pnods, double* segments,double* segmentmarkers,int num_seg);
    4133int PairRiftElements(int** priftsnumpairs, double*** priftspairs,int numrifts,int* riftsnumsegments, double** riftssegments,double* x,double* y);
    4234
    43 
    4435#endif  /* _SHARED_TRIMESH_H */
  • issm/trunk/src/c/shared/Wrapper/wrappershared.h

    r11995 r12330  
    88#include "../../objects/objects.h"
    99
    10 #ifdef _SERIAL_
    1110int ModuleBoot(void);
    1211int ModuleEnd(void);
    13 #endif
    1412
    1513#endif
  • issm/trunk/src/c/shared/shared.h

    r11995 r12330  
    88
    99#include "Alloc/alloc.h"
     10#include "Alloc/alloc_module.h"
    1011#include "Exceptions/exceptions.h"
    1112#include "Exp/exp.h"
  • issm/trunk/src/c/solutions/ProcessArguments.cpp

    r10568 r12330  
    44
    55#include <stdio.h>
     6#include <cstring>
     7
    68#include "../shared/shared.h"
    79#include "../include/include.h"
  • issm/trunk/src/c/solutions/issm.cpp

    r11995 r12330  
    3535        int      ierr;
    3636
    37         MODULEBOOT();
    38 
    39         #ifndef _PARALLEL_
    40         _error_(" parallel executable was compiled without support of parallel libraries!");
    41         #endif
     37        ISSMBOOT();
    4238
    4339        /*Initialize environments: Petsc, MPI, etc...: */
     
    4642        if(ierr) _error_("Could not initialize Petsc");
    4743        #else
     44        #ifdef _HAVE_MPI_
    4845        MPI_Init(&argc,&argv);
    4946        #endif
     47        #endif
    5048
     49        #ifdef _HAVE_MPI_
    5150        MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime();
     51        #else
     52        start=(double)clock();
     53        #endif
    5254
    5355        /*Size and rank: */
     56        #ifdef _HAVE_MPI_
    5457        MPI_Comm_rank(MPI_COMM_WORLD,&my_rank); 
    5558        MPI_Comm_size(MPI_COMM_WORLD,&num_procs);
     59        #endif
    5660
    5761        /*First process inputs*/
     
    6670       
    6771        /*Create femmodel, using input file: */
     72        #ifdef _HAVE_MPI_
    6873        MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime();
     74        #else
     75        start_init=(double)clock();
     76        #endif
    6977        femmodel=new FemModel(binfilename,outbinfilename,solution_type,analyses,numanalyses);
    7078       
     
    8694        femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
    8795        femmodel->parameters->FindParam(&tao_analysis,InversionTaoEnum);
     96        #ifdef _HAVE_MPI_
    8897        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
     98        #else
     99        finish_init=(double)clock();
     100        #endif
    89101
    90102        _printf_(true,"call computational core:\n");
     103        #ifdef _HAVE_MPI_
    91104        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
     105        #else
     106        start_core=(double)clock();
     107        #endif
     108       
    92109        if(dakota_analysis){
    93110                #ifdef _HAVE_DAKOTA_
     
    110127                solutioncore(femmodel);
    111128        }
     129        #ifdef _HAVE_MPI_
    112130        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    113 
     131        #else
     132        finish_core=(double)clock();
     133        #endif
     134       
    114135        _printf_(true,"write results to disk:\n");
    115136        OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
     
    131152
    132153        /*Get finish time and close*/
     154        #ifdef _HAVE_MPI_
    133155        MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( );
    134156        _printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",finish_init-start_init);
    135157        _printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",finish_core-start_core);
    136158        _printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600),int(int(finish-start)%3600/60),int(finish-start)%60);
     159        #else
     160        finish=(double)clock();
     161        _printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",(finish_init-start_init)/CLOCKS_PER_SEC);
     162        _printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",(finish_core-start_core)/CLOCKS_PER_SEC);
     163        _printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600/CLOCKS_PER_SEC),int(int((finish-start)/CLOCKS_PER_SEC)%3600/60),(int(finish-start)/CLOCKS_PER_SEC)%60);
     164        #endif
    137165       
     166               
    138167       
     168        #ifdef _HAVE_PETSC_
    139169        _printf_(true,"closing MPI and Petsc\n");
    140         #ifdef _HAVE_PETSC_
    141170        PetscFinalize();
    142171        #else
     172        #ifdef _HAVE_MPI_
     173        _printf_(true,"closing MPI and Petsc\n");
    143174        MPI_Finalize();
     175        #endif
    144176        #endif
    145177       
    146178        /*end module: */
    147         MODULEEND();
     179        ISSMEND();
    148180
    149181        return 0; //unix success return;
    150182}
    151 
  • issm/trunk/src/c/solvers/solver_newton.cpp

    r11995 r12330  
    6767                convergence(&converged,Kff,pf,uf,old_uf,femmodel->parameters);
    6868                xdelete(&Kff); xdelete(&pf);
    69                 if(converged==true) break;
     69                if(converged==true){   
     70                        bool max_iteration_state=false;
     71                        int tempStep=1;
     72                        double tempTime=1.0;
     73                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
     74                        break;
     75                }
    7076                if(count>=max_nonlinear_iterations){
    71                         _printf_(true,"   maximum number of iterations (%i) exceeded\n",max_nonlinear_iterations);
     77                        _printf_(true,"   maximum number of Newton iterations (%i) exceeded\n",max_nonlinear_iterations);
     78                        bool max_iteration_state=true;
     79                        int tempStep=1;
     80                        double tempTime=1.0;
     81                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
    7282                        break;
    7383                }
  • issm/trunk/src/c/solvers/solver_nonlinear.cpp

    r11995 r12330  
    8585                /*Increase count: */
    8686                count++;
    87                 if(converged==true)break;
     87                if(converged==true){
     88                        bool max_iteration_state=false;
     89                        int tempStep=1;
     90                        double tempTime=1.0;
     91                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
     92                        break;
     93                }
    8894                if(count>=max_nonlinear_iterations){
    89                         _printf_(true,"   maximum number of iterations (%i) exceeded\n",max_nonlinear_iterations);
     95                        _printf_(true,"   maximum number of nonlinear iterations (%i) exceeded\n",max_nonlinear_iterations);
    9096                        converged=true;
    91                 InputUpdateFromConstantx( femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,converged,ConvergedEnum);
    92                 InputUpdateFromSolutionx( femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,ug);
     97                        InputUpdateFromConstantx( femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,converged,ConvergedEnum);
     98                        InputUpdateFromSolutionx( femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,ug);               
     99                        bool max_iteration_state=true;
     100                        int tempStep=1;
     101                        double tempTime=1.0;
     102                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
    93103                        break;
    94104                }
  • issm/trunk/src/c/toolkits/issm/SeqMat.cpp

    r11995 r12330  
    9292}
    9393/*}}}*/
    94 
    95 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    96 /*FUNCTION SeqMat::ToMatlabMatrix{{{1*/
    97 mxArray* SeqMat::ToMatlabMatrix(void){
    98 
    99         /*Intermediary: */
    100         double* buffer=NULL;
    101         mxArray* pfield=NULL;
    102        
    103         /*output: */
    104         mxArray* dataref=NULL;
    105 
    106         /*copy vector into a new buffer: */
    107         if(this->M*this->N){
    108                 buffer=(double*)xmalloc(this->M*this->N*sizeof(double));
    109                 memcpy(buffer,this->matrix,M*N*sizeof(double));
    110 
    111                 pfield=mxCreateDoubleMatrix(0,0,mxREAL);
    112                 mxSetM(pfield,this->N);
    113                 mxSetN(pfield,this->M);
    114                 mxSetPr(pfield,buffer);
    115                
    116                 //transpose the matrix, written directly to matlab! from C to matlab.
    117                 mexCallMATLAB(1,&dataref, 1, &pfield, "transpose");
    118         }
    119         else dataref=mxCreateDoubleMatrix(0,0,mxREAL);
    120 
    121         /*do not erase buffer!: */
    122         return dataref;
    123 
    124 }
    125 
    126 
    127        
    128        
    129 /*}}}*/
    130 /*FUNCTION MatlabMatrixToSeqMat{{{1*/
    131 SeqMat* MatlabMatrixToSeqMat(const mxArray* dataref){
    132 
    133         SeqMat* output=NULL;
    134 
    135         output=new SeqMat();
    136         MatlabMatrixToDoubleMatrix(&output->matrix,&output->M,&output->N,dataref);
    137         return output;
    138 
    139 }
    140 /*}}}*/
    141 #endif
    14294/*FUNCTION SeqMat::Assemble{{{1*/
    14395void SeqMat::Assemble(void){
  • issm/trunk/src/c/toolkits/issm/SeqMat.h

    r11995 r12330  
    1515
    1616#include "../toolkitsenums.h"
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include "mex.h"
    20 #endif
    2117
    2218/*}}}*/
     
    4036                /*SeqMat specific routines {{{1*/
    4137                void Echo(void);
    42                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    43                 mxArray* ToMatlabMatrix(void);
    44                 #endif
    4538                void Assemble(void);
    4639                double Norm(NormMode norm_type);
     
    5649};
    5750               
    58 /*API :*/
    59 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    60 SeqMat*  MatlabMatrixToSeqMat(const mxArray* dataref);
    61 #endif
    62 
    6351#endif //#ifndef _SEQMAT_H_
  • issm/trunk/src/c/toolkits/issm/SeqVec.cpp

    r11995 r12330  
    6666/*}}}*/
    6767
    68 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    69 /*FUNCTION SeqVec::ToMatlabVector{{{1*/
    70 mxArray* SeqVec::ToMatlabVector(void){
    71 
    72         double* buffer=NULL;
    73        
    74         mxArray* dataref=NULL;
    75 
    76         /*copy vector into a new buffer: */
    77         if(this->M){
    78                 buffer=(double*)xmalloc(this->M*sizeof(double));
    79                 memcpy(buffer,vector,M*sizeof(double));
    80 
    81                 dataref = mxCreateDoubleMatrix(0,0,mxREAL);
    82                 mxSetM(dataref,this->M);
    83                 mxSetN(dataref,1);
    84                 mxSetPr(dataref,buffer);       
    85         }
    86         else dataref = mxCreateDoubleMatrix(0,0,mxREAL);
    87 
    88 
    89         /*do not erase buffer!: */
    90         return dataref;
    91 
    92 }
    93 /*}}}*/
    94 /*FUNCTION MatlabVectorToSeqVec{{{1*/
    95 SeqVec* MatlabVectorToSeqVec(const mxArray* dataref){
    96 
    97         SeqVec* output=NULL;
    98 
    99         output=new SeqVec();
    100         MatlabVectorToDoubleVector(&output->vector,&output->M,dataref);
    101         return output;
    102 
    103 }
    104 /*}}}*/
    105 #endif
    10668/*FUNCTION SeqVec::Assemble{{{1*/
    10769void SeqVec::Assemble(void){
  • issm/trunk/src/c/toolkits/issm/SeqVec.h

    r11995 r12330  
    1515
    1616#include "../toolkitsenums.h"
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include "mex.h"
    20 #endif
    2117
    2218/*}}}*/
     
    3733                /*SeqVec specific routines {{{1*/
    3834                void Echo(void);
    39                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    40                 mxArray* ToMatlabVector(void);
    41                 #endif
    4235                void Assemble(void);
    4336                void SetValues(int ssize, int* list, double* values, InsMode mode);
     
    5952};
    6053
    61 
    62 /*API :*/
    63 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    64 SeqVec*  MatlabVectorToSeqVec(const mxArray* dataref);
    65 #endif
    66 
    6754#endif //#ifndef _SEQVEC_H_
  • issm/trunk/src/c/toolkits/petsc/patches/MatInvert.cpp

    r11995 r12330  
    5555        MatAssemblyBegin(inv,MAT_FINAL_ASSEMBLY);
    5656        MatAssemblyEnd(inv,MAT_FINAL_ASSEMBLY);
    57 
    58         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    59                 MatConvert(inv, MATSEQAIJ,MAT_REUSE_MATRIX,&inv);
    60         #else
    61                 MatConvert(inv, MATMPIAIJ,MAT_REUSE_MATRIX,&inv);
    62         #endif
     57               
     58        MatConvert(inv, MATMPIAIJ,MAT_REUSE_MATRIX,&inv);
    6359       
    6460        /*Free ressources:*/
  • issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp

    r11995 r12330  
    6868
    6969        #ifdef _HAVE_PETSCDEV_
    70         MatCreateAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
     70        if(sparsity==1){
     71                MatCreateDense(MPI_COMM_WORLD,m,n,M,N,NULL,&outmatrix);
     72        }
     73        else{
     74                MatCreateAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
     75        }
    7176        #else
    7277        MatCreateMPIAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
  • issm/trunk/src/c/toolkits/petsc/patches/petscpatches.h

    r11995 r12330  
    1515
    1616class Parameters;
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include "mex.h"
    20 int MatlabMatrixToPetscMatrix(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
    21 int MatlabVectorToPetscVector(Vec* pvector,int* pvector_rows,const mxArray* mxvector);
    22 int PetscMatrixToMatlabMatrix(mxArray** pdataref,Mat matrix);
    23 int PetscVectorToMatlabVector(mxArray** pdataref,Vec vector);
    24 #endif
    2517
    2618Vec NewVec(int size,bool fromlocalsize=false);
     
    5143MatType ISSMToPetscMatrixType(MatrixType type);
    5244
     45void PetscMatrixToDoubleMatrix(double** pmatrix, int* prows, int* pcols,Mat matrix);
     46void PetscVectorToDoubleVector(double** pvector, int* prows, Vec vector);
     47
    5348#endif
  • issm/trunk/src/c/toolkits/python/pythonincludes.h

    r11995 r12330  
    77
    88
     9#ifdef HAVE_CONFIG_H
     10        #include <config.h>
     11#else
     12#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
     13#endif
     14
     15#if _PYTHON_MAJOR_ == 2
     16#undef NPY_NO_DEPRECATED_API
     17#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
     18#else
     19#define NPY_NO_DEPRECATED_API
     20#endif
     21
    922#include "Python.h"
    1023#include "arrayobject.h"
    11 
    12 
    1324
    1425#ifdef _HAVE_BOOST_
  • issm/trunk/src/c/toolkits/toolkits.h

    r11995 r12330  
    1212#endif
    1313
    14 #if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
     14#ifdef _HAVE_PYTHON_
    1515#include "./python/pythonincludes.h"
    1616#endif
     
    2020#endif
    2121
    22 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    23 #include "./matlab/matlabincludes.h"
     22#ifdef _HAVE_MPI_
     23#include "./mpi/mpiincludes.h"
    2424#endif
    2525
     26#ifdef _HAVE_METIS_
     27#include "./metis/metisincludes.h"
     28#endif
    2629
    27 #include "./mpi/mpiincludes.h"
    28 #include "./metis/metisincludes.h"
    2930#include "./triangle/triangleincludes.h"
    30 #include "./double/double.h"
    3131#include "./toolkitsenums.h"
    3232#include "./issm/issmtoolkit.h"
  • issm/trunk/src/c/toolkits/triangle/triangleincludes.h

    r2214 r12330  
    66#define _TRIANGLE_INCLUDES_H_
    77
    8 #ifdef _SERIAL_
    9 
    108#ifdef _C_ //only valid for iso C, not C++
    119/*Triangle includes: */
     
    1311#endif //#ifdef _C_
    1412
    15 #endif //ifdef _SERIAL_
    16 
    1713
    1814#endif
Note: See TracChangeset for help on using the changeset viewer.