[14996] | 1 | /*
|
---|
| 2 | * \file Elements.cpp
|
---|
| 3 | * \brief: Implementation of Elements class, derived from DataSet class
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*Headers: {{{*/
|
---|
| 7 | #ifdef HAVE_CONFIG_H
|
---|
| 8 | #include <config.h>
|
---|
| 9 | #else
|
---|
| 10 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
| 13 | #include "./Element.h"
|
---|
| 14 | #include "./Elements.h"
|
---|
| 15 | #include "../Params/Parameters.h"
|
---|
| 16 | #include "../ExternalResults/Results.h"
|
---|
| 17 | #include "../ExternalResults/GenericExternalResult.h"
|
---|
[15051] | 18 | #include "../../toolkits/toolkits.h"
|
---|
[15012] | 19 | #include "../../shared/shared.h"
|
---|
[14996] | 20 |
|
---|
| 21 | using namespace std;
|
---|
| 22 | /*}}}*/
|
---|
| 23 |
|
---|
| 24 | /*Object constructors and destructor*/
|
---|
[17989] | 25 | Elements::Elements(){/*{{{*/
|
---|
[14996] | 26 | enum_type=MeshElementsEnum;
|
---|
| 27 | return;
|
---|
| 28 | }
|
---|
| 29 | /*}}}*/
|
---|
[17989] | 30 | Elements::~Elements(){/*{{{*/
|
---|
[14996] | 31 | return;
|
---|
| 32 | }
|
---|
| 33 | /*}}}*/
|
---|
| 34 |
|
---|
| 35 | /*Object management*/
|
---|
[25836] | 36 | void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters,Inputs* inputs){/*{{{*/
|
---|
[14996] | 37 |
|
---|
| 38 | vector<Object*>::iterator object;
|
---|
| 39 |
|
---|
[24686] | 40 | for(object=objects.begin() ; object < objects.end(); object++ ){
|
---|
| 41 | Element* element=xDynamicCast<Element*>((*object));
|
---|
[25836] | 42 | element->Configure(elements,loads,nodes,vertices,materials,parameters,inputs);
|
---|
[14996] | 43 | }
|
---|
| 44 |
|
---|
[24686] | 45 | }/*}}}*/
|
---|
[17989] | 46 | int Elements::MaxNumNodes(void){/*{{{*/
|
---|
[14996] | 47 |
|
---|
| 48 | int max=0;
|
---|
| 49 | int allmax;
|
---|
| 50 | int numnodes=0;
|
---|
| 51 |
|
---|
| 52 | /*Now go through all elements, and get how many nodes they own, unless they are clone nodes: */
|
---|
[25836] | 53 | for(Object* & object : this->objects){
|
---|
| 54 | Element* element = xDynamicCast<Element*>(object);
|
---|
[14996] | 55 | numnodes=element->GetNumberOfNodes();
|
---|
| 56 | if(numnodes>max)max=numnodes;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | /*Grab max of all cpus: */
|
---|
[16137] | 60 | ISSM_MPI_Allreduce((void*)&max,(void*)&allmax,1,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());
|
---|
[14996] | 61 | max=allmax;
|
---|
| 62 |
|
---|
| 63 | return max;
|
---|
| 64 | }
|
---|
| 65 | /*}}}*/
|
---|
[17989] | 66 | int Elements::NumberOfElements(void){/*{{{*/
|
---|
[14996] | 67 |
|
---|
| 68 | int local_nelem;
|
---|
| 69 | int numberofelements;
|
---|
| 70 |
|
---|
| 71 | local_nelem=this->Size();
|
---|
[16560] | 72 | ISSM_MPI_Allreduce((void*)&local_nelem,(void*)&numberofelements,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm());
|
---|
[14996] | 73 |
|
---|
| 74 | return numberofelements;
|
---|
| 75 | }
|
---|
| 76 | /*}}}*/
|
---|
[21341] | 77 | void Elements::ResetHooks(){/*{{{*/
|
---|
[14996] | 78 |
|
---|
[21341] | 79 | vector<Object*>::iterator object;
|
---|
| 80 | Element* element=NULL;
|
---|
| 81 |
|
---|
| 82 | for ( object=objects.begin() ; object < objects.end(); object++ ){
|
---|
| 83 |
|
---|
| 84 | element=xDynamicCast<Element*>((*object));
|
---|
| 85 | element->ResetHooks();
|
---|
| 86 |
|
---|
[14996] | 87 | }
|
---|
[21341] | 88 |
|
---|
[14996] | 89 | }
|
---|
| 90 | /*}}}*/
|
---|
[21341] | 91 | void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){/*{{{*/
|
---|
| 92 |
|
---|
| 93 | vector<Object*>::iterator object;
|
---|
| 94 | Element* element=NULL;
|
---|
| 95 |
|
---|
| 96 | for ( object=objects.begin() ; object < objects.end(); object++ ){
|
---|
| 97 |
|
---|
| 98 | element=xDynamicCast<Element*>((*object));
|
---|
| 99 | element->SetCurrentConfiguration(elements,loads,nodes,materials,parameters);
|
---|
| 100 |
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | }
|
---|
| 104 | /*}}}*/
|
---|