NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
selectEnclosedPoints.C
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 #include "selectEnclosedPoints.H"
30 
31 #include <vtkGeometryFilter.h>
32 #include <vtkPointData.h>
33 #include <vtkSelectEnclosedPoints.h>
34 
35 /*
36 selectEnclosedPoints::selectEnclosedPoints(const meshBase *) {
37  vtkSmartPointer<vtkSelectEnclosedPoints> sep =
38  vtkSmartPointer<vtkSelectEnclosedPoints>::New();
39  vtkSmartPointer<vtkPolyData> pd = vtkSmartPointer<vtkPolyData>::New();
40  vtkSmartPointer<vtkDataSet> ds = vtkSmartPointer<vtkDataSet>::New();
41 
42  sep->SetInputData(ds);
43  sep->SetSurfaceData(pd);
44 
45  sep->Update();
46 
47  _output = sep->GetOutput();
48  _output->GetPointData()->GetScalars("SelectedPoints");
49 }
50 */
51 
52 vtkDataArray *selectEnclosedPoints::fromDataSet(vtkDataSet *mesh,
53  vtkDataSet *points) {
54  vtkSmartPointer<vtkGeometryFilter> gf =
56  vtkSmartPointer<vtkSelectEnclosedPoints> sep =
58 
59  // Send the input mesh to the Geometry Filter to convert to surface
60  gf->SetInputData(mesh);
61 
62  // Send input points and surface from Geometry Filter to Select Enclosed
63  // Points algorithm
64  sep->SetInputData(points);
65  sep->SetSurfaceConnection(gf->GetOutputPort());
66 
67  // Get the resulting mask.
68  return sep->GetOutput()->GetPointData()->GetScalars("SelectedPoints");
69 }
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
std::shared_ptr< meshBase > mesh
std::vector< vtkIdType > points
points given by id in .inp file
Definition: inpGeoMesh.C:133
static vtkDataArray * fromDataSet(vtkDataSet *mesh, vtkDataSet *points)
Select enclosed points.