Sierra Toolkit  Version of the Day
DofMapper.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #ifndef stk_linsys_DofMapper_hpp
10 #define stk_linsys_DofMapper_hpp
11 
12 #include <map>
13 
14 #include <stk_util/parallel/Parallel.hpp>
15 #include <stk_mesh/base/Field.hpp>
16 #include <stk_mesh/base/BulkData.hpp>
17 
18 #include <stk_linsys/FieldIdMap.hpp>
19 #include <stk_linsys/FeiBaseIncludes.hpp>
20 
21 namespace stk_classic {
24 namespace linsys {
25 
52 class DofMapper {
53  public:
55  DofMapper(MPI_Comm comm, bool create_reverse_mappings=true);
56 
58 // DofMapper(fei::SharedPtr<fei::VectorSpace> vspace, bool create_reverse_mappings=true);
59 
61  virtual ~DofMapper();
62 
71  void add_dof_mappings( const stk_classic::mesh::BulkData& mesh_bulk,
72  const stk_classic::mesh::Selector& selector,
73  stk_classic::mesh::EntityRank ent_type,
74  const stk_classic::mesh::FieldBase& field );
75 
84  void finalize();
85 
89  bool reverse_mappings_enabled() const { return m_reverse_mappings_enabled; }
90 
94  int get_field_id(const stk_classic::mesh::FieldBase& field) const;
95 
103  int get_global_index(stk_classic::mesh::EntityRank ent_type,
104  stk_classic::mesh::EntityId ent_id,
106  int offset_into_field=0);
107 
113  void get_dof(int global_index,
114  stk_classic::mesh::EntityRank& ent_type,
115  stk_classic::mesh::EntityId& ent_id,
116  const stk_classic::mesh::FieldBase*& field,
117  int& offset_into_field) const;
118 
121  const fei::SharedPtr<fei::VectorSpace> get_fei_VectorSpace() const { return m_fei_vecspace; }
122 
125  fei::SharedPtr<fei::VectorSpace> get_fei_VectorSpace() { return m_fei_vecspace; }
126 
127  const FieldIdMap& get_FieldIdMap() const { return m_field_id_map; }
128 
129  FieldIdMap& get_FieldIdMap() { return m_field_id_map; }
130 
131  private:
132 
133  FieldIdMap m_field_id_map;
134 
135  //we store the fei::VectorSpace in a fei::SharedPtr because other fei APIs expect it
136  //to be that way. e.g., the constructor for fei::MatrixGraph requires a VectorSpace in a
137  //fei::SharedPtr...
138  fei::SharedPtr<fei::VectorSpace> m_fei_vecspace;
139  bool m_reverse_mappings_enabled;
140  fei::ReverseMapper* m_fei_reversemap;
141 
142  DofMapper(const DofMapper &);
143  void operator = (const DofMapper &);
144 };//class DofMapper
145 
148 }//namespace linsys
149 }//namespace stk_classic
150 
151 #endif
152 
Field base class with an anonymous data type and anonymous multi-dimension.
Definition: FieldBase.hpp:53
const fei::SharedPtr< fei::VectorSpace > get_fei_VectorSpace() const
Definition: DofMapper.hpp:121
void get_dof(int global_index, stk_classic::mesh::EntityRank &ent_type, stk_classic::mesh::EntityId &ent_id, const stk_classic::mesh::FieldBase *&field, int &offset_into_field) const
Definition: DofMapper.cpp:169
This is a class for selecting buckets based on a set of meshparts and set logic.
Definition: Selector.hpp:112
std::map< const stk_classic::mesh::FieldBase *, int > FieldIdMap
Definition: FieldIdMap.hpp:20
fei::SharedPtr< fei::VectorSpace > get_fei_VectorSpace()
Definition: DofMapper.hpp:125
int get_field_id(const stk_classic::mesh::FieldBase &field) const
Definition: DofMapper.cpp:136
bool reverse_mappings_enabled() const
Definition: DofMapper.hpp:89
Manager for an integrated collection of entities, entity relations, and buckets of field data...
Definition: BulkData.hpp:49
void add_dof_mappings(const stk_classic::mesh::BulkData &mesh_bulk, const stk_classic::mesh::Selector &selector, stk_classic::mesh::EntityRank ent_type, const stk_classic::mesh::FieldBase &field)
Definition: DofMapper.cpp:50
Sierra Toolkit.
int get_global_index(stk_classic::mesh::EntityRank ent_type, stk_classic::mesh::EntityId ent_id, stk_classic::mesh::FieldBase &field, int offset_into_field=0)
Definition: DofMapper.cpp:142
DofMapper(MPI_Comm comm, bool create_reverse_mappings=true)
Definition: DofMapper.cpp:24