Sierra Toolkit Version of the Day
generic_mesh_functions.hpp
00001 #ifndef STK_UTIL_GENERIC_MESH_FUNCTIONS_HPP
00002 #define STK_UTIL_GENERIC_MESH_FUNCTIONS_HPP
00003 
00004 namespace stk {
00005 
00006 // Generic API:  add_entity that uses default constructable entity_value type.
00007 template <typename Mesh>
00008 inline typename generic_mesh_traits<Mesh>::entity_local_id
00009 add_entity( Mesh & mesh );
00010 
00011 // Generic API:  Generic add_entity that takes a pre-constructed entity_value type.
00012 template <typename Mesh>
00013 inline typename generic_mesh_traits<Mesh>::entity_local_id
00014 add_entity( const typename generic_mesh_traits<Mesh>::entity_value & entity_value,
00015              Mesh & mesh );
00016 
00017 
00018 // Convenience function that also adds the entity to the range of parts.
00019 template <typename Mesh, typename PartInputIterator>
00020 inline typename generic_mesh_traits<Mesh>::entity_local_id
00021 add_entity(  PartInputIterator first, PartInputIterator last,
00022               Mesh & mesh );
00023 
00024 
00025 // Convenience function that also adds the entity to the range of parts.
00026 template <typename Mesh, typename PartInputIterator>
00027 inline typename generic_mesh_traits<Mesh>::entity_local_id
00028 add_entity( const typename generic_mesh_traits<Mesh>::entity_value & entity_value,
00029               PartInputIterator first, PartInputIterator last,
00030               Mesh & mesh );
00031 
00032 
00033 
00034 // Generic API:  remove this entity from the Mesh.
00035 template <typename Mesh>
00036 inline void
00037 remove_entity( typename generic_mesh_traits<Mesh>::entity_local_id entity_lid,
00038                 Mesh & mesh );
00039 
00040 // Generic API:  add this relation to the Mesh with default-constructed relation_value type.
00041 template <typename Mesh>
00042 inline generic_mesh_traits<Mesh>::relation_descriptor add_relation(
00043     generic_mesh_traits<Mesh>::entity_local_id entity_from,
00044     generic_mesh_traits<Mesh>::entity_local_id entity_to,
00045     Mesh & mesh
00046     );
00047 
00048 // Generic API:  add this relation to the Mesh with pre-constructed relation_value type.
00049 template <typename Mesh>
00050 inline generic_mesh_traits<Mesh>::relation_descriptor add_relation(
00051     generic_mesh_traits<Mesh>::entity_local_id entity_from,
00052     generic_mesh_traits<Mesh>::entity_local_id entity_to,
00053     const generic_mesh_traits<Mesh>::relation_value & relation,
00054     Mesh & mesh
00055     );
00056 
00057 
00058 // Generic API:  Remove this relation from the mesh.
00059 template <typename Mesh>
00060 inline void remove_relation( generic_mesh_traits<Mesh>::relation_descriptor relation_d, Mesh & mesh );
00061 
00062 
00063 // Generic API:  Get a const reference to the Entity from the entity_local_id.
00064 template <typename Mesh>
00065 inline const generic_mesh_traits<Mesh>::entity_value & get_entity(
00066     generic_mesh_traits<Mesh>::entity_local_id entity_lid,
00067     const Mesh & Mesh
00068     );
00069 
00070 
00071 // Generic API:  Get a const reference to the Entity from the entity_descriptor.
00072 template <typename Mesh>
00073 inline const generic_mesh_traits<Mesh>::entity_value & get_entity(
00074     generic_mesh_traits<Mesh>::entity_descriptor entity_d,
00075     const Mesh & Mesh
00076     );
00077 
00078 
00079 // Generic API:  Get an entity_descriptor from an entity_local_id
00080 template <typename Mesh>
00081 inline typename generic_mesh_traits<Mesh>::entity_local_id entity_descriptor_to_local_id(
00082     typename generic_mesh_traits<Mesh>::entity_descriptor entity_d,
00083     const Mesh & mesh
00084     );
00085 
00086 
00087 // Generic API:  Get an entity_local_id from an entity_descriptor.
00088 template <typename Mesh>
00089 inline typename generic_mesh_traits<Mesh>::entity_descriptor entity_local_id_to_descriptor(
00090     typename generic_mesh_traits<Mesh>::entity_local_id entity_lid,
00091     const Mesh & mesh
00092     );
00093 
00094 
00095 
00096 // Generic API:  Get a range to all entities in the mesh.
00097 template <typename Mesh>
00098 inline std::pair<
00099                   typename generic_mesh_traits<Mesh>::entity_descriptor_iterator,
00100                   typename generic_mesh_traits<Mesh>::entity_descriptor_iterator
00101                 >
00102   get_entities(Mesh & mesh);
00103 
00104 
00105 // Generic API:
00106 template <typename Mesh>
00107 inline
00108 std::pair<
00109           typename generic_mesh_traits<Mesh>::bucket_entity_descriptor_iterator,
00110           typename generic_mesh_traits<Mesh>::bucket_entity_descriptor_iterator
00111          >
00112   get_entities( typename generic_mesh_traits<Mesh>::bucket_descriptor bucket_descriptor,
00113                 Mesh & mesh
00114               );
00115 
00116 
00117 
00118 // Generic API:  Get a range to all the relations for this entity_local_id
00119 template <typename Mesh>
00120 inline std::pair<
00121                   typename generic_mesh_traits<Mesh>::relation_descriptor_iterator,
00122                   typename generic_mesh_traits<Mesh>::relation_descriptor_iterator
00123                 >
00124   get_relations( generic_mesh_traits<Mesh>::entity_local_id entity_lid, Mesh & mesh );
00125 
00126 
00127 // Generic API:  Get a range to all the relations for this entity_descriptor
00128 template <typename Mesh>
00129 inline std::pair<generic_mesh_traits<Mesh>::relation_descriptor_iterator, generic_mesh_traits<Mesh>::relation_descriptor_iterator>
00130   get_relations( generic_mesh_traits<Mesh>::entity_descriptor entity_d, Mesh & mesh );
00131 
00132 
00133 
00134 // Generic API:  Get a range to selected relations for this entity_local_id
00135 // Selector is a unary-predicate that takes a relation_descriptor and returns true/false
00136 template <typename Mesh, typename Selector>
00137 inline std::pair<generic_mesh_traits<Mesh>::selected_relation_descriptor_iterator,generic_mesh_traits<Mesh>::selected_relation_descriptor_iterator>
00138   get_relations(
00139       generic_mesh_traits<Mesh>::entity_local_id entity_lid,
00140       Selector & selector,
00141       Mesh & mesh
00142       );
00143 
00144 
00145 // Generic API:  Get a range to selected relations for this entity_descriptor
00146 // Selector is a unary-predicate that takes a relation_descriptor and returns true/false
00147 template <typename Mesh, typename Selector>
00148 inline std::pair<generic_mesh_traits<Mesh>::selected_relation_descriptor_iterator,generic_mesh_traits<Mesh>::selected_relation_descriptor_iterator>
00149   get_relations(
00150       generic_mesh_traits<Mesh>::entity_descriptor entity_d,
00151       Selector & selector,
00152       Mesh & mesh
00153       );
00154 
00155 
00156 // Generic API:  Get a bucket for an entity_descriptor
00157 template <typename Mesh>
00158 inline typename generic_mesh_traits<Mesh>::bucket_descriptor
00159 get_bucket( typename generic_mesh_traits<Mesh>::entity_descriptor entity,
00160                Mesh & mesh );
00161 
00162 
00163 // Generic API:  Get all buckets for the mesh
00164 template <typename Mesh>
00165 inline
00166 std::pair<
00167           typename generic_mesh_traits<Mesh>::bucket_descriptor_iterator,
00168           typename generic_mesh_traits<Mesh>::bucket_descriptor_iterator
00169          >
00170 get_buckets( const Mesh & mesh );
00171 
00172 
00173 // Generic API:  Get buckets associated with a Selector.
00174 // Selector is a unary-predicate that takes a bucket_descriptor and returns true/false
00175 template <typename Mesh, typename Selector >
00176 inline
00177 std::pair<
00178           typename generic_mesh_traits<Mesh>::selected_bucket_descriptor_iterator,
00179           typename generic_mesh_traits<Mesh>::selected_bucket_descriptor_iterator
00180          >
00181 get_buckets( const Selector & selector, Mesh & mesh );
00182 
00183 
00184 // Generic API:  Get buckets for a particular part_descriptor.
00185 template <typename Mesh>
00186 inline
00187 std::pair<
00188           typename generic_mesh_traits<Mesh>::part_bucket_descriptor_iterator,
00189           typename generic_mesh_traits<Mesh>::part_bucket_descriptor_iterator
00190          >
00191 get_buckets( typename generic_mesh_traits<Mesh>::part_descriptor part_descriptor,
00192                Mesh & mesh );
00193 
00194 
00195 
00196 // Generic API:  add this part to the Mesh.
00197 template <typename Mesh>
00198 inline typename generic_mesh_traits<Mesh>::part_descriptor
00199 add_part( const typename generic_mesh_traits<Mesh>::part_value & part_value,
00200          Mesh & mesh );
00201 
00202 
00203 // Generic API:  remove this part from the Mesh.
00204 template <typename Mesh>
00205 inline void
00206 remove_part( typename generic_mesh_traits<Mesh>::part_descriptor part_descriptor,
00207             Mesh & mesh );
00208 
00209 
00210 
00211 // Generic API:  Move entity so it
00212 // sits in Parts defined by AddPartInputIterator and
00213 // so it does not sit in Parts defined by RemovePartInputIterator
00214 template <typename Mesh, typename AddPartInputIterator, typename RemovePartInputIterator>
00215 inline typename generic_mesh_traits<Mesh>::bucket_descriptor
00216 move_entity( typename generic_mesh_traits<Mesh>::entity_descriptor entity_descriptor,
00217               AddPartInputIterator add_first, AddPartInputIterator add_last,
00218               RemovePartInputIterator remove_first, RemovePartInputIterator remove_last,
00219               Mesh & mesh );
00220 
00221 
00222 
00223 // Generic API:  Get all parts on the mesh.
00224 template <typename Mesh>
00225 inline
00226 std::pair<
00227           typename generic_mesh_traits<Mesh>::part_descriptor_iterator,
00228           typename generic_mesh_traits<Mesh>::part_descriptor_iterator
00229          >
00230 get_parts( const Mesh & mesh );
00231 
00232 
00233 // Generic API:  Get all Parts associated with a bucket.
00234 template <typename Mesh>
00235 inline
00236 std::pair<
00237           typename generic_mesh_traits<Mesh>::bucket_part_descriptor_iterator,
00238           typename generic_mesh_traits<Mesh>::bucket_part_descriptor_iterator
00239          >
00240 get_parts(
00241     typename generic_mesh_traits<Mesh>::bucket_descriptor bucket_descriptor,
00242     Mesh & mesh
00243     );
00244 
00245 // Generic API:  Begin modification cycle. Returns true if cycle was not already in progress
00246 template <typename Mesh>
00247 inline
00248 bool
00249 modification_begin( Mesh & mesh );
00250 
00251 // Generic API:  End modification cycle. Returns true if cycle was in progress.
00252 template <typename Mesh>
00253 inline
00254 bool
00255 modification_end( Mesh & mesh );
00256 
00257 // Generic API:  Query if we are in a modification cycle
00258 template <typename Mesh>
00259 inline
00260 bool
00261 is_modifiable( const Mesh & mesh );
00262 
00263 // Generic API:  Rotate the field data of multistate fields.
00264 template <typename Mesh>
00265 inline
00266 void
00267 rotate_multistate_fields( Mesh & mesh );
00268 
00269 } // namespace stk
00270 
00271 #endif // STK_UTIL_GENERIC_MESH_FUNCTIONS_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines