Changeset 6411
- Timestamp:
- 10/25/10 08:27:35 (14 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/DataSet.cpp
r6200 r6411 536 536 } 537 537 /*}}}*/ 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 55 55 int Size(); 56 56 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);59 57 Object* GetObjectByOffset(int offset); 60 58 Object* GetObjectById(int* poffset,int eid); -
issm/trunk/src/c/Container/Elements.cpp
r6372 r6411 45 45 46 46 /*Object management*/ 47 /*FUNCTION Elements::Configure{{{1*/ 48 void 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 /*}}}*/ 47 62 /*FUNCTION Elements::ProcessResultsUnits{{{1*/ 48 63 void Elements::ProcessResultsUnits(void){ 49 64 50 int i;51 52 65 //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++){ 54 67 Element* element=(Element*)this->GetObjectByOffset(i); 55 68 element->ProcessResultsUnits(); … … 60 73 void Elements::DeleteResults(void){ 61 74 62 int i; 63 64 for (i=0;i<this->Size();i++){ 75 for (int i=0;i<this->Size();i++){ 65 76 Element* element=(Element*)this->GetObjectByOffset(i); 66 77 element->DeleteResults(); 67 78 } 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 default78 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 #endif90 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 101 79 } 102 80 /*}}}*/ … … 178 156 } 179 157 /*}}}*/ 158 /*FUNCTION Elements::SetCurrentConfiguration{{{1*/ 159 void 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*/ 174 void 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 27 27 /*}}}*/ 28 28 /*numerics: {{{1*/ 29 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 30 void DeleteResults(void); 29 31 void ProcessResultsUnits(void); 30 void DeleteResults(void);32 void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 31 33 void ToResults(Results* results,Parameters* parameters,int step, double time); 32 34 Patch* ResultsToPatch(void); … … 35 37 }; 36 38 37 38 39 39 #endif //ifndef _ELEMENTS_H_ 40 -
issm/trunk/src/c/Container/Loads.cpp
r5296 r6411 43 43 44 44 /*Numerics:*/ 45 /*FUNCTION Loads::Configure{{{1*/ 46 void 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 /*}}}*/ 45 60 /*FUNCTION Loads::NumberOfLoads{{{1*/ 46 61 int Loads::NumberOfLoads(void){ … … 80 95 } 81 96 /*}}}*/ 97 /*FUNCTION Loads::SetCurrentConfiguration{{{1*/ 98 void 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 26 26 /*}}}*/ 27 27 /*numerics: {{{1*/ 28 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 28 29 int NumberOfLoads(void); 29 30 void OutputRifts(Vec riftproperties); 31 void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 30 32 /*}}}*/ 31 33 32 34 }; 33 35 34 35 36 36 #endif //ifndef _LOADS_H_ 37 -
issm/trunk/src/c/Container/Materials.cpp
r4218 r6411 43 43 44 44 /*Object management*/ 45 /*FUNCTION Materials::Configure{{{1*/ 46 void 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 25 25 /*}}}*/ 26 26 /*numerics: {{{1*/ 27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 27 28 /*}}}*/ 28 29 … … 30 31 31 32 #endif //ifndef _MATERIALS_H_ 32 -
issm/trunk/src/c/Container/Nodes.cpp
r5786 r6411 43 43 44 44 /*Numerics*/ 45 /*FUNCTION Nodes::Configure{{{1*/ 46 void 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 /*}}}*/ 45 60 /*FUNCTION Nodes::DistributeDofs{{{1*/ 46 61 void Nodes::DistributeDofs(int analysis_type,int setenum){ … … 217 232 } 218 233 /*}}}*/ 234 /*FUNCTION Nodes::MaxNumDofs{{{1*/ 235 int 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 /*}}}*/ 219 264 /*FUNCTION Nodes::NumberOfDofs{{{1*/ 220 265 int Nodes::NumberOfDofs(int analysis_type,int setenum){ … … 336 381 } 337 382 /*}}}*/ 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*/ 384 void 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 19 19 /*}}}*/ 20 20 /*numerics: {{{1*/ 21 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 21 22 void DistributeDofs(int analysis_type,int SETENUM); 22 23 void FlagClones(int analysis_type); 23 24 void FlagNodeSets(Vec pv_g, Vec pv_f, Vec pv_s,int analysis_type); 25 int MaxNumDofs(int analysis_type,int setenum); 24 26 int NumberOfDofs(int analysis_type,int setenum); 25 27 int NumberOfNodes(int analysis_type); 26 28 int NumberOfNodes(void); 27 29 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); 29 31 /*}}}*/ 30 32 31 33 }; 32 34 33 34 35 35 #endif //ifndef _NODES_H_ 36 -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r6374 r6411 390 390 391 391 /*Functions on enums: */ 392 int EnumIsElement(int en);393 int EnumIsLoad(int en);394 int EnumIsMaterial(int en);395 392 char *EnumToString(int enum_type); 396 393 int StringToEnum(char *string); -
issm/trunk/src/c/Makefile.am
r6372 r6411 341 341 ./io/pfclose.cpp\ 342 342 ./EnumDefinitions/EnumDefinitions.h\ 343 ./EnumDefinitions/EnumDefinitions.cpp\344 343 ./EnumDefinitions/EnumToString.cpp\ 345 344 ./EnumDefinitions/StringToEnum.cpp\ … … 913 912 ./io/ParsePetscOptions.cpp\ 914 913 ./EnumDefinitions/EnumDefinitions.h\ 915 ./EnumDefinitions/EnumDefinitions.cpp\916 914 ./EnumDefinitions/EnumToString.cpp\ 917 915 ./EnumDefinitions/StringToEnum.cpp\
Note:
See TracChangeset
for help on using the changeset viewer.