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 geom->Setup();
56 LibUtilities::PointsKeyVector p = geom->GetXmap()->GetPointsKeys();
57 GeomFactorsUniquePtr geomFactors = geom->GenGeomFactors(p);
58}
59
61{
62 geom->Setup();
63 LibUtilities::PointsKeyVector p = geom->GetXmap()->GetPointsKeys();
64 GeomFactorsUniquePtr geomFactors = geom->GenGeomFactors(p);
65 return geomFactors->IsValid();
66}
67
68void export_Geometry(py::module &m)
69{
70 py::classh<Geometry>(m, "Geometry")
71 .def("GetCoordim", &Geometry::GetCoordim)
72 .def("GetGlobalID", &Geometry::GetGlobalID)
73 .def("SetGlobalID", &Geometry::SetGlobalID)
74
75 .def("Setup", &Geometry::Setup)
76 .def("FillGeom", &Geometry::FillGeom)
77 .def("GenGeomFactors", &Geometry_GenGeomFactors)
78 .def("IsValid", &Geometry_IsValid)
79
80 .def("ContainsPoint", &Geometry_ContainsPoint)
81
82 .def("GetVertex", &Geometry::GetVertex,
83 py::return_value_policy::reference)
84 .def("GetEdge", &Geometry::GetEdge, py::return_value_policy::reference)
85 .def("GetFace", &Geometry::GetFace, py::return_value_policy::reference)
86 .def("GetVid", &Geometry::GetVid)
87 .def("GetEid", &Geometry::GetEid)
88 .def("GetFid", &Geometry::GetFid)
89 .def("GetTid", &Geometry::GetTid)
90
91 .def("GetNumVerts", &Geometry::GetNumVerts)
92 .def("GetNumEdges", &Geometry::GetNumEdges)
93 .def("GetNumFaces", &Geometry::GetNumFaces)
94 .def("GetShapeDim", &Geometry::GetShapeDim)
95 .def("GetShapeType", &Geometry::GetShapeType)
96 .def("GetEorient", &Geometry::GetEorient)
97 .def("GetForient", &Geometry::GetForient)
98
99 .def("GetXmap", &Geometry::GetXmap)
100 .def("GetCoeffs", &Geometry::GetCoeffs);
101}
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:84
LibUtilities::ShapeType GetShapeType(void)
Get the geometric shape type of this object.
Definition Geometry.h:294
void SetGlobalID(int globalid)
Set the ID of this object.
Definition Geometry.h:322
int GetNumFaces() const
Get the number of faces of this object.
Definition Geometry.h:411
int GetShapeDim() const
Get the object's shape dimension.
Definition Geometry.h:422
int GetVid(int i) const
Returns global id of vertex i of this object.
Definition Geometry.h:345
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:449
int GetGlobalID(void) const
Get the ID of this object.
Definition Geometry.h:314
PointGeom * GetVertex(int i) const
Returns vertex i of this object.
Definition Geometry.h:353
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition Geometry.h:277
int GetFid(int i) const
Get the ID of face i of this object.
Definition Geometry.cpp:91
void FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.
Definition Geometry.h:461
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition Geometry.h:440
int GetNumEdges() const
Get the number of edges of this object.
Definition Geometry.h:403
int GetNumVerts() const
Get the number of vertices of this object.
Definition Geometry.h:395
bool ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0)
Determine whether an element contains a particular Cartesian coordinate .
Definition Geometry.h:472
Geometry1D * GetEdge(int i) const
Returns edge i of this object.
Definition Geometry.h:361
Geometry2D * GetFace(int i) const
Returns face i of this object.
Definition Geometry.h:369
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:378
int GetTid(int i) const
Get the ID of trace i of this object.
Definition Geometry.h:333
int GetEid(int i) const
Get the ID of edge i of this object.
Definition Geometry.cpp:83
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:387
GeomFactorsUniquePtr GenGeomFactors(LibUtilities::PointsKeyVector &keyTgt)
Used by Expansion to generate associated GeomFactors.
Definition Geometry.h:430
std::vector< PointsKey > PointsKeyVector
Definition Points.h:313
unique_ptr_objpool< GeomFactors > GeomFactorsUniquePtr
Definition Geometry.h:62