Mesh.h 5.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
////////////////////////////////////////////////////////////////////////////////
//
//  File: Mesh.h
//
//  For more information, please see: http://www.nektar.info/
//
//  The MIT License
//
//  Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
//  Department of Aeronautics, Imperial College London (UK), and Scientific
//  Computing and Imaging Institute, University of Utah (USA).
//
//  License for the specific language governing rights and limitations under
//  Permission is hereby granted, free of charge, to any person obtaining a
//  copy of this software and associated documentation files (the "Software"),
//  to deal in the Software without restriction, including without limitation
//  the rights to use, copy, modify, merge, publish, distribute, sublicense,
//  and/or sell copies of the Software, and to permit persons to whom the
//  Software is furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included
//  in all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
//  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
//  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
//  DEALINGS IN THE SOFTWARE.
//
Michael Turner's avatar
Michael Turner committed
32
//  Description: Mesh object.
33 34 35
//
////////////////////////////////////////////////////////////////////////////////

Michael Turner's avatar
Michael Turner committed
36 37 38 39
#ifndef NEKMESHUTILS_MESHELEMENTS_MESH
#define NEKMESHUTILS_MESHELEMENTS_MESH

#include <NekMeshUtils/NekMeshUtilsDeclspec.h>
40
#include <NekMeshUtils/MeshElements/Element.h>
Michael Turner's avatar
Michael Turner committed
41
#include <NekMeshUtils/MeshElements/Composite.h>
42 43 44

namespace Nektar
{
45
namespace NekMeshUtils
46
{
Michael Turner's avatar
Michael Turner committed
47 48 49 50

class Octree;
typedef boost::shared_ptr<Octree> OctreeSharedPtr;

51 52 53 54 55 56 57 58 59 60 61 62
/**
 * Enumeration of condition types (Dirichlet, Neumann, etc).
 */
enum ConditionType
{
    eDirichlet,
    eNeumann,
    eRobin,
    ePeriodic,
    eHOPCondition,
    SIZE_ConditionType
};
63

64 65 66 67 68 69 70 71 72 73
/**
 * @brief Defines a boundary condition.
 *
 * A boundary condition is defined by its type (e.g. Dirichlet), the
 * field it applies to, the value imposed on this field and the
 * composite which the boundary condition is applied to.
 */
struct Condition
{
    Condition() : type(), field(), value(), m_composite()
74
    {
75 76 77 78 79 80
    }
    std::vector<ConditionType> type;
    std::vector<std::string> field;
    std::vector<std::string> value;
    std::vector<int> m_composite;
};
81

82 83
typedef boost::shared_ptr<Condition> ConditionSharedPtr;
typedef std::map<int, ConditionSharedPtr> ConditionMap;
84

85 86
NEKMESHUTILS_EXPORT bool operator==(ConditionSharedPtr const &c1,
                                    ConditionSharedPtr const &c2);
87

88 89 90 91
class Mesh
{
public:
    NEKMESHUTILS_EXPORT Mesh() : m_verbose(false), m_nummode(0)
92
    {
93
    }
94

95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    /// Verbose flag
    bool                            m_verbose;
    /// Dimension of the expansion.
    unsigned int                    m_expDim;
    /// Dimension of the space in which the mesh is defined.
    unsigned int                    m_spaceDim;
    /// a order tag to aid output, a bit of a hack
    unsigned int                    m_nummode;
    ///
    unsigned int                    m_numcomp;
    /// List of mesh nodes.
    std::vector<NodeSharedPtr>      m_node;
    /// Set of element vertices.
    NodeSet                         m_vertexSet;
    /// used for meshing purposes to keep trac of ids
    int                             m_numNodes;
    /// Set of element edges.
    EdgeSet                         m_edgeSet;
    /// Set of element faces.
    FaceSet                         m_faceSet;
    /// Map for elements.
    ElementMap                      m_element;
    /// Map for composites.
    CompositeMap                    m_composite;
    /// Boundary conditions maps tag to condition.
    ConditionMap                    m_condition;
    /// List of fields names.
    std::vector<std::string>        m_fields;
    /// Map of vertex normals.
    boost::unordered_map<int, Node> m_vertexNormals;
    /// Set of all pairs of element ID and edge/face number on which to
    /// apply spherigon surface smoothing.
127
    std::set<std::pair<int, int> >  m_spherigonSurfs;
128
    /// List of face labels for composite annotation
Michael Turner's avatar
Michael Turner committed
129
    std::map<int, std::string>      m_faceLabels;
Michael Turner's avatar
Michael Turner committed
130
    /// CAD system pointer, if there is no cad its empty
Michael Turner's avatar
Michael Turner committed
131
    CADSystemSharedPtr              m_cad;
Michael Turner's avatar
Michael Turner committed
132
    /// Octree system pointer, if there is no octree its empty
Michael Turner's avatar
Michael Turner committed
133
    OctreeSharedPtr                 m_octree;
134

135

136 137 138 139 140 141 142 143
    /// Returns the total number of elements in the mesh with
    /// dimension expDim.
    NEKMESHUTILS_EXPORT unsigned int GetNumElements();
    /// Returns the total number of elements in the mesh with
    /// dimension < expDim.
    NEKMESHUTILS_EXPORT unsigned int GetNumBndryElements();
    /// Returns the total number of entities in the mesh.
    NEKMESHUTILS_EXPORT unsigned int GetNumEntities();
144

145 146
    NEKMESHUTILS_EXPORT void MakeOrder(int                      order,
                                       LibUtilities::PointsType distType);
147 148 149
};
/// Shared pointer to a mesh.
typedef boost::shared_ptr<Mesh> MeshSharedPtr;
150 151 152 153
}
}

#endif