Ignore:
Timestamp:
07/24/12 10:36:19 (13 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 12703

File:
1 edited

Legend:

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

    r12330 r12706  
    2020
    2121/*Object constructors and destructor*/
    22 /*FUNCTION FemModel::constructor {{{1*/
     22/*FUNCTION FemModel::constructor {{{*/
    2323FemModel::FemModel(char* inputfilename, char* outputfilename, const int in_solution_type,const int* analyses,const int nummodels){
    2424
    2525        /*intermediary*/
    26         int i;
    27         int analysis_type;
    28         FILE* IOMODEL;
    29         extern int my_rank;
     26        int         i;
     27        int         analysis_type;
     28        FILE       *IOMODEL = NULL;
     29        extern int  my_rank;
    3030
    3131        /*Open input file on cpu 0: */
    32         if(my_rank==0) IOMODEL= pfopen(inputfilename ,"rb");
     32        if(my_rank==0) IOMODEL = pfopen(inputfilename ,"rb");
    3333
    3434        /*Initialize internal data: */
     
    3939       
    4040        /*Dynamically allocate whatever is a list of length nummodels: */
    41         analysis_type_list=(int*)xmalloc(nummodels*sizeof(int));
     41        analysis_type_list=xNew<int>(nummodels);
    4242
    4343        /*Initialize: */
     
    5050        for(i=0;i<nummodels;i++){
    5151
    52                 _printf_(VerboseMProcessor(),"   Processing finite element model of analysis %s:\n",EnumToStringx(analysis_type_list[i]));
     52                if(VerboseMProcessor()) _pprintLine_("   Processing finite element model of analysis " << EnumToStringx(analysis_type_list[i]) << ":");
    5353                analysis_type=analysis_type_list[i];
    5454                this->SetCurrentConfiguration(analysis_type);
    5555       
    5656                if(i==0){
    57                         _printf_(VerboseMProcessor(),"      creating vertex degrees of freedom\n");
     57                        if(VerboseMProcessor()) _pprintLine_("      creating vertex degrees of freedom");
    5858                        VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices
    5959                }
    6060
    61                 _printf_(VerboseMProcessor(),"      resolving node constraints\n");
     61                if(VerboseMProcessor()) _pprintLine_("      resolving node constraints");
    6262                SpcNodesx(nodes,constraints,parameters,analysis_type);
    6363
    64                 _printf_(VerboseMProcessor(),"      creating nodal degrees of freedom\n");
     64                if(VerboseMProcessor()) _pprintLine_("      creating nodal degrees of freedom");
    6565                NodesDofx(nodes,parameters,analysis_type);
    6666       
    67                 _printf_(VerboseMProcessor(),"      configuring element and loads\n");
     67                if(VerboseMProcessor()) _pprintLine_("      configuring element and loads");
    6868                ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
    6969        }
     
    7777}
    7878
    79 /*}}}1*/
    80 /*FUNCTION FemModel::destructor {{{1*/
     79/*}}}*/
     80/*FUNCTION FemModel::destructor {{{*/
    8181FemModel::~FemModel(){
    8282
     
    8585
    8686        /*Delete all the datasets: */
    87         xfree((void**)&analysis_type_list);
     87        xDelete<int>(analysis_type_list);
    8888        delete elements;
    8989        delete nodes;
     
    9696
    9797}
    98 /*}}}1*/
     98/*}}}*/
    9999
    100100/*Object management*/
    101 /*FUNCTION FemModel::Echo {{{1*/
     101/*FUNCTION FemModel::Echo {{{*/
    102102void FemModel::Echo(void){
    103103
    104         printf("FemModel echo: \n");
    105         printf("   number of fem models: %i\n",nummodels);
    106         printf("   analysis_type_list: \n");
    107         for(int i=0;i<nummodels;i++)printf("     %i: %s\n",i,EnumToStringx(analysis_type_list[i]));
    108         printf("   current analysis_type: \n");
    109         printf("     %i: %s\n",analysis_counter,EnumToStringx(analysis_type_list[analysis_counter]));
     104        _printLine_("FemModel echo: ");
     105        _printLine_("   number of fem models: " << nummodels);
     106        _printLine_("   analysis_type_list: ");
     107        for(int i=0;i<nummodels;i++)_printLine_("     " << i << ": " << EnumToStringx(analysis_type_list[i]));
     108        _printLine_("   current analysis_type: ");
     109        _printLine_("     " << analysis_counter << ": " << EnumToStringx(analysis_type_list[analysis_counter]));
    110110
    111111}
     
    113113
    114114/*Numerics: */
    115 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){{{1*/
     115/*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){{{*/
    116116void FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){
    117117
     
    129129        }
    130130        if(found!=-1) analysis_counter=found;
    131         else _error_("Could not find alias for analysis_type %s in list of FemModel analyses",EnumToStringx(configuration_type));
     131        else _error2_("Could not find alias for analysis_type " << EnumToStringx(configuration_type) << " in list of FemModel analyses");
    132132
    133133        /*Now, plug analysis_counter and analysis_type inside the parameters: */
     
    145145        if(this->parameters->Exist(PetscOptionsStringsEnum)){
    146146                PetscOptionsFromAnalysis(this->parameters,analysis_type);
    147                 _printf_(VerboseSolver(),"      petsc Options set for analysis type: %s\n",EnumToStringx(analysis_type));
     147                if(VerboseSolver()) _pprintLine_("      petsc Options set for analysis type: " << EnumToStringx(analysis_type));
    148148        }
    149149        #endif
    150150
    151151}
    152 /*}}}1*/
    153 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type){{{1*/
     152/*}}}*/
     153/*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type){{{*/
    154154void FemModel::SetCurrentConfiguration(int configuration_type){
    155155
     
    157157        this->SetCurrentConfiguration(configuration_type,configuration_type);
    158158}
    159 /*}}}1*/
     159/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.