MOAB: Mesh Oriented datABase  (version 5.4.0)
MeshDecorator.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2006 Lawrence Livermore National Laboratory.  Under
00005     the terms of Contract B545069 with the University of Wisconsin --
00006     Madison, Lawrence Livermore National Laboratory retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     (2006) kraftche@cae.wisc.edu
00024 
00025   ***************************************************************** */
00026 
00027 /** \file MeshDecorator.hpp
00028  *  \brief Definition of MBMesquite::MeshDecorator class
00029  *  \author Jason Kraftcheck
00030  */
00031 
00032 #ifndef MSQ_MESH_DECORATOR_HPP
00033 #define MSQ_MESH_DECORATOR_HPP
00034 
00035 #include "Mesquite.hpp"
00036 #include "MeshInterface.hpp"
00037 
00038 namespace MBMesquite
00039 {
00040 
00041 /**\brief Utility class for implementing decorators for the MBMesquite::Mesh interface
00042  *
00043  * This is a utility class that to assist with implementing decorators
00044  * for the MBMesquite::Mesh interface.  This class implements a "dumb"
00045  * decorator that passes all operations to its underlying (decorated)
00046  * Mesh instance unchanged.  The intention is that useful decorators
00047  * subclass this class, overriding only those functions for which they
00048  * modify the behavioir.
00049  */
00050 class MESQUITE_EXPORT MeshDecorator : public Mesh
00051 {
00052   private:
00053     Mesh* myMesh;  //< The actual Mesh this instance decorates
00054 
00055   protected:
00056     void set_mesh( Mesh* mesh );
00057 
00058   public:
00059     MeshDecorator();
00060     MeshDecorator( Mesh* real_mesh );
00061 
00062     virtual ~MeshDecorator();
00063 
00064     /**\brief Get the real Mesh instance */
00065     Mesh* get_mesh() const
00066     {
00067         return myMesh;
00068     }
00069 
00070     //************ Operations on entire mesh ****************
00071 
00072     virtual int get_geometric_dimension( MsqError& err );
00073 
00074     virtual void get_all_elements( std::vector< ElementHandle >& elements, MsqError& err );
00075 
00076     virtual void get_all_vertices( std::vector< VertexHandle >& vertices, MsqError& err );
00077 
00078     //************ Vertex Properties ********************
00079 
00080     virtual void vertices_get_fixed_flag( const VertexHandle vert_array[],
00081                                           std::vector< bool >& fixed_flag_array,
00082                                           size_t num_vtx,
00083                                           MsqError& err );
00084 
00085     virtual void vertices_get_slaved_flag( const VertexHandle vert_array[],
00086                                            std::vector< bool >& slaved_flag_array,
00087                                            size_t num_vtx,
00088                                            MsqError& err );
00089 
00090     virtual void vertices_get_coordinates( const VertexHandle vert_array[],
00091                                            MsqVertex* coordinates,
00092                                            size_t num_vtx,
00093                                            MsqError& err );
00094 
00095     virtual void vertex_set_coordinates( VertexHandle vertex, const Vector3D& coordinates, MsqError& err );
00096 
00097     virtual void vertex_set_byte( VertexHandle vertex, unsigned char byte, MsqError& err );
00098 
00099     virtual void vertices_set_byte( const VertexHandle* vert_array,
00100                                     const unsigned char* byte_array,
00101                                     size_t array_size,
00102                                     MsqError& err );
00103 
00104     virtual void vertex_get_byte( const VertexHandle vertex, unsigned char* byte, MsqError& err );
00105 
00106     virtual void vertices_get_byte( const VertexHandle* vertex,
00107                                     unsigned char* byte_array,
00108                                     size_t array_size,
00109                                     MsqError& err );
00110 
00111     //**************** Vertex Topology *****************
00112 
00113     virtual void vertices_get_attached_elements( const VertexHandle* vertex_array,
00114                                                  size_t num_vertex,
00115                                                  std::vector< ElementHandle >& elements,
00116                                                  std::vector< size_t >& offsets,
00117                                                  MsqError& err );
00118 
00119     //*************** Element Topology *************
00120 
00121     virtual void elements_get_attached_vertices( const ElementHandle* elem_handles,
00122                                                  size_t num_elems,
00123                                                  std::vector< VertexHandle >& vert_handles,
00124                                                  std::vector< size_t >& offsets,
00125                                                  MsqError& err );
00126 
00127     virtual void elements_get_topologies( const ElementHandle* element_handle_array,
00128                                           EntityTopology* element_topologies,
00129                                           size_t num_elements,
00130                                           MsqError& err );
00131 
00132     //***************  Tags  ***********
00133 
00134     virtual TagHandle tag_create( const std::string& tag_name,
00135                                   TagType type,
00136                                   unsigned length,
00137                                   const void* default_value,
00138                                   MsqError& err );
00139 
00140     virtual void tag_delete( TagHandle handle, MsqError& err );
00141 
00142     virtual TagHandle tag_get( const std::string& name, MsqError& err );
00143 
00144     virtual void tag_properties( TagHandle handle,
00145                                  std::string& name_out,
00146                                  TagType& type_out,
00147                                  unsigned& length_out,
00148                                  MsqError& err );
00149 
00150     virtual void tag_set_element_data( TagHandle handle,
00151                                        size_t num_elems,
00152                                        const ElementHandle* elem_array,
00153                                        const void* tag_data,
00154                                        MsqError& err );
00155 
00156     virtual void tag_set_vertex_data( TagHandle handle,
00157                                       size_t num_elems,
00158                                       const VertexHandle* node_array,
00159                                       const void* tag_data,
00160                                       MsqError& err );
00161 
00162     virtual void tag_get_element_data( TagHandle handle,
00163                                        size_t num_elems,
00164                                        const ElementHandle* elem_array,
00165                                        void* tag_data,
00166                                        MsqError& err );
00167 
00168     virtual void tag_get_vertex_data( TagHandle handle,
00169                                       size_t num_elems,
00170                                       const VertexHandle* node_array,
00171                                       void* tag_data,
00172                                       MsqError& err );
00173 
00174     //**************** Memory Management ****************
00175 
00176     virtual void release_entity_handles( const EntityHandle* handle_array, size_t num_handles, MsqError& err );
00177 
00178     virtual void release();
00179 };
00180 
00181 }  // namespace MBMesquite
00182 
00183 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines