Sierra Toolkit Version of the Day
GeneratedMesh.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_IO_UTIL_GENERATEDMESH_HPP
00010 #define STK_IO_UTIL_GENERATEDMESH_HPP
00011 #include <string>
00012 #include <vector>
00013 
00014 namespace stk {
00015   namespace io {
00016     namespace util {
00017       class GeneratedMesh
00018       {
00019       public:
00020   enum ShellLocation {MX =  0,  PX =  1,
00021           MY =  2,  PY =  3,
00022           MZ =  4,  PZ =  5};
00023 
00158   explicit GeneratedMesh(const std::string &parameters, int proc_count = 1, int my_proc = 0);
00159   GeneratedMesh(int num_x, int num_y, int num_z,        int proc_count = 1, int my_proc = 0);
00160   ~GeneratedMesh();
00161 
00175   size_t add_shell_block(ShellLocation loc);
00176     
00190   size_t add_nodeset(ShellLocation loc);
00191     
00208   size_t add_sideset(ShellLocation loc);
00209     
00224   void set_scale(double scl_x, double scl_y, double scl_z);
00225   void set_offset(double off_x, double off_y, double off_z);
00226   void set_bbox(double xmin, double ymin, double zmin,
00227           double xmax, double ymax, double zmax);
00228   
00235   void set_rotation(const std::string &axis, double angle_degrees);
00236 
00240   size_t node_count() const;
00241 
00245   size_t node_count_proc() const;
00246 
00250   size_t block_count() const;
00251 
00255   size_t nodeset_count() const;
00256 
00260   size_t nodeset_node_count(size_t id) const;
00261 
00265   size_t nodeset_node_count_proc(size_t id) const;
00266 
00270   size_t sideset_count() const;
00271 
00275   size_t sideset_side_count(size_t id) const;
00276 
00281   size_t sideset_side_count_proc(size_t id) const;
00282 
00286   size_t element_count() const;
00287 
00291   size_t shell_element_count(ShellLocation) const;
00292 
00296   size_t element_count_proc() const;
00297 
00301   size_t shell_element_count_proc(ShellLocation) const;
00302 
00308   size_t element_count(size_t block_number) const;
00309 
00315   size_t element_count_proc(size_t block_number) const;
00316 
00322   std::pair<std::string, int>  topology_type(size_t block_number) const;
00323     
00324   size_t communication_node_count_proc() const;
00325   void node_communication_map(std::vector<int> &map, std::vector<int> &proc);
00326     
00332   void node_map(std::vector<int> &map);
00333 
00339   void element_map(size_t block_number, std::vector<int> &map) const;
00340 
00346   void element_map(std::vector<int> &map) const;
00347     
00355   void element_surface_map(ShellLocation loc, std::vector<int> &map) const;
00356     
00367   void connectivity(size_t block_number, std::vector<int> &connect) const;
00368 
00376   void coordinates(std::vector<double> &coord) const;
00377 
00384   void coordinates(std::vector<double> &x,
00385        std::vector<double> &y,
00386        std::vector<double> &z) const;
00387     
00393   void nodeset_nodes(size_t nset_id, std::vector<int> &nodes) const;
00394 
00404   void sideset_elem_sides(size_t nset_id, std::vector<int> &elem_sides) const;
00405 
00406       private:
00407     
00408   GeneratedMesh( const GeneratedMesh & );
00409   GeneratedMesh & operator = ( const GeneratedMesh & );
00410 
00411   void parse_options(const std::vector<std::string> &groups);
00412   void show_parameters() const;
00413   void initialize();
00414   
00415         std::vector<ShellLocation> shellBlocks;
00416   std::vector<ShellLocation> nodesets;
00417   std::vector<ShellLocation> sidesets;
00418         double rotmat[3][3];
00419   size_t numX, numY, numZ;
00420   size_t myNumZ, myStartZ;
00421 
00422   size_t processorCount;
00423   size_t myProcessor;
00424 
00425   double offX, offY, offZ; 
00426   double sclX, sclY, sclZ; 
00430   bool doRotation;
00431       };
00432     }
00433   }
00434 }
00435 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines