source: issm/trunk/src/c/classes/Elements/Elements.cpp

Last change on this file was 25836, checked in by Mathieu Morlighem, 4 years ago

merged trunk-jpl and trunk for revision 25834

File size: 2.5 KB
Line 
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"
18#include "../../toolkits/toolkits.h"
19#include "../../shared/shared.h"
20
21using namespace std;
22/*}}}*/
23
24/*Object constructors and destructor*/
25Elements::Elements(){/*{{{*/
26 enum_type=MeshElementsEnum;
27 return;
28}
29/*}}}*/
30Elements::~Elements(){/*{{{*/
31 return;
32}
33/*}}}*/
34
35/*Object management*/
36void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters,Inputs* inputs){/*{{{*/
37
38 vector<Object*>::iterator object;
39
40 for(object=objects.begin() ; object < objects.end(); object++ ){
41 Element* element=xDynamicCast<Element*>((*object));
42 element->Configure(elements,loads,nodes,vertices,materials,parameters,inputs);
43 }
44
45}/*}}}*/
46int Elements::MaxNumNodes(void){/*{{{*/
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: */
53 for(Object* & object : this->objects){
54 Element* element = xDynamicCast<Element*>(object);
55 numnodes=element->GetNumberOfNodes();
56 if(numnodes>max)max=numnodes;
57 }
58
59 /*Grab max of all cpus: */
60 ISSM_MPI_Allreduce((void*)&max,(void*)&allmax,1,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());
61 max=allmax;
62
63 return max;
64}
65/*}}}*/
66int Elements::NumberOfElements(void){/*{{{*/
67
68 int local_nelem;
69 int numberofelements;
70
71 local_nelem=this->Size();
72 ISSM_MPI_Allreduce((void*)&local_nelem,(void*)&numberofelements,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm());
73
74 return numberofelements;
75}
76/*}}}*/
77void Elements::ResetHooks(){/*{{{*/
78
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
87 }
88
89}
90/*}}}*/
91void 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/*}}}*/
Note: See TracBrowser for help on using the repository browser.