|
Sierra Toolkit
Version of the Day
|
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_MESH_FIXTURES_QUAD_MESH_FIXTURE_HPP 00010 #define STK_MESH_FIXTURES_QUAD_MESH_FIXTURE_HPP 00011 00012 #include <Shards_BasicTopologies.hpp> 00013 00014 #include <stk_util/parallel/Parallel.hpp> 00015 00016 #include <stk_mesh/base/Types.hpp> 00017 #include <stk_mesh/base/MetaData.hpp> 00018 #include <stk_mesh/base/BulkData.hpp> 00019 #include <stk_mesh/base/Field.hpp> 00020 #include <stk_mesh/base/DataTraits.hpp> 00021 00022 #include <stk_mesh/fem/CoordinateSystems.hpp> 00023 #include <stk_mesh/fem/TopologyDimensions.hpp> 00024 #include <stk_mesh/fem/FEMMetaData.hpp> 00025 00026 namespace stk_classic { 00027 namespace mesh { 00028 namespace fixtures { 00029 00036 class QuadFixture 00037 { 00038 public: 00039 typedef int Scalar ; 00040 typedef Field<Scalar, Cartesian> CoordFieldType; 00041 typedef Field<Scalar*,ElementNode> CoordGatherFieldType; 00042 00047 QuadFixture( stk_classic::ParallelMachine pm, unsigned nx , unsigned ny ); 00048 00049 ~QuadFixture() {} 00050 00051 const unsigned m_spatial_dimension; 00052 fem::FEMMetaData m_fem_meta ; 00053 BulkData m_bulk_data ; 00054 Part & m_quad_part ; 00055 CoordFieldType & m_coord_field ; 00056 CoordGatherFieldType & m_coord_gather_field ; 00057 const unsigned m_nx ; 00058 const unsigned m_ny ; 00059 00064 EntityId node_id( unsigned x , unsigned y ) const 00065 { return 1 + x + ( m_nx + 1 ) * y ; } 00066 00071 EntityId elem_id( unsigned x , unsigned y ) const 00072 { return 1 + x + m_nx * y ; } 00073 00079 Entity * node( unsigned x , unsigned y ) const 00080 { return m_bulk_data.get_entity( fem::FEMMetaData::NODE_RANK , node_id(x, y) ); } 00081 00087 Entity * elem( unsigned x , unsigned y ) const 00088 { return m_bulk_data.get_entity( m_fem_meta.element_rank(), elem_id(x, y)); } 00089 00094 void node_x_y( EntityId entity_id, unsigned &x , unsigned &y ) const; 00095 00100 void elem_x_y( EntityId entity_id, unsigned &x , unsigned &y ) const; 00101 00105 void generate_mesh(); 00106 00107 private: 00108 void generate_mesh( std::vector<EntityId> & element_ids_on_this_processor ); 00109 00110 QuadFixture(); 00111 QuadFixture( const QuadFixture & ); 00112 QuadFixture & operator = ( const QuadFixture & ); 00113 }; 00114 00115 } // fixtures 00116 } // mesh 00117 } // stk 00118 #endif