Nektar++
Python/MeshGraph.cpp
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: MeshGraph.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 MeshGraph.
32//
33////////////////////////////////////////////////////////////////////////////////
34
40
41using namespace Nektar;
42using namespace Nektar::SpatialDomains;
43
44/*
45 * @brief Simple wrapper to build Composite objects from lists of
46 * Geometry objects.
47 */
49{
50 CompositeSharedPtr composite = std::make_shared<Composite>();
51 composite->m_geomVec.clear();
52 for (int i = 0; i < py::len(geometries); i++)
53 {
54 composite->m_geomVec.emplace_back(
55 py::cast<GeometrySharedPtr>(geometries[i]));
56 }
57 return composite;
58}
59
60/**
61 * @brief MeshGraph exports.
62 */
63void export_MeshGraph(py::module &m)
64{
65 py::bind_map<LibUtilities::FieldMetaDataMap>(m, "FieldMetaDataMap");
66 py::bind_vector<std::vector<GeometrySharedPtr>>(m, "GeometryList");
67
68 py::class_<Composite, std::shared_ptr<Composite>>(m, "Composite")
69 .def(py::init<>())
70 .def(py::init<>(&Composite_Init))
71 .def_readwrite("geometries", &Composite::m_geomVec);
72
73 py::bind_map<PointGeomMap>(m, "PointGeomMap");
74 py::bind_map<SegGeomMap>(m, "SegGeomMap");
75 py::bind_map<QuadGeomMap>(m, "QuadGeomMap");
76 py::bind_map<TriGeomMap>(m, "TriGeomMap");
77 py::bind_map<TetGeomMap>(m, "TetGeomMap");
78 py::bind_map<PrismGeomMap>(m, "PrismGeomMap");
79 py::bind_map<PyrGeomMap>(m, "PyrGeomMap");
80 py::bind_map<HexGeomMap>(m, "HexGeomMap");
81 py::bind_map<CurveMap>(m, "CurveMap");
82 py::bind_map<CompositeMap>(m, "CompositeMap");
83 py::bind_map<std::map<int, CompositeMap>>(m, "DomainMap");
84
85 py::class_<MeshGraph, std::shared_ptr<MeshGraph>>(m, "MeshGraph")
86 .def(py::init<>())
87
88 .def("Empty", &MeshGraph::Empty)
89
90 .def("GetMeshDimension", &MeshGraph::GetMeshDimension)
91 .def("GetSpaceDimension", &MeshGraph::GetSpaceDimension)
92
93 .def("SetMeshDimension", &MeshGraph::SetMeshDimension)
94 .def("SetSpaceDimension", &MeshGraph::SetSpaceDimension)
95
96 .def("GetAllPointGeoms", &MeshGraph::GetAllPointGeoms,
97 py::return_value_policy::reference_internal)
98 .def("GetAllSegGeoms", &MeshGraph::GetAllSegGeoms,
99 py::return_value_policy::reference_internal)
100 .def("GetAllQuadGeoms", &MeshGraph::GetAllQuadGeoms,
101 py::return_value_policy::reference_internal)
102 .def("GetAllTriGeoms", &MeshGraph::GetAllTriGeoms,
103 py::return_value_policy::reference_internal)
104 .def("GetAllTetGeoms", &MeshGraph::GetAllTetGeoms,
105 py::return_value_policy::reference_internal)
106 .def("GetAllPrismGeoms", &MeshGraph::GetAllPrismGeoms,
107 py::return_value_policy::reference_internal)
108 .def("GetAllPyrGeoms", &MeshGraph::GetAllPyrGeoms,
109 py::return_value_policy::reference_internal)
110 .def("GetAllHexGeoms", &MeshGraph::GetAllHexGeoms,
111 py::return_value_policy::reference_internal)
112 .def("GetCurvedEdges", &MeshGraph::GetCurvedEdges,
113 py::return_value_policy::reference_internal)
114 .def("GetCurvedFaces", &MeshGraph::GetCurvedFaces,
115 py::return_value_policy::reference_internal)
116 .def("GetComposites", &MeshGraph::GetComposites,
117 py::return_value_policy::reference_internal)
118 .def<std::map<int, CompositeMap> &(MeshGraph::*)()>(
119 "GetDomain", &MeshGraph::GetDomain,
120 py::return_value_policy::reference_internal)
121
122 .def("GetMovement", &MeshGraph::GetMovement,
123 py::return_value_policy::reference_internal)
124
125 .def("GetNumElements", &MeshGraph::GetNumElements)
126
127 .def("SetExpansionInfosToEvenlySpacedPoints",
128 &MeshGraph::SetExpansionInfoToEvenlySpacedPoints)
129 .def("SetExpansionInfosToPolyOrder",
130 &MeshGraph::SetExpansionInfoToNumModes)
131 .def("SetExpansionInfosToPointOrder",
132 &MeshGraph::SetExpansionInfoToPointOrder);
133}
void export_MeshGraph(py::module &m)
MeshGraph exports.
CompositeSharedPtr Composite_Init(py::list geometries)
Base class for a spectral/hp element mesh.
Definition: MeshGraph.h:181
std::shared_ptr< Composite > CompositeSharedPtr
Definition: MeshGraph.h:135