|
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/EntityRanks.hpp> 00023 #include <stk_mesh/fem/CoordinateSystems.hpp> 00024 #include <stk_mesh/fem/TopologyDimensions.hpp> 00025 #include <stk_mesh/fem/TopologicalMetaData.hpp> 00026 00027 namespace stk { 00028 namespace mesh { 00029 namespace fixtures { 00030 00031 class QuadFixture { 00032 00033 public: 00034 typedef int Scalar ; 00035 typedef Field<Scalar, Cartesian> CoordFieldType; 00036 typedef Field<Scalar*,ElementNode> CoordGatherFieldType; 00037 00038 QuadFixture( stk::ParallelMachine pm, unsigned nx , unsigned ny ); 00039 00040 ~QuadFixture(); 00041 00042 const unsigned spatial_dimension; 00043 stk::mesh::MetaData meta_data ; 00044 stk::mesh::BulkData bulk_data ; 00045 stk::mesh::TopologicalMetaData top_data; 00046 stk::mesh::Part & quad_part ; 00047 CoordFieldType & coord_field ; 00048 CoordGatherFieldType & coord_gather_field ; 00049 const unsigned NX ; 00050 const unsigned NY ; 00051 00052 stk::mesh::EntityId node_id( unsigned ix , unsigned iy ) const 00053 { return 1 + ix + ( NX + 1 ) * iy ; } 00054 00055 stk::mesh::EntityId elem_id( unsigned ix , unsigned iy ) const 00056 { return 1 + ix + NX * iy ; } 00057 00058 stk::mesh::Entity * node( unsigned ix , unsigned iy ) const 00059 { return bulk_data.get_entity( top_data.node_rank , node_id(ix,iy) ); } 00060 00061 void node_ix_iy( EntityId entity_id, unsigned &ix , unsigned &iy ) const { 00062 entity_id -= 1; 00063 00064 ix = entity_id % (NX+1); 00065 entity_id /= (NX+1); 00066 00067 iy = entity_id; 00068 } 00069 00070 void elem_ix_iy( EntityId entity_id, unsigned &ix , unsigned &iy ) const { 00071 entity_id -= 1; 00072 00073 ix = entity_id % NX; 00074 entity_id /= NX; 00075 00076 iy = entity_id; 00077 } 00078 00079 stk::mesh::Entity * elem( unsigned ix , unsigned iy ) const 00080 { return bulk_data.get_entity( top_data.element_rank , elem_id(ix,iy) ); } 00081 00082 void generate_mesh( std::vector<EntityId> & element_ids_on_this_processor ); 00083 00084 void generate_mesh(); 00085 00086 private: 00087 00088 QuadFixture(); 00089 QuadFixture( const QuadFixture & ); 00090 QuadFixture & operator = ( const QuadFixture & ); 00091 }; 00092 00093 } // fixtures 00094 } // mesh 00095 } // stk 00096 #endif