Changeset 12706 for issm/trunk/src/c/objects/FemModel.cpp
- Timestamp:
- 07/24/12 10:36:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/FemModel.cpp
r12330 r12706 20 20 21 21 /*Object constructors and destructor*/ 22 /*FUNCTION FemModel::constructor {{{ 1*/22 /*FUNCTION FemModel::constructor {{{*/ 23 23 FemModel::FemModel(char* inputfilename, char* outputfilename, const int in_solution_type,const int* analyses,const int nummodels){ 24 24 25 25 /*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; 30 30 31 31 /*Open input file on cpu 0: */ 32 if(my_rank==0) IOMODEL = pfopen(inputfilename ,"rb");32 if(my_rank==0) IOMODEL = pfopen(inputfilename ,"rb"); 33 33 34 34 /*Initialize internal data: */ … … 39 39 40 40 /*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); 42 42 43 43 /*Initialize: */ … … 50 50 for(i=0;i<nummodels;i++){ 51 51 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]) << ":"); 53 53 analysis_type=analysis_type_list[i]; 54 54 this->SetCurrentConfiguration(analysis_type); 55 55 56 56 if(i==0){ 57 _printf_(VerboseMProcessor()," creating vertex degrees of freedom\n");57 if(VerboseMProcessor()) _pprintLine_(" creating vertex degrees of freedom"); 58 58 VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices 59 59 } 60 60 61 _printf_(VerboseMProcessor()," resolving node constraints\n");61 if(VerboseMProcessor()) _pprintLine_(" resolving node constraints"); 62 62 SpcNodesx(nodes,constraints,parameters,analysis_type); 63 63 64 _printf_(VerboseMProcessor()," creating nodal degrees of freedom\n");64 if(VerboseMProcessor()) _pprintLine_(" creating nodal degrees of freedom"); 65 65 NodesDofx(nodes,parameters,analysis_type); 66 66 67 _printf_(VerboseMProcessor()," configuring element and loads\n");67 if(VerboseMProcessor()) _pprintLine_(" configuring element and loads"); 68 68 ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters); 69 69 } … … 77 77 } 78 78 79 /*}}} 1*/80 /*FUNCTION FemModel::destructor {{{ 1*/79 /*}}}*/ 80 /*FUNCTION FemModel::destructor {{{*/ 81 81 FemModel::~FemModel(){ 82 82 … … 85 85 86 86 /*Delete all the datasets: */ 87 x free((void**)&analysis_type_list);87 xDelete<int>(analysis_type_list); 88 88 delete elements; 89 89 delete nodes; … … 96 96 97 97 } 98 /*}}} 1*/98 /*}}}*/ 99 99 100 100 /*Object management*/ 101 /*FUNCTION FemModel::Echo {{{ 1*/101 /*FUNCTION FemModel::Echo {{{*/ 102 102 void FemModel::Echo(void){ 103 103 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])); 110 110 111 111 } … … 113 113 114 114 /*Numerics: */ 115 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){{{ 1*/115 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){{{*/ 116 116 void FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){ 117 117 … … 129 129 } 130 130 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"); 132 132 133 133 /*Now, plug analysis_counter and analysis_type inside the parameters: */ … … 145 145 if(this->parameters->Exist(PetscOptionsStringsEnum)){ 146 146 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)); 148 148 } 149 149 #endif 150 150 151 151 } 152 /*}}} 1*/153 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type){{{ 1*/152 /*}}}*/ 153 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type){{{*/ 154 154 void FemModel::SetCurrentConfiguration(int configuration_type){ 155 155 … … 157 157 this->SetCurrentConfiguration(configuration_type,configuration_type); 158 158 } 159 /*}}} 1*/159 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.