DofMapper.hpp

00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00009 #ifndef stk_linsys_DofMapper_hpp
00010 #define stk_linsys_DofMapper_hpp
00011 
00012 #include <map>
00013 
00014 #include <stk_util/parallel/Parallel.hpp>
00015 #include <stk_mesh/base/Field.hpp>
00016 #include <stk_mesh/base/BulkData.hpp>
00017 
00018 #include <stk_linsys/FieldIdMap.hpp>
00019 #include <stk_linsys/FeiBaseIncludes.hpp>
00020 
00021 namespace stk {
00024 namespace linsys {
00025 
00052 class DofMapper {
00053  public:
00055   DofMapper(MPI_Comm comm, bool create_reverse_mappings=true);
00056 
00058 //  DofMapper(fei::SharedPtr<fei::VectorSpace> vspace, bool create_reverse_mappings=true);
00059 
00061   virtual ~DofMapper();
00062 
00075   void add_dof_mappings( const stk::mesh::BulkData& mesh_bulk,
00076                          const stk::mesh::PartVector& part_intersection,
00077                          stk::mesh::EntityType ent_type,
00078                          const stk::mesh::FieldBase& field );
00079 
00088   void finalize();
00089 
00093   bool reverse_mappings_enabled() const { return m_reverse_mappings_enabled; }
00094 
00098   int get_field_id(const stk::mesh::FieldBase& field) const;
00099 
00107   int get_global_index(stk::mesh::EntityType ent_type,
00108                        stk::mesh::EntityId ent_id,
00109                        stk::mesh::FieldBase& field,
00110                        int offset_into_field=0);
00111 
00117   void get_dof(int global_index,
00118                stk::mesh::EntityType& ent_type,
00119                stk::mesh::EntityId& ent_id,
00120                const stk::mesh::FieldBase*& field,
00121                int& offset_into_field) const;
00122 
00125   const fei::SharedPtr<fei::VectorSpace> get_fei_VectorSpace() const { return m_fei_vecspace; }
00126 
00129   fei::SharedPtr<fei::VectorSpace> get_fei_VectorSpace() { return m_fei_vecspace; }
00130 
00131   const FieldIdMap& get_FieldIdMap() const { return m_field_id_map; }
00132 
00133   FieldIdMap& get_FieldIdMap() { return m_field_id_map; }
00134 
00135  private:
00136 
00137   FieldIdMap m_field_id_map;
00138 
00139   //we store the fei::VectorSpace in a fei::SharedPtr because other fei APIs expect it
00140   //to be that way. e.g., the constructor for fei::MatrixGraph requires a VectorSpace in a
00141   //fei::SharedPtr...
00142   fei::SharedPtr<fei::VectorSpace> m_fei_vecspace;
00143   bool m_reverse_mappings_enabled;
00144   fei::ReverseMapper* m_fei_reversemap;
00145 
00146   DofMapper(const DofMapper &);
00147   void operator = (const DofMapper &);
00148 };//class DofMapper
00149 
00152 }//namespace linsys
00153 }//namespace stk
00154 
00155 #endif
00156 

Generated on Tue Jul 13 09:27:32 2010 for Sierra Toolkit by  doxygen 1.4.7