|
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_GEARS_FIXTURE_HPP 00010 #define STK_MESH_FIXTURES_GEARS_FIXTURE_HPP 00011 00012 #include <vector> 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/FEMMetaData.hpp> 00023 #include <stk_mesh/fem/CoordinateSystems.hpp> 00024 #include <stk_mesh/fem/TopologyDimensions.hpp> 00025 00026 namespace stk_classic { 00027 namespace mesh { 00028 namespace fixtures { 00029 00030 class Gear; 00031 00032 struct GearParams { 00033 GearParams() 00034 : element_size(0.1), 00035 radius_min(0.6), 00036 radius_max(1.05), 00037 height_min(-0.4), 00038 height_max(0.4) 00039 {} 00040 00041 GearParams(double input_element_size, 00042 double input_radius_min, 00043 double input_radius_max, 00044 double input_height_min, 00045 double input_height_max) 00046 : element_size(input_element_size), 00047 radius_min(input_radius_min), 00048 radius_max(input_radius_max), 00049 height_min(input_height_min), 00050 height_max(input_height_max) 00051 {} 00052 00053 double element_size; 00054 double radius_min; 00055 double radius_max; 00056 double height_min; 00057 double height_max; 00058 }; 00059 00060 class GearsFixture{ 00061 public: 00062 00063 typedef Field< double , Cylindrical> CylindricalField ; 00064 typedef Field< double , Cartesian> CartesianField ; 00065 00066 enum { SpatialDimension = 3 }; 00067 00068 GearsFixture( stk_classic::ParallelMachine pm, size_t num_gears, 00069 GearParams gear_params=GearParams()); 00070 ~GearsFixture(); 00071 00072 void generate_mesh(); 00073 00074 const size_t NUM_GEARS; 00075 00076 fem::FEMMetaData meta_data; 00077 BulkData bulk_data; 00078 00079 const EntityRank element_rank; 00080 00081 Part & cylindrical_coord_part; 00082 Part & hex_part; 00083 Part & wedge_part; 00084 00085 CartesianField & cartesian_coord_field ; 00086 CartesianField & displacement_field ; 00087 CartesianField & translation_field ; 00088 CylindricalField & cylindrical_coord_field; 00089 00090 Gear & get_gear(size_t i) { 00091 return * m_gears[i]; 00092 } 00093 00094 const Gear & get_gear(size_t i) const{ 00095 return * m_gears[i]; 00096 } 00097 00098 void update_displacement_field(); 00099 00100 void communicate_model_fields(); 00101 00102 private: 00103 00104 std::vector<Gear *> m_gears; 00105 00106 GearsFixture( const GearsFixture & ); 00107 GearsFixture & operator = ( const GearsFixture & ); 00108 }; 00109 00111 void distribute_gear_across_processors(Gear & gear, GearsFixture::CylindricalField & cylindrical_coord_field); 00112 unsigned destination_processor(const Gear & gear, double rad, double angle, double height, unsigned p_rank, unsigned p_size); 00113 00114 } // fixtures 00115 } // mesh 00116 } // stk 00117 00118 #endif //STK_MESH_FIXTURES_GEARS_FIXTURE_HPP 00119