Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
HigherOrderFactory.hpp
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain 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  */
00015 
00016 #ifndef MOAB_HIGHER_ORDER_FACTORY_HPP
00017 #define MOAB_HIGHER_ORDER_FACTORY_HPP
00018 
00019 #ifndef IS_BUILDING_MB
00020 #error "HigherOrderFactory.hpp isn't supposed to be included into an application"
00021 #endif
00022 
00023 #include "moab/Interface.hpp"
00024 
00025 namespace moab
00026 {
00027 
00028 class ElementSequence;
00029 class Core;
00030 
00031 /** \class HigherOrderFactory
00032  * \brief Functions for converting to/from higher-order elements
00033  *  \authors Clinton Stimpson
00034  *  \date    11/25/02
00035  *  \brief
00036  *
00037  */
00038 class HigherOrderFactory
00039 {
00040   public:
00041     HigherOrderFactory( Core*, Interface::HONodeAddedRemoved* function_object );
00042     ~HigherOrderFactory();
00043 
00044     ErrorCode convert( const EntityHandle meshset,
00045                        const bool mid_edge_nodes,
00046                        const bool mid_face_nodes,
00047                        const bool mid_volume_nodes );
00048 
00049     ErrorCode convert( const Range& entities,
00050                        const bool mid_edge_nodes,
00051                        const bool mid_face_nodes,
00052                        const bool mid_volume_nodes );
00053 
00054     unsigned char mNodeMap[MBMAXTYPE][8][8];
00055 
00056   private:
00057     // static bool mMapInitialized;
00058     void initialize_map();
00059 
00060     Core* mMB;
00061     Interface::HONodeAddedRemoved* mHONodeAddedRemoved;
00062 
00063     ErrorCode convert_sequence( ElementSequence* sequence,
00064                                 EntityHandle sequence_subset_start,
00065                                 EntityHandle sequence_subset_end,
00066                                 bool mid_edge_nodes,
00067                                 bool mid_face_nodes,
00068                                 bool mid_volume_nodes );
00069     ErrorCode add_mid_edge_nodes( ElementSequence* );
00070     ErrorCode add_mid_face_nodes( ElementSequence* );
00071     ErrorCode add_mid_volume_nodes( ElementSequence* );
00072 
00073     //! returns the handle of the first center node found between the two corner nodes.
00074     //! returns zero if none found
00075     //! entities that share those two corner nodes and have space allocated for mid-edge nodes are
00076     //! returned in a vector
00077     EntityHandle center_node_exist( EntityHandle corner1,
00078                                     EntityHandle corner2,
00079                                     std::vector< EntityHandle >& adj_entities );
00080 
00081     //! returns the handle of the first center node found between the 3-4 corner nodes.
00082     //! set the last node to zero if you want only 3 nodes
00083     //! returns zero if none found
00084     //! entities that share those corner nodes and have space allocated for mid face nodes are
00085     //! returned in a vector
00086     EntityHandle center_node_exist( EntityHandle corners[4], std::vector< EntityHandle >& adj_entities );
00087 
00088     //! adds a center node to element between corner nodes, returns success
00089     bool add_center_node( EntityType type,
00090                           EntityHandle* element_conn,
00091                           int conn_size,
00092                           EntityHandle corner_node1,
00093                           EntityHandle corner_node2,
00094                           EntityHandle center_node );
00095 
00096     ErrorCode copy_corner_nodes( ElementSequence* src, ElementSequence* dst );
00097     ErrorCode copy_mid_edge_nodes( ElementSequence* src, ElementSequence* dst );
00098     ErrorCode copy_mid_face_nodes( ElementSequence* src, ElementSequence* dst );
00099     ErrorCode copy_mid_volume_nodes( ElementSequence* src, ElementSequence* dst );
00100     ErrorCode copy_nodes( ElementSequence* src,
00101                           ElementSequence* dst,
00102                           unsigned nodes_per_elem_to_copy,
00103                           unsigned src_conn_offset,
00104                           unsigned dst_conn_offset );
00105 
00106     ErrorCode zero_mid_edge_nodes( ElementSequence* dst );
00107     ErrorCode zero_mid_face_nodes( ElementSequence* dst );
00108     ErrorCode zero_mid_volume_nodes( ElementSequence* dst );
00109     ErrorCode zero_nodes( ElementSequence* dst, unsigned nodes_per_elem_to_zero, unsigned dst_conn_offset );
00110 
00111     ErrorCode remove_mid_edge_nodes( ElementSequence* seq, EntityHandle start, EntityHandle stop, Tag deletable_ndoes );
00112     ErrorCode remove_mid_face_nodes( ElementSequence* seq, EntityHandle start, EntityHandle stop, Tag deletable_ndoes );
00113     ErrorCode remove_mid_volume_nodes( ElementSequence* seq,
00114                                        EntityHandle start,
00115                                        EntityHandle stop,
00116                                        Tag deletable_ndoes );
00117     ErrorCode remove_ho_nodes( ElementSequence* sequence,
00118                                EntityHandle subset_start_handle,
00119                                EntityHandle subset_end_handle,
00120                                int nodes_per_elem_to_remove,
00121                                int elem_conn_offset_to_remove,
00122                                Tag deletable_nodes );
00123     bool tag_for_deletion( EntityHandle element_with_node,
00124                            int node_index_in_elem_connectivity,
00125                            ElementSequence* sequence );
00126 };
00127 
00128 }  // namespace moab
00129 
00130 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines