Changeset 6411


Ignore:
Timestamp:
10/25/10 08:27:35 (14 years ago)
Author:
Mathieu Morlighem
Message:

Got rid of EnumIsElement and EnumIsLoad (good riddance)

Location:
issm/trunk/src/c
Files:
1 deleted
12 edited

Legend:

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

    r6200 r6411  
    536536}
    537537/*}}}*/
    538 /*FUNCTION DataSet::Configure{{{1*/
    539 void DataSet::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    540 
    541         vector<Object*>::iterator object;
    542         Element* element=NULL;
    543         Load* load=NULL;
    544         Node* node=NULL;
    545         Material* material=NULL;
    546 
    547         for ( object=objects.begin() ; object < objects.end(); object++ ){
    548 
    549                 if(EnumIsElement((*object)->Enum())){
    550 
    551                         element=(Element*)(*object);
    552                         element->Configure(elements,loads,nodes,materials,parameters);
    553                 }
    554                 if(EnumIsLoad((*object)->Enum())){
    555                         load=(Load*)(*object);
    556                         load->Configure(elements,loads,nodes,vertices,materials,parameters);
    557                 }
    558 
    559                 if((*object)->Enum()==NodeEnum){
    560                         node=(Node*)(*object);
    561                         node->Configure(nodes,vertices);
    562                 }
    563                 if (EnumIsMaterial((*object)->Enum())){
    564                         material=(Material*)(*object);
    565                         material->Configure(elements);
    566                 }
    567         }
    568 
    569 }
    570 /*}}}*/
    571 /*FUNCTION DataSet::SetCurrentConfiguration{{{1*/
    572 void DataSet::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    573 
    574         vector<Object*>::iterator object;
    575         Element* element=NULL;
    576         Load* load=NULL;
    577         Node* node=NULL;
    578 
    579         for ( object=objects.begin() ; object < objects.end(); object++ ){
    580 
    581                 if(EnumIsElement((*object)->Enum())){
    582 
    583                         element=(Element*)(*object);
    584                         element->SetCurrentConfiguration(elements,loads,nodes,materials,parameters);
    585                 }
    586                 if(EnumIsLoad((*object)->Enum())){
    587                         load=(Load*)(*object);
    588                         load->SetCurrentConfiguration(elements,loads,nodes,vertices,materials,parameters);
    589                 }
    590 
    591                 if((*object)->Enum()==NodeEnum){
    592                         node=(Node*)(*object);
    593                         node->SetCurrentConfiguration(nodes,vertices);
    594                 }
    595         }
    596 
    597 }
    598 /*}}}*/
  • issm/trunk/src/c/Container/DataSet.h

    r6372 r6411  
    5555                int   Size();
    5656                void  clear();
    57                 void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    58                 void  SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    5957                Object* GetObjectByOffset(int offset);
    6058                Object* GetObjectById(int* poffset,int eid);
  • issm/trunk/src/c/Container/Elements.cpp

    r6372 r6411  
    4545
    4646/*Object management*/
     47/*FUNCTION Elements::Configure{{{1*/
     48void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
     49
     50        vector<Object*>::iterator object;
     51        Element* element=NULL;
     52
     53        for ( object=objects.begin() ; object < objects.end(); object++ ){
     54
     55                element=(Element*)(*object);
     56                element->Configure(elements,loads,nodes,materials,parameters);
     57
     58        }
     59
     60}
     61/*}}}*/
    4762/*FUNCTION Elements::ProcessResultsUnits{{{1*/
    4863void Elements::ProcessResultsUnits(void){
    4964
    50         int i;
    51 
    5265        //Process results to be output in the correct units
    53         for(i=0;i<this->Size();i++){
     66        for(int i=0;i<this->Size();i++){
    5467                Element* element=(Element*)this->GetObjectByOffset(i);
    5568                element->ProcessResultsUnits();
     
    6073void Elements::DeleteResults(void){
    6174       
    62         int i;
    63 
    64         for (i=0;i<this->Size();i++){
     75        for (int i=0;i<this->Size();i++){
    6576                Element* element=(Element*)this->GetObjectByOffset(i);
    6677                element->DeleteResults();
    6778        }
    68 }
    69 /*}}}*/
    70 /*FUNCTION Elements::ToResults{{{1*/
    71 void Elements::ToResults(Results* results,Parameters* parameters,int step, double time){
    72 
    73         /*output: */
    74         Patch* patch=NULL;
    75 
    76         /*I/O strategy: */
    77         bool   io_gather=true; //the default
    78 
    79         /*Recover parameters: */
    80         parameters->FindParam(&io_gather,IoGatherEnum);
    81 
    82 
    83         /*create patch object out of all results in this dataset: */
    84         patch=this->ResultsToPatch();
    85 
    86         /*Gather onto master cpu 0, if needed: */
    87         #ifdef _PARALLEL_
    88         if(io_gather)patch->MPI_Gather();
    89         #endif
    90        
    91         /*create result object and add to results dataset:*/
    92         if (patch->maxvertices && patch->maxnodes){
    93                 results->AddObject(new IntExternalResult(results->Size()+1,PatchVerticesEnum,patch->maxvertices,step,time));
    94                 results->AddObject(new IntExternalResult(results->Size()+1,PatchNodesEnum,   patch->maxnodes,step,time));
    95                 results->AddObject(new DoubleMatExternalResult(results->Size()+1,PatchEnum,patch->values,patch->numrows,patch->numcols,step,time));
    96         }
    97 
    98         /*Free ressources:*/
    99         delete patch;
    100 
    10179}
    10280/*}}}*/
     
    178156}
    179157/*}}}*/
     158/*FUNCTION Elements::SetCurrentConfiguration{{{1*/
     159void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
     160
     161        vector<Object*>::iterator object;
     162        Element* element=NULL;
     163
     164        for ( object=objects.begin() ; object < objects.end(); object++ ){
     165
     166                element=(Element*)(*object);
     167                element->SetCurrentConfiguration(elements,loads,nodes,materials,parameters);
     168
     169        }
     170
     171}
     172/*}}}*/
     173/*FUNCTION Elements::ToResults{{{1*/
     174void Elements::ToResults(Results* results,Parameters* parameters,int step, double time){
     175
     176        /*output: */
     177        Patch* patch=NULL;
     178
     179        /*I/O strategy: */
     180        bool   io_gather=true; //the default
     181
     182        /*Recover parameters: */
     183        parameters->FindParam(&io_gather,IoGatherEnum);
     184
     185
     186        /*create patch object out of all results in this dataset: */
     187        patch=this->ResultsToPatch();
     188
     189        /*Gather onto master cpu 0, if needed: */
     190#ifdef _PARALLEL_
     191        if(io_gather)patch->MPI_Gather();
     192#endif
     193
     194        /*create result object and add to results dataset:*/
     195        if (patch->maxvertices && patch->maxnodes){
     196                results->AddObject(new IntExternalResult(results->Size()+1,PatchVerticesEnum,patch->maxvertices,step,time));
     197                results->AddObject(new IntExternalResult(results->Size()+1,PatchNodesEnum,   patch->maxnodes,step,time));
     198                results->AddObject(new DoubleMatExternalResult(results->Size()+1,PatchEnum,patch->values,patch->numrows,patch->numcols,step,time));
     199        }
     200
     201        /*Free ressources:*/
     202        delete patch;
     203
     204}
     205/*}}}*/
  • issm/trunk/src/c/Container/Elements.h

    r6372 r6411  
    2727                /*}}}*/
    2828                /*numerics: {{{1*/
     29                void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
     30                void DeleteResults(void);
    2931                void ProcessResultsUnits(void);
    30                 void DeleteResults(void);
     32                void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    3133                void ToResults(Results* results,Parameters* parameters,int step, double time);
    3234                Patch* ResultsToPatch(void);
     
    3537};
    3638
    37 
    38 
    3939#endif //ifndef _ELEMENTS_H_
    40 
  • issm/trunk/src/c/Container/Loads.cpp

    r5296 r6411  
    4343
    4444/*Numerics:*/
     45/*FUNCTION Loads::Configure{{{1*/
     46void Loads::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
     47
     48        vector<Object*>::iterator object;
     49        Load* load=NULL;
     50
     51        for ( object=objects.begin() ; object < objects.end(); object++ ){
     52
     53                load=(Load*)(*object);
     54                load->Configure(elements,loads,nodes,vertices,materials,parameters);
     55
     56        }
     57
     58}
     59/*}}}*/
    4560/*FUNCTION Loads::NumberOfLoads{{{1*/
    4661int Loads::NumberOfLoads(void){
     
    8095}
    8196/*}}}*/
     97/*FUNCTION Loads::SetCurrentConfiguration{{{1*/
     98void Loads::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
     99
     100        vector<Object*>::iterator object;
     101        Load* load=NULL;
     102
     103        for ( object=objects.begin() ; object < objects.end(); object++ ){
     104
     105                load=(Load*)(*object);
     106                load->SetCurrentConfiguration(elements,loads,nodes,vertices,materials,parameters);
     107
     108        }
     109
     110}
     111/*}}}*/
  • issm/trunk/src/c/Container/Loads.h

    r4458 r6411  
    2626                /*}}}*/
    2727                /*numerics: {{{1*/
     28                void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2829                int   NumberOfLoads(void);
    2930                void  OutputRifts(Vec riftproperties);
     31                void  SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    3032                /*}}}*/
    3133
    3234};
    3335
    34 
    35 
    3636#endif //ifndef _LOADS_H_
    37 
  • issm/trunk/src/c/Container/Materials.cpp

    r4218 r6411  
    4343
    4444/*Object management*/
     45/*FUNCTION Materials::Configure{{{1*/
     46void Materials::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
     47
     48        vector<Object*>::iterator object;
     49        Material* material=NULL;
     50
     51        for ( object=objects.begin() ; object < objects.end(); object++ ){
     52
     53                material=(Material*)(*object);
     54                material->Configure(elements);
     55
     56        }
     57
     58}
     59/*}}}*/
  • issm/trunk/src/c/Container/Materials.h

    r6372 r6411  
    2525                /*}}}*/
    2626                /*numerics: {{{1*/
     27                void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2728                /*}}}*/
    2829
     
    3031
    3132#endif //ifndef _MATERIALS_H_
    32 
  • issm/trunk/src/c/Container/Nodes.cpp

    r5786 r6411  
    4343
    4444/*Numerics*/
     45/*FUNCTION Nodes::Configure{{{1*/
     46void Nodes::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
     47
     48        vector<Object*>::iterator object;
     49        Node* node=NULL;
     50
     51        for ( object=objects.begin() ; object < objects.end(); object++ ){
     52
     53                node=(Node*)(*object);
     54                node->Configure(nodes,vertices);
     55
     56        }
     57
     58}
     59/*}}}*/
    4560/*FUNCTION Nodes::DistributeDofs{{{1*/
    4661void  Nodes::DistributeDofs(int analysis_type,int setenum){
     
    217232}
    218233/*}}}*/
     234/*FUNCTION Nodes::MaxNumDofs{{{1*/
     235int   Nodes::MaxNumDofs(int analysis_type,int setenum){
     236
     237        int i;
     238        int   max=0;
     239        int   allmax;
     240        int   numdofs=0;
     241
     242        /*Now go through all nodes, and get how many dofs they own, unless they are clone nodes: */
     243        for(i=0;i<this->Size();i++){
     244
     245                Node* node=(Node*)this->GetObjectByOffset(i);
     246
     247                /*Check that this node corresponds to our analysis currently being carried out: */
     248                if (node->InAnalysis(analysis_type)){
     249
     250                        numdofs=node->GetNumberOfDofs(NoneApproximationEnum,setenum);
     251                        if (numdofs>max)max=numdofs;
     252                }
     253        }
     254
     255#ifdef _PARALLEL_
     256        /*Grab max of all cpus: */
     257        MPI_Allreduce ( (void*)&max,(void*)&allmax,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
     258        max=allmax;
     259#endif
     260
     261        return max;
     262}
     263/*}}}*/
    219264/*FUNCTION Nodes::NumberOfDofs{{{1*/
    220265int   Nodes::NumberOfDofs(int analysis_type,int setenum){
     
    336381}
    337382/*}}}*/
    338 /*FUNCTION Nodes::MaxNumDofs{{{1*/
    339 int   Nodes::MaxNumDofs(int analysis_type,int setenum){
    340 
    341         int i;
    342         int   max=0;
    343         int   allmax;
    344         int   numdofs=0;
    345 
    346         /*Now go through all nodes, and get how many dofs they own, unless they are clone nodes: */
    347         for(i=0;i<this->Size();i++){
    348 
    349                 Node* node=(Node*)this->GetObjectByOffset(i);
    350 
    351                 /*Check that this node corresponds to our analysis currently being carried out: */
    352                 if (node->InAnalysis(analysis_type)){
    353 
    354                         numdofs=node->GetNumberOfDofs(NoneApproximationEnum,setenum);
    355                         if (numdofs>max)max=numdofs;
    356                 }
    357         }
    358 
    359         #ifdef _PARALLEL_
    360         /*Grab max of all cpus: */
    361         MPI_Allreduce ( (void*)&max,(void*)&allmax,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    362         max=allmax;
    363         #endif
    364 
    365         return max;
    366 }
    367 /*}}}*/
     383/*FUNCTION Nodes::SetCurrentConfiguration{{{1*/
     384void Nodes::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
     385
     386        vector<Object*>::iterator object;
     387        Node* node=NULL;
     388
     389        for ( object=objects.begin() ; object < objects.end(); object++ ){
     390
     391                node=(Node*)(*object);
     392                node->SetCurrentConfiguration(nodes,vertices);
     393
     394        }
     395
     396}
     397/*}}}*/
  • issm/trunk/src/c/Container/Nodes.h

    r5772 r6411  
    1919                /*}}}*/
    2020                /*numerics: {{{1*/
     21                void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2122                void  DistributeDofs(int analysis_type,int SETENUM);
    2223                void  FlagClones(int analysis_type);
    2324                void  FlagNodeSets(Vec pv_g, Vec pv_f, Vec pv_s,int analysis_type);
     25                int   MaxNumDofs(int analysis_type,int setenum);
    2426                int   NumberOfDofs(int analysis_type,int setenum);
    2527                int   NumberOfNodes(int analysis_type);
    2628                int   NumberOfNodes(void);
    2729                void  Ranks(int* ranks,int analysis_type);
    28                 int   MaxNumDofs(int analysis_type,int setenum);
     30                void  SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2931                /*}}}*/
    3032
    3133};
    3234
    33 
    34 
    3535#endif //ifndef _NODES_H_
    36 
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r6374 r6411  
    390390
    391391/*Functions on enums: */
    392 int   EnumIsElement(int en);
    393 int   EnumIsLoad(int en);
    394 int   EnumIsMaterial(int en);
    395392char *EnumToString(int enum_type);
    396393int   StringToEnum(char *string);
  • issm/trunk/src/c/Makefile.am

    r6372 r6411  
    341341                                        ./io/pfclose.cpp\
    342342                                        ./EnumDefinitions/EnumDefinitions.h\
    343                                         ./EnumDefinitions/EnumDefinitions.cpp\
    344343                                        ./EnumDefinitions/EnumToString.cpp\
    345344                                        ./EnumDefinitions/StringToEnum.cpp\
     
    913912                                        ./io/ParsePetscOptions.cpp\
    914913                                        ./EnumDefinitions/EnumDefinitions.h\
    915                                         ./EnumDefinitions/EnumDefinitions.cpp\
    916914                                        ./EnumDefinitions/EnumToString.cpp\
    917915                                        ./EnumDefinitions/StringToEnum.cpp\
Note: See TracChangeset for help on using the changeset viewer.