Nektar++
Loading...
Searching...
No Matches
Python/Geometry.cpp
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: Geometry.cpp
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Python wrapper for Geometry.
32//
33////////////////////////////////////////////////////////////////////////////////
34
38
42
43using namespace Nektar;
44using namespace Nektar::SpatialDomains;
45
46// Thin wrapper for ContainsPoint
48 const Array<OneD, const NekDouble> &gloCoord)
49{
50 return geom->ContainsPoint(gloCoord);
51}
52
54{
55 GeomFactorsSharedPtr geomFactors = geom->GetGeomFactors();
56}
57
59{
60 GeomFactorsSharedPtr geomFactors = geom->GetGeomFactors();
61 return geomFactors->IsValid();
62}
63
64void export_Geometry(py::module &m)
65{
66 py::classh<Geometry>(m, "Geometry")
67 .def("GetCoordim", &Geometry::GetCoordim)
68 .def("GetGlobalID", &Geometry::GetGlobalID)
69 .def("SetGlobalID", &Geometry::SetGlobalID)
70
71 .def("Setup", &Geometry::Setup)
72 .def("FillGeom", &Geometry::FillGeom)
73 .def("GenGeomFactors", &Geometry_GenGeomFactors)
74 .def("IsValid", &Geometry_IsValid)
75
76 .def("ContainsPoint", &Geometry_ContainsPoint)
77
78 .def("GetVertex", &Geometry::GetVertex,
79 py::return_value_policy::reference)
80 .def("GetEdge", &Geometry::GetEdge, py::return_value_policy::reference)
81 .def("GetFace", &Geometry::GetFace, py::return_value_policy::reference)
82 .def("GetVid", &Geometry::GetVid)
83 .def("GetEid", &Geometry::GetEid)
84 .def("GetFid", &Geometry::GetFid)
85 .def("GetTid", &Geometry::GetTid)
86
87 .def("GetNumVerts", &Geometry::GetNumVerts)
88 .def("GetNumEdges", &Geometry::GetNumEdges)
89 .def("GetNumFaces", &Geometry::GetNumFaces)
90 .def("GetShapeDim", &Geometry::GetShapeDim)
91 .def("GetShapeType", &Geometry::GetShapeType)
92 .def("GetEorient", &Geometry::GetEorient)
93 .def("GetForient", &Geometry::GetForient)
94
95 .def("GetXmap", &Geometry::GetXmap)
96 .def("GetCoeffs", &Geometry::GetCoeffs);
97}
bool Geometry_ContainsPoint(Geometry *geom, const Array< OneD, const NekDouble > &gloCoord)
void Geometry_GenGeomFactors(Geometry *geom)
void export_Geometry(py::module &m)
bool Geometry_IsValid(Geometry *geom)
Base class for shape geometry information.
Definition Geometry.h:74
LibUtilities::ShapeType GetShapeType(void)
Get the geometric shape type of this object.
Definition Geometry.h:314
void SetGlobalID(int globalid)
Set the ID of this object.
Definition Geometry.h:330
int GetNumFaces() const
Get the number of faces of this object.
Definition Geometry.h:419
int GetShapeDim() const
Get the object's shape dimension.
Definition Geometry.h:430
int GetVid(int i) const
Returns global id of vertex i of this object.
Definition Geometry.h:353
const Array< OneD, const NekDouble > & GetCoeffs(const int i) const
Return the coefficients of the transformation Geometry::m_xmap in coordinate direction i.
Definition Geometry.h:448
int GetGlobalID(void) const
Get the ID of this object.
Definition Geometry.h:322
PointGeom * GetVertex(int i) const
Returns vertex i of this object.
Definition Geometry.h:361
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition Geometry.h:279
int GetFid(int i) const
Get the ID of face i of this object.
Definition Geometry.cpp:118
void FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.
Definition Geometry.h:460
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition Geometry.h:439
int GetNumEdges() const
Get the number of edges of this object.
Definition Geometry.h:411
int GetNumVerts() const
Get the number of vertices of this object.
Definition Geometry.h:403
bool ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0)
Determine whether an element contains a particular Cartesian coordinate .
Definition Geometry.h:471
Geometry1D * GetEdge(int i) const
Returns edge i of this object.
Definition Geometry.h:369
Geometry2D * GetFace(int i) const
Returns face i of this object.
Definition Geometry.h:377
GeomFactorsSharedPtr GetGeomFactors()
Get the geometric factors for this object, generating them if required.
Definition Geometry.h:297
StdRegions::Orientation GetEorient(const int i) const
Returns the orientation of edge i with respect to the ordering of edges in the standard element.
Definition Geometry.h:386
int GetTid(int i) const
Get the ID of trace i of this object.
Definition Geometry.h:341
int GetEid(int i) const
Get the ID of edge i of this object.
Definition Geometry.cpp:110
StdRegions::Orientation GetForient(const int i) const
Returns the orientation of face i with respect to the ordering of faces in the standard element.
Definition Geometry.h:395
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition GeomFactors.h:58