Changeset 4873
- Timestamp:
- 07/29/10 10:07:56 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/Parameters.cpp
r4855 r4873 309 309 } 310 310 /*}}}*/ 311 /*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{1*/ 312 int Parameters::FindParam(FILE** pfid,int enum_type){ 313 314 /*Go through a dataset, and find a Param* object 315 *which parameter name is "name" : */ 316 317 vector<Object*>::iterator object; 318 Param* param=NULL; 319 320 int found=0; 321 322 for ( object=objects.begin() ; object < objects.end(); object++ ){ 323 324 /*Ok, this object is a parameter, recover it and ask which name it has: */ 325 param=(Param*)(*object); 326 327 if(param->EnumType()==enum_type){ 328 /*Ok, this is the one! Recover the value of this parameter: */ 329 param->GetParameterValue(pfid); 330 found=1; 331 break; 332 } 333 } 334 return found; 335 } 336 /*}}}*/ 311 337 312 338 /*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{1*/ … … 418 444 } 419 445 /*}}}*/ 446 /*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{1*/ 447 void Parameters::SetParam(FILE* fid,int enum_type){ 448 449 Param* param=NULL; 450 451 /*first, figure out if the param has already been created: */ 452 param=(Param*)this->FindParamObject(enum_type); 453 454 if(param) param->SetValue(fid); //already exists, just set it. 455 else this->AddObject(new FileParam(enum_type,fid)); //just add the new parameter. 456 } 457 /*}}}*/ 420 458 421 459 /*FUNCTION Parameters::FindParamObject{{{1*/ -
issm/trunk/src/c/Container/Parameters.h
r4855 r4873 36 36 int FindParam(Vec* pvec,int enum_type); 37 37 int FindParam(Mat* pmat,int enum_type); 38 int FindParam(FILE** pfid,int enum_type); 38 39 39 40 void SetParam(bool boolean,int enum_type); … … 46 47 void SetParam(Vec vec,int enum_type); 47 48 void SetParam(Mat mat,int enum_type); 49 void SetParam(FILE* fid,int enum_type); 48 50 49 51 Object* FindParamObject(int enum_type); -
issm/trunk/src/c/EnumDefinitions/EnumAsString.cpp
r4857 r4873 121 121 case DoubleVecParamEnum : return "DoubleVecParam"; 122 122 case IntParamEnum : return "IntParam"; 123 case FileParamEnum : return "FileParam"; 123 124 case PetscMatParamEnum : return "PetscMatParam"; 124 125 case PetscVecParamEnum : return "PetscVecParam"; … … 291 292 case NumberOfVerticesEnum : return "NumberOfVertices"; 292 293 case OptScalEnum : return "OptScal"; 293 case OutputFile NameEnum : return "OutputFileName";294 case OutputFilePointerEnum : return "OutputFilePointer"; 294 295 case ParameterOutputEnum : return "ParameterOutput"; 295 296 case PenaltyMeltingEnum : return "PenaltyMelting"; -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r4855 r4873 139 139 DoubleVecParamEnum, 140 140 IntParamEnum, 141 FileParamEnum, 141 142 PetscMatParamEnum, 142 143 PetscVecParamEnum, … … 328 329 NumberOfVerticesEnum, 329 330 OptScalEnum, 330 OutputFile NameEnum,331 OutputFilePointerEnum, 331 332 ParameterOutputEnum, 332 333 PenaltyMeltingEnum, -
issm/trunk/src/c/EnumDefinitions/StringAsEnum.cpp
r4857 r4873 119 119 else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum; 120 120 else if (strcmp(name,"IntParam")==0) return IntParamEnum; 121 else if (strcmp(name,"FileParam")==0) return FileParamEnum; 121 122 else if (strcmp(name,"PetscMatParam")==0) return PetscMatParamEnum; 122 123 else if (strcmp(name,"PetscVecParam")==0) return PetscVecParamEnum; … … 289 290 else if (strcmp(name,"NumberOfVertices")==0) return NumberOfVerticesEnum; 290 291 else if (strcmp(name,"OptScal")==0) return OptScalEnum; 291 else if (strcmp(name,"OutputFile Name")==0) return OutputFileNameEnum;292 else if (strcmp(name,"OutputFilePointer")==0) return OutputFilePointerEnum; 292 293 else if (strcmp(name,"ParameterOutput")==0) return ParameterOutputEnum; 293 294 else if (strcmp(name,"PenaltyMelting")==0) return PenaltyMeltingEnum; -
issm/trunk/src/c/Makefile.am
r4853 r4873 188 188 ./objects/Params/DoubleParam.cpp\ 189 189 ./objects/Params/DoubleParam.h\ 190 ./objects/Params/FileParam.cpp\ 191 ./objects/Params/FileParam.h\ 190 192 ./objects/Params/PetscMatParam.cpp\ 191 193 ./objects/Params/PetscMatParam.h\ … … 750 752 ./objects/Params/DoubleParam.cpp\ 751 753 ./objects/Params/DoubleParam.h\ 754 ./objects/Params/FileParam.cpp\ 755 ./objects/Params/FileParam.h\ 752 756 ./objects/Params/PetscMatParam.cpp\ 753 757 ./objects/Params/PetscMatParam.h\ -
issm/trunk/src/c/io/pfclose.cpp
r3775 r4873 21 21 } 22 22 } 23 -
issm/trunk/src/c/modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp
r4781 r4873 47 47 xfree((void**)&iomodel->elementonwater); 48 48 xfree((void**)&iomodel->elementonbed); 49 xfree((void**)&iomodel->elementonsurface); 49 50 } -
issm/trunk/src/c/modules/OutputResultsx/ElementResultsToPatch.cpp
r4508 r4873 15 15 #include "../../objects/objects.h" 16 16 17 void ElementResultsToPatch(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results ){17 void ElementResultsToPatch(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results,int step, double time){ 18 18 19 19 int i; … … 96 96 patch->MPI_Gather(); 97 97 98 /*create result object and add to results dataset: */ 99 results->AddObject(new IntExternalResult(results->Size()+1,PatchVerticesEnum,patch->maxvertices,1,0)); 100 results->AddObject(new IntExternalResult(results->Size()+1,PatchNodesEnum, patch->maxnodes,1,0)); 101 results->AddObject(new DoubleMatExternalResult(results->Size()+1,PatchEnum,patch->values,patch->numrows,patch->numcols,1,0)); 98 /*create result object and add to results dataset (if not empty): */ 99 if (patch->maxvertices && patch->maxnodes){ 100 results->AddObject(new IntExternalResult(results->Size()+1,PatchVerticesEnum,patch->maxvertices,step,time)); 101 results->AddObject(new IntExternalResult(results->Size()+1,PatchNodesEnum, patch->maxnodes,step,time)); 102 results->AddObject(new DoubleMatExternalResult(results->Size()+1,PatchEnum,patch->values,patch->numrows,patch->numcols,step,time)); 103 } 102 104 103 105 /*Free ressources:*/ -
issm/trunk/src/c/modules/OutputResultsx/FileWriteResults.cpp
r4316 r4873 18 18 int i; 19 19 extern int my_rank; 20 char *filename = NULL;21 20 FILE *fid = NULL; 22 21 23 22 //Recover file name: 24 parameters->FindParam(&filename,OutputFileNameEnum); 25 26 //Open filename for writing only on cpu 0 27 if(my_rank==0)fid=pfopen(filename,"wb"); 23 parameters->FindParam(&fid,OutputFilePointerEnum); 28 24 29 25 for(i=0;i<results->Size();i++){ … … 33 29 result->WriteData(fid); 34 30 } 35 36 /*Close file: */37 if(my_rank==0) pfclose(fid,filename);38 39 /*Free ressources:*/40 xfree((void**)&filename);41 31 } -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
r4573 r4873 17 17 18 18 #ifdef _SERIAL_ 19 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results){20 #else 21 void OutputResultsx( Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results){19 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet** presults, int step, double time){ 20 #else 21 void OutputResultsx( Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet** presults, int step, double time){ 22 22 #endif 23 23 24 int solutiontype; 24 /*Intermediaries*/ 25 int i; 26 int solutiontype; 27 DataSet *results; 28 Element *element; 29 30 /*Recover results*/ 31 results=*presults; 25 32 26 33 /*Transfer element results into the femmodel->results dataset: */ 27 ElementResultsToPatch( elements, nodes, vertices, loads, materials, parameters,results );34 ElementResultsToPatch( elements, nodes, vertices, loads, materials, parameters,results,step,time); 28 35 29 36 #ifdef _PARALLEL_ … … 36 43 /*Write data to matlab structure or filename: */ 37 44 #ifdef _SERIAL_ 45 /*Write Matlab structure*/ 38 46 MatlabWriteResults(pdataref,parameters,results); 47 48 /*DO NOT delete results serially*/ 39 49 #else 50 /*Write File*/ 40 51 FileWriteResults(parameters,results); 52 53 /*Now delete results (ElementResults and ExternalResults)*/ 54 delete results; 55 for (i=0;i<elements->Size();i++){ 56 element=(Element*)elements->GetObjectByOffset(i); 57 element->DeleteResults(); 58 } 41 59 #endif 60 61 62 63 /*We have to reinitialize results for next step*/ 64 results=new DataSet(); 65 *presults=results; 66 42 67 } -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h
r4236 r4873 16 16 #ifdef _SERIAL_ 17 17 #include <mex.h> 18 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results);18 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet** results,int step=0,double time=0); 19 19 void MatlabWriteResults(mxArray** pdataref, Parameters* parameters, DataSet* results); 20 20 #else 21 void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results);21 void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet** results,int step=0,double time=0); 22 22 void FileWriteResults(Parameters* parameters, DataSet* results); 23 23 #endif 24 24 25 25 /* local prototypes: */ 26 void ElementResultsToPatch(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results );26 void ElementResultsToPatch(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,DataSet* results,int step, double time); 27 27 28 28 #endif /* _OUTPUTRESULTS_H */ -
issm/trunk/src/c/objects/Elements/Beam.cpp
r4839 r4873 284 284 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type)); 285 285 } 286 287 } 288 /*}}}*/ 289 /*FUNCTION Beam::DeleteResults {{{1*/ 290 void Beam::DeleteResults(void){ 291 292 ISSMERROR("not implemented yet"); 286 293 287 294 } -
issm/trunk/src/c/objects/Elements/Beam.h
r4780 r4873 70 70 void CreateKMatrix(Mat Kgg); 71 71 void CreatePVector(Vec pg); 72 void Du(Vec du_g);72 void DeleteResults(void); 73 73 void GetBedList(double* bed_list); 74 74 void* GetMatPar(); -
issm/trunk/src/c/objects/Elements/Element.h
r4839 r4873 50 50 virtual void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes)=0; 51 51 virtual void PatchFill(int* pcount, Patch* patch)=0; 52 virtual void DeleteResults(void)=0; 52 53 virtual void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type)=0; 53 54 virtual void UpdateGeometry(void)=0; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4846 r4873 828 828 } 829 829 else ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type)); 830 831 } 832 /*}}}*/ 833 /*FUNCTION Penta::DeleteResults {{{1*/ 834 void Penta::DeleteResults(void){ 835 836 /*Delete and reinitialize results*/ 837 delete this->results; 838 this->results=new Results(); 830 839 831 840 } -
issm/trunk/src/c/objects/Elements/Penta.h
r4839 r4873 73 73 void CreateKMatrix(Mat Kgg); 74 74 void CreatePVector(Vec pg); 75 void DeleteResults(void); 75 76 void GetBedList(double* bed_list); 76 77 void* GetMatPar(); -
issm/trunk/src/c/objects/Elements/Sing.cpp
r4839 r4873 255 255 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type)); 256 256 } 257 258 } 259 /*}}}*/ 260 /*FUNCTION Sing::DeleteResults {{{1*/ 261 void Sing::DeleteResults(void){ 262 263 ISSMERROR("not implemented yet"); 257 264 258 265 } -
issm/trunk/src/c/objects/Elements/Sing.h
r4780 r4873 70 70 void CreateKMatrix(Mat Kgg); 71 71 void CreatePVector(Vec pg); 72 void D u(Vec du_g);72 void DeleteResults(void); 73 73 void GetBedList(double* bed_list); 74 74 void* GetMatPar(); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4846 r4873 747 747 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type)); 748 748 } 749 750 } 751 /*}}}*/ 752 /*FUNCTION Tria::DeleteResults {{{1*/ 753 void Tria::DeleteResults(void){ 754 755 /*Delete and reinitialize results*/ 756 delete this->results; 757 this->results=new Results(); 749 758 750 759 } -
issm/trunk/src/c/objects/Elements/Tria.h
r4839 r4873 28 28 int id; 29 29 30 Node ** nodes;// 3 nodes31 Matice * matice;// 1 material ice32 Matpar * matpar;// 1 material parameter33 34 Parameters * parameters;//pointer to solution parameters35 Inputs *inputs;36 Results * results;30 Node **nodes; // 3 nodes 31 Matice *matice; // 1 material ice 32 Matpar *matpar; // 1 material parameter 33 34 Parameters *parameters; //pointer to solution parameters 35 Inputs *inputs; 36 Results *results; 37 37 38 38 /*Tria constructors, destructors {{{1*/ … … 88 88 void InputScale(int enum_type,double scale_factor); 89 89 void InputToResult(int enum_type,int step,double time); 90 void DeleteResults(void); 90 91 void MaterialUpdateFromTemperature(void){ISSMERROR("not implemented yet");}; 91 92 double MassFlux(double* segment); -
issm/trunk/src/c/objects/Params/BoolParam.h
r4852 r4873 63 63 void GetParameterValue(Vec* pvec){ISSMERROR("Bool param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 64 64 void GetParameterValue(Mat* pmat){ISSMERROR("Bool param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 65 void GetParameterValue(FILE** pfid){ISSMERROR("Bool param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 65 66 66 67 void SetValue(bool boolean){this->value=boolean;} … … 73 74 void SetValue(Vec vec){ISSMERROR("Bool param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 74 75 void SetValue(Mat mat){ISSMERROR("Bool param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 76 void SetValue(FILE* fid){ISSMERROR("Bool param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 75 77 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("Bool param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 76 77 78 78 79 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/DoubleMatArrayParam.h
r4853 r4873 66 66 void GetParameterValue(Vec* pvec){ISSMERROR("DoubleMatArray param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 67 67 void GetParameterValue(Mat* pmat){ISSMERROR("DoubleMatArray param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 68 void GetParameterValue(FILE** pfid){ISSMERROR("DoubleMatArray param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 68 69 69 70 void SetValue(bool boolean){ISSMERROR("DoubleMatArray param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));} … … 76 77 void SetValue(Vec vec){ISSMERROR("DoubleMatArray param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 77 78 void SetValue(Mat mat){ISSMERROR("DoubleMatArray param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 79 void SetValue(FILE* fid){ISSMERROR("Bool param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 78 80 void SetValue(double** array, int M, int* mdim_array, int* ndim_array); 79 81 -
issm/trunk/src/c/objects/Params/DoubleMatParam.h
r4852 r4873 65 65 void GetParameterValue(Vec* pvec){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 66 66 void GetParameterValue(Mat* pmat){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 67 void GetParameterValue(FILE** pfid){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 67 68 68 69 void SetValue(bool boolean){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));} … … 75 76 void SetValue(Vec vec){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 76 77 void SetValue(Mat mat){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 78 void SetValue(FILE* fid){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 77 79 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 78 80 -
issm/trunk/src/c/objects/Params/DoubleParam.h
r4852 r4873 64 64 void GetParameterValue(Vec* pvec){ISSMERROR("Double param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 65 65 void GetParameterValue(Mat* pmat){ISSMERROR("Double param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 66 void GetParameterValue(FILE** pfid){ISSMERROR("Double param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 66 67 67 68 void SetValue(bool boolean){this->value=(double)boolean;} … … 74 75 void SetValue(Vec vec){ISSMERROR("Double param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 75 76 void SetValue(Mat mat){ISSMERROR("Double param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 77 void SetValue(FILE* fid){ISSMERROR("Double param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 76 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("Double param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 77 79 -
issm/trunk/src/c/objects/Params/DoubleVecParam.h
r4852 r4873 64 64 void GetParameterValue(Vec* pvec){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 65 65 void GetParameterValue(Mat* pmat){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 66 void GetParameterValue(FILE** pfid){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 66 67 67 68 void SetValue(bool boolean){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));} … … 74 75 void SetValue(Vec vec){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 75 76 void SetValue(Mat mat){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 77 void SetValue(FILE* fid){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 76 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 77 79 -
issm/trunk/src/c/objects/Params/IntParam.h
r4852 r4873 63 63 void GetParameterValue(Vec* pvec){ISSMERROR("Int param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 64 64 void GetParameterValue(Mat* pmat){ISSMERROR("Int param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 65 void GetParameterValue(FILE** pfid){ISSMERROR("Int param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 65 66 66 67 void SetValue(bool boolean){this->value=(int)boolean;} … … 73 74 void SetValue(Vec vec){ISSMERROR("Int param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 74 75 void SetValue(Mat mat){ISSMERROR("Int param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 76 void SetValue(FILE* fid){ISSMERROR("Int param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 75 77 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("Int param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 76 78 -
issm/trunk/src/c/objects/Params/Param.h
r4852 r4873 42 42 virtual void GetParameterValue(Vec* pvec)=0; 43 43 virtual void GetParameterValue(Mat* pmat)=0; 44 virtual void GetParameterValue(FILE** pfid)=0; 44 45 45 46 virtual void SetValue(bool boolean)=0; … … 52 53 virtual void SetValue(Vec vec)=0; 53 54 virtual void SetValue(Mat mat)=0; 55 virtual void SetValue(FILE* fid)=0; 54 56 virtual void SetValue(double** array, int M, int* mdim_array, int* ndim_array)=0; 55 57 -
issm/trunk/src/c/objects/Params/PetscMatParam.h
r4852 r4873 64 64 void GetParameterValue(Vec* pvec){ISSMERROR("PetscMat param of enum %i (%s) cannot return a vec",enum_type,EnumAsString(enum_type));} 65 65 void GetParameterValue(Mat* poutput); 66 void GetParameterValue(FILE** pfid){ISSMERROR("PetscMat param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 66 67 67 68 void SetValue(bool boolean){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));} … … 74 75 void SetValue(Vec vec){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 75 76 void SetValue(Mat mat); 77 void SetValue(FILE* fid){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 76 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("PetscMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 77 79 -
issm/trunk/src/c/objects/Params/PetscVecParam.h
r4852 r4873 64 64 void GetParameterValue(Mat* pmat){ISSMERROR("PetscVec param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 65 65 void GetParameterValue(Vec* poutput); 66 void GetParameterValue(FILE** pfid){ISSMERROR("PetscVec of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 66 67 67 void SetValue(bool boolean){ISSMERROR("PetscVec paramof enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}68 void SetValue(int integer){ISSMERROR("PetscVec paramof enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}69 void SetValue(double scalar){ISSMERROR("PetscVec paramof enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}70 void SetValue(char* string){ISSMERROR("PetscVec paramof enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}71 void SetValue(char** stringarray,int M){ISSMERROR("PetscVec paramof enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}72 void SetValue(double* doublearray,int M){ISSMERROR("PetscVec paramof enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}73 void SetValue(double* pdoublearray,int M,int N){ISSMERROR("PetscVec paramof enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}68 void SetValue(bool boolean){ISSMERROR("PetscVec of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));} 69 void SetValue(int integer){ISSMERROR("PetscVec of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));} 70 void SetValue(double scalar){ISSMERROR("PetscVec of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));} 71 void SetValue(char* string){ISSMERROR("PetscVec of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));} 72 void SetValue(char** stringarray,int M){ISSMERROR("PetscVec of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));} 73 void SetValue(double* doublearray,int M){ISSMERROR("PetscVec of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));} 74 void SetValue(double* pdoublearray,int M,int N){ISSMERROR("PetscVec of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));} 74 75 void SetValue(Vec vec); 75 void SetValue(Mat mat){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 76 void SetValue(Mat mat){ISSMERROR("PetscVec of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 77 void SetValue(FILE* fid){ISSMERROR("PetscVec of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 76 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("PetscVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 77 79 -
issm/trunk/src/c/objects/Params/StringArrayParam.h
r4852 r4873 66 66 void GetParameterValue(Vec* pvec){ISSMERROR("StringArray param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 67 67 void GetParameterValue(Mat* pmat){ISSMERROR("StringArray param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 68 void GetParameterValue(FILE** pfid){ISSMERROR("StringArray param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 68 69 69 70 void SetValue(bool boolean){ISSMERROR("StringArray param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));} … … 76 77 void SetValue(Vec vec){ISSMERROR("StringArray param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 77 78 void SetValue(Mat mat){ISSMERROR("StringArray param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 79 void SetValue(FILE* fid){ISSMERROR("StringArray param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 78 80 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("StringArray param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 79 81 -
issm/trunk/src/c/objects/Params/StringParam.h
r4852 r4873 64 64 void GetParameterValue(Vec* pvec){ISSMERROR("String param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));} 65 65 void GetParameterValue(Mat* pmat){ISSMERROR("String param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));} 66 void GetParameterValue(FILE** pfid){ISSMERROR("Bool param of enum %i (%s) cannot return a FILE",enum_type,EnumAsString(enum_type));} 66 67 67 68 void SetValue(bool boolean){ISSMERROR("String param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));} … … 74 75 void SetValue(Vec vec){ISSMERROR("String param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));} 75 76 void SetValue(Mat mat){ISSMERROR("String param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));} 77 void SetValue(FILE* fid){ISSMERROR("String param of enum %i (%s) cannot hold a FILE",enum_type,EnumAsString(enum_type));} 76 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("String param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));} 77 79 -
issm/trunk/src/c/objects/Patch.cpp
r4546 r4873 125 125 #endif 126 126 127 128 127 /*First, figure out total number of rows combining all the cpus: */ 129 128 MPI_Reduce(&this->numrows,&total_numrows,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD ); 130 129 MPI_Bcast(&total_numrows,1,MPI_INT,0,MPI_COMM_WORLD); 130 131 /*return if patch empty*/ 132 if(total_numrows==0) return; 131 133 132 134 /*Now, allocate buffer to holds all the values, on node 0: */ -
issm/trunk/src/c/objects/objects.h
r4853 r4873 83 83 #include "./Params/DoubleVecParam.h" 84 84 #include "./Params/IntParam.h" 85 #include "./Params/FileParam.h" 85 86 #include "./Params/Param.h" 86 87 #include "./Params/PetscMatParam.h" -
issm/trunk/src/c/solutions/controlrestart.cpp
r4211 r4873 22 22 23 23 /*write to disk: */ 24 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters, femmodel->results);24 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results); 25 25 26 26 } -
issm/trunk/src/c/solutions/issm.cpp
r4574 r4873 12 12 13 13 /*I/O: */ 14 FILE *fid = NULL; 14 FILE *input_fid = NULL; 15 FILE *output_fid = NULL; 15 16 char *inputfilename = NULL; 16 17 char *outputfilename = NULL; … … 48 49 MPI_Comm_size(MPI_COMM_WORLD,&num_procs); 49 50 50 _printf_("recover input and outputfile names:\n");51 _printf_("recover solution and file names:\n"); 51 52 solution_type=StringAsEnum(argv[1]); 52 53 inputfilename=argv[3]; … … 60 61 SolutionConfiguration(&analyses,&numanalyses,&solutioncore,solution_type); 61 62 62 /*Open handle to data on disk: */ 63 fid=pfopen(inputfilename,"rb"); 63 /*Open input file to process model 64 * and ouput file to start unload results*/ 65 input_fid =pfopen(inputfilename ,"rb"); 66 output_fid=pfopen(outputfilename,"wb"); 64 67 65 68 _printf_("create finite element model:\n"); 66 femmodel=new FemModel( fid,solution_type,analyses,numanalyses);69 femmodel=new FemModel(input_fid,solution_type,analyses,numanalyses); 67 70 68 /*add output filename inparameters: */69 femmodel->parameters-> AddObject(new StringParam(OutputFileNameEnum,outputfilename));71 /*add output_fid to parameters: */ 72 femmodel->parameters->SetParam(output_fid,OutputFilePointerEnum); 70 73 71 74 /*get parameters: */ … … 96 99 97 100 _printf_("write results to disk:\n"); 98 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters, femmodel->results);101 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results); 99 102 } 100 103 else{ … … 111 114 } 112 115 116 /*Close output file and write lock file if requested*/ 117 pfclose(output_fid,outputfilename); 113 118 if (waitonlock>0){ 114 119 _printf_("write lock file:\n"); -
issm/trunk/src/c/solutions/transient2d_core.cpp
r4728 r4873 62 62 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceEnum,step,time); 63 63 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum,step,time); 64 65 /*unload results*/ 66 if(verbose)_printf_("%s"," saving temporary results..."); 67 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results,step,time); 64 68 } 65 69 } -
issm/trunk/src/c/solutions/transient3d_core.cpp
r4747 r4873 77 77 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,step,time); 78 78 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,MeltingRateEnum,step,time); 79 }80 79 81 if (step%5==0){80 /*unload results*/ 82 81 if(verbose)_printf_("%s"," saving temporary results..."); 83 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters, femmodel->results);82 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results,step,time); 84 83 } 85 84 } -
issm/trunk/src/m/classes/public/display/displaymesh.m
r3994 r4873 36 36 37 37 disp(sprintf('\n Properties:')); 38 fielddisplay(md,' type','mesh type');38 fielddisplay(md,'dim','mesh dimension (2d or 3d)'); 39 39 fielddisplay(md,'numlayers','number of extrusion layers'); 40 40 fielddisplay(md,'extrusionexponent','exponent for extrusion'); 41 fielddisplay(md,'dof','maximum number of dofs solved');42 41 fielddisplay(md,'bamg','Geometry and 2d mesh properties (if generated by Bamg)'); 43 42 fielddisplay(md,'penalties','penalties list'); -
issm/trunk/src/m/classes/public/display/fielddisplay.m
r1277 r4873 47 47 48 48 else 49 error('displayline error message: type not supported yet'); 49 displayunit(offset,name,'not displayed',comment), 50 50 51 end 51 52 end %function -
issm/trunk/src/m/solutions/MatlabProcessPatch.m
r4439 r4873 5 5 % Result=ProcessPatch(Result); 6 6 7 % Get out if noPatch7 %return if there is no fiel Patch 8 8 if (~isfield(structure,'Patch')), 9 9 return; 10 else11 Patch=structure(1).Patch;12 numvertices=structure(1).PatchVertices;13 10 end 14 11 15 %Get number of fields; 16 fields=unique(Patch(:,1)); 17 steps=unique(Patch(:,2)); 12 %loop over steps 13 for i=1:length(structure), 18 14 19 %parse steps 20 for j=1:length(steps), 15 %Get Patch for current step 16 Patch=structure(i).Patch; 17 numvertices=structure(i).PatchVertices; 21 18 22 posstep=find(Patch(:,2)==steps(j)); 23 24 %Take all the lines of the Patch for this timestep 25 temporarypatch=Patch(posstep,:); 26 time=temporarypatch(1,3); 27 step=temporarypatch(1,2); 19 %check that Patch is not empty 20 if length(Patch)==0 continue; end 28 21 29 %parse fields 30 for i=1:length(fields), 22 %Get number of fields; 23 fields=unique(Patch(:,1)); 24 steps=unique(Patch(:,2)); 31 25 32 %get name33 fieldname=EnumAsString(fields(i));26 %parse steps 27 for j=1:length(steps), 34 28 35 %get line positions 36 pos=find(temporarypatch(:,1)==fields(i)); 29 posstep=find(Patch(:,2)==steps(j)); 37 30 38 %Fill Result structure 39 structure(step).steps=step; 40 structure(step).time=time; 41 structure(step).(fieldname).element=temporarypatch(pos,4); 42 structure(step).(fieldname).interpolation=temporarypatch(pos,5); 43 structure(step).(fieldname).index=temporarypatch(pos,6:5+numvertices); 44 structure(step).(fieldname).value=temporarypatch(pos,6+numvertices:end); 31 %Take all the lines of the Patch for this timestep 32 temporarypatch=Patch(posstep,:); 33 time=temporarypatch(1,3); 34 step=temporarypatch(1,2); 45 35 36 %parse fields 37 for i=1:length(fields), 38 39 %get name 40 fieldname=EnumAsString(fields(i)); 41 42 %get line positions 43 pos=find(temporarypatch(:,1)==fields(i)); 44 45 %Fill Result structure 46 structure(step).steps=step; 47 structure(step).time=time; 48 structure(step).(fieldname).element=temporarypatch(pos,4); 49 structure(step).(fieldname).interpolation=temporarypatch(pos,5); 50 structure(step).(fieldname).index=temporarypatch(pos,6:5+numvertices); 51 structure(step).(fieldname).value=temporarypatch(pos,6+numvertices:end); 52 53 end 46 54 end 47 55 end -
issm/trunk/src/mex/OutputResults/OutputResults.cpp
r4573 r4873 43 43 44 44 /*Call "x" code layer: */ 45 OutputResultsx(&dataref, elements,nodes,vertices,loads,materials,parameters, results);45 OutputResultsx(&dataref, elements,nodes,vertices,loads,materials,parameters,&results); 46 46 47 47 /*write output datasets: */
Note:
See TracChangeset
for help on using the changeset viewer.