escript Revision_
dudley/src/NodeFile.h
Go to the documentation of this file.
1
2/*****************************************************************************
3*
4* Copyright (c) 2003-2020 by The University of Queensland
5* http://www.uq.edu.au
6*
7* Primary Business: Queensland, Australia
8* Licensed under the Apache License, version 2.0
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12* Development 2012-2013 by School of Earth Sciences
13* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14* Development from 2019 by School of Earth and Environmental Sciences
15**
16*****************************************************************************/
17
18#ifndef __DUDLEY_NODEFILE_H__
19#define __DUDLEY_NODEFILE_H__
20
21#include "Dudley.h"
22#include "NodeMapping.h"
23
24#include <escript/Distribution.h>
25
26#ifdef ESYS_HAVE_PASO
27#include <paso/Coupler.h>
28#endif
29#ifdef ESYS_HAVE_TRILINOS
30#include <trilinoswrap/types.h>
31#endif
32
33namespace escript {
34 struct IndexList;
35}
36
37namespace dudley {
38
40{
41public:
42
46
48 ~NodeFile();
49
52
54 void freeTable();
55
56 void print() const;
57
58 inline index_t getFirstNode() const;
59 inline index_t getLastNode() const;
60 inline dim_t getGlobalNumNodes() const;
61 inline const index_t* borrowGlobalNodesIndex() const;
62
64 inline dim_t getNumNodes() const;
65
67 inline dim_t getNumDegreesOfFreedom() const;
68
71
73 inline const index_t* borrowNodesTarget() const;
74
76 inline const index_t* borrowDegreesOfFreedomTarget() const;
77
79 inline const index_t* borrowTargetDegreesOfFreedom() const;
80
82 inline const index_t* borrowTargetNodes() const;
83
84 inline void updateTagList();
85
89
92
94 const IndexVector& nodeDistribution);
95
96 void assignMPIRankToDOFs(int* mpiRankOfDOF,
97 const IndexVector& distribution);
98
99 void copyTable(index_t offset, index_t idOffset, index_t dofOffset,
100 const NodeFile* in);
101
105 void gather(const index_t* index, const NodeFile* in);
106
107 void gather_global(const index_t* index, const NodeFile* in);
108
109 void setCoordinates(const escript::Data& newX);
110
112 void setTags(int newTag, const escript::Data& mask);
113
114 std::pair<index_t,index_t> getDOFRange() const;
115
116#ifdef ESYS_HAVE_TRILINOS
117 void createTrilinosGraph(const escript::IndexList* indexList);
118 esys_trilinos::const_TrilinosGraph_ptr getTrilinosGraph() const {
119 return m_graph;
120 }
121#endif
122
123private:
124 std::pair<index_t,index_t> getGlobalIdRange() const;
125 std::pair<index_t,index_t> getGlobalDOFRange() const;
126 std::pair<index_t,index_t> getGlobalNodeIDIndexRange() const;
127 dim_t prepareLabeling(const std::vector<short>& mask, IndexVector& buffer,
128 IndexVector& distribution, bool useNodes);
130
133
136
137#ifdef ESYS_HAVE_TRILINOS
139 esys_trilinos::const_TrilinosGraph_ptr m_graph;
140#endif
141
142public:
150 int* Tag;
152 std::vector<int> tagsInUse;
153
159 double* Coordinates;
162
165
168
169#ifdef ESYS_HAVE_PASO
170 paso::Connector_ptr degreesOfFreedomConnector;
171#endif
172 // these are the packed versions of Id
174
178};
179
180//
181// implementation of inline methods
182//
183
185{
186 return nodesDistribution->getFirstComponent();
187}
188
190{
191 return nodesDistribution->getLastComponent();
192}
193
195{
196 return nodesDistribution->getGlobalNumComponents();
197}
198
200{
201 return globalNodesIndex;
202}
203
205{
206 return numNodes;
207}
208
210{
211 return dofDistribution->getMyNumComponents();
212}
213
218
220{
221 return nodesMapping.map;
222}
223
228
230{
231 return nodesMapping.target;
232}
233
238
243
244
245} // namespace dudley
246
247#endif // __DUDLEY_NODEFILE_H__
248
Definition dudley/src/NodeFile.h:40
NodeMapping degreesOfFreedomMapping
Definition dudley/src/NodeFile.h:132
std::pair< index_t, index_t > getGlobalNodeIDIndexRange() const
Definition dudley/src/NodeFile.cpp:167
int numDim
number of spatial dimensions
Definition dudley/src/NodeFile.h:146
~NodeFile()
destructor
Definition dudley/src/NodeFile.cpp:58
escript::Distribution_ptr dofDistribution
MPI distribution of degrees of freedom.
Definition dudley/src/NodeFile.h:167
dim_t createDenseNodeLabeling(IndexVector &nodeDistribution, const IndexVector &dofDistribution)
index_t * globalNodesIndex
assigns each local node a global unique ID in a dense labeling
Definition dudley/src/NodeFile.h:161
index_t * degreesOfFreedomId
Definition dudley/src/NodeFile.h:173
const index_t * borrowNodesTarget() const
returns the mapping from target to the local nodes
Definition dudley/src/NodeFile.h:219
void setTags(int newTag, const escript::Data &mask)
set tags to newTag where mask > 0
Definition dudley/src/NodeFile.cpp:201
dim_t getNumNodes() const
returns the number of FEM nodes (on this rank)
Definition dudley/src/NodeFile.h:204
dim_t prepareLabeling(const std::vector< short > &mask, IndexVector &buffer, IndexVector &distribution, bool useNodes)
const index_t * borrowTargetDegreesOfFreedom() const
returns the mapping from local degrees of freedom to a target
Definition dudley/src/NodeFile.h:234
void setCoordinates(const escript::Data &newX)
Definition dudley/src/NodeFile.cpp:172
void gather(const index_t *index, const NodeFile *in)
Definition NodeFile_gather.cpp:77
std::pair< index_t, index_t > getGlobalDOFRange() const
Definition dudley/src/NodeFile.cpp:162
dim_t createDenseDOFLabeling()
Definition NodeFile_createDenseLabelings.cpp:22
void createNodeMappings(const IndexVector &dofDistribution, const IndexVector &nodeDistribution)
Definition NodeFile_createMappings.cpp:224
const index_t * borrowGlobalNodesIndex() const
Definition dudley/src/NodeFile.h:199
std::pair< index_t, index_t > getDOFRange() const
Definition dudley/src/NodeFile.cpp:146
index_t * globalDegreesOfFreedom
Definition dudley/src/NodeFile.h:157
dim_t getNumDegreesOfFreedom() const
returns the number of degrees of freedom (on this rank)
Definition dudley/src/NodeFile.h:209
void print() const
Definition dudley/src/NodeFile.cpp:108
std::vector< int > tagsInUse
vector of tags which are actually used
Definition dudley/src/NodeFile.h:152
void assignMPIRankToDOFs(int *mpiRankOfDOF, const IndexVector &distribution)
Definition dudley/src/NodeFile.cpp:220
dim_t getGlobalNumNodes() const
Definition dudley/src/NodeFile.h:194
void freeTable()
empties the node table and frees all memory
Definition dudley/src/NodeFile.cpp:90
const index_t * borrowTargetNodes() const
returns the mapping from local nodes to a target
Definition dudley/src/NodeFile.h:229
index_t getLastNode() const
Definition dudley/src/NodeFile.h:189
dim_t numNodes
number of nodes
Definition dudley/src/NodeFile.h:135
NodeMapping nodesMapping
Definition dudley/src/NodeFile.h:131
int status
Definition dudley/src/NodeFile.h:177
void copyTable(index_t offset, index_t idOffset, index_t dofOffset, const NodeFile *in)
Definition dudley/src/NodeFile.cpp:125
void createDOFMappingAndCoupling()
Definition NodeFile_createMappings.cpp:29
escript::JMPI MPIInfo
MPI information.
Definition dudley/src/NodeFile.h:144
index_t getFirstNode() const
Definition dudley/src/NodeFile.h:184
dim_t getNumDegreesOfFreedomTargets() const
returns the number of degrees of freedom targets (own and shared)
Definition dudley/src/NodeFile.h:214
void gather_global(const index_t *index, const NodeFile *in)
Definition NodeFile_gather.cpp:85
NodeFile(int nDim, escript::JMPI MPIInfo)
Definition dudley/src/NodeFile.cpp:44
const index_t * borrowDegreesOfFreedomTarget() const
returns the mapping from target to the local degrees of freedom
Definition dudley/src/NodeFile.h:224
void allocTable(dim_t numNodes)
allocates the node table within this node file to hold numNodes nodes.
Definition dudley/src/NodeFile.cpp:63
std::pair< index_t, index_t > getGlobalIdRange() const
Definition dudley/src/NodeFile.cpp:157
int * Tag
Tag[i] is the tag of node i.
Definition dudley/src/NodeFile.h:150
void updateTagList()
Definition dudley/src/NodeFile.h:239
double * Coordinates
Coordinates[INDEX2(k,i,numDim)] is the k-th coordinate of node i.
Definition dudley/src/NodeFile.h:159
escript::Distribution_ptr nodesDistribution
MPI distribution of nodes.
Definition dudley/src/NodeFile.h:164
index_t * Id
Id[i] is the unique ID number of FEM node i.
Definition dudley/src/NodeFile.h:148
Data represents a collection of datapoints.
Definition Data.h:64
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition dudley/src/Util.cpp:224
A suite of factory methods for creating 2D and 3D dudley domains.
Definition dudley/src/Assemble.h:32
std::vector< index_t > IndexVector
Definition DataTypes.h:64
index_t dim_t
Definition DataTypes.h:66
int index_t
type for array/matrix indices used both globally and on each rank
Definition DataTypes.h:61
Definition AbstractContinuousDomain.cpp:23
boost::shared_ptr< Distribution > Distribution_ptr
Definition Distribution.h:26
boost::shared_ptr< JMPI_ > JMPI
Definition EsysMPI.h:76
boost::shared_ptr< Connector > Connector_ptr
Definition Coupler.h:39
Definition dudley/src/NodeMapping.h:28
index_t * map
maps the target nodes back to the FEM nodes: target[map[i]]=i
Definition dudley/src/NodeMapping.h:99
dim_t numTargets
size of map (number of target nodes, e.g. DOF, reduced DOF, etc.)
Definition dudley/src/NodeMapping.h:96
index_t * target
target[i] defines the target of FEM node i=0,...,numNodes
Definition dudley/src/NodeMapping.h:93
Definition escriptcore/src/IndexList.h:29