49{
51
52 GetPot cl(argc, argv);
53
54 unsigned char dim = -1;
55 if (!cl.search("--dim"))
56 {
59 }
61
63
64 if (!cl.search("--input"))
65 {
66 libMesh::err <<
"No --input argument found!" << std::endl;
68 }
69 const char * meshname = cl.next("mesh.xda");
70
73
74 if (!cl.search("--newbcid"))
75 {
76 libMesh::err <<
"No --bcid argument found!" << std::endl;
78 }
80 bcid = cl.next(bcid);
81
82 Point minpt(-std::numeric_limits<Real>::max());
83#if LIBMESH_DIM > 1
84 minpt(1) = -std::numeric_limits<Real>::max();
85#endif
86#if LIBMESH_DIM > 2
87 minpt(2) = -std::numeric_limits<Real>::max();
88#endif
90
92 points(minpt, maxpt);
93
94 if (cl.search("--minnormalx"))
95 normals.min()(0) = cl.next(normals.min()(0));
96 if (cl.search("--maxnormalx"))
97 normals.max()(0) = cl.next(normals.max()(0));
98
99 if (cl.search("--minpointx"))
100 points.min()(0) = cl.next(points.min()(0));
101 if (cl.search("--maxpointx"))
102 points.max()(0) = cl.next(points.max()(0));
103
104#if LIBMESH_DIM > 1
105 if (cl.search("--minnormaly"))
106 normals.min()(1) = cl.next(normals.min()(1));
107 if (cl.search("--maxnormaly"))
108 normals.max()(1) = cl.next(normals.max()(1));
109
110 if (cl.search("--minpointy"))
111 points.min()(1) = cl.next(points.min()(1));
112 if (cl.search("--maxpointy"))
113 points.max()(1) = cl.next(points.max()(1));
114#endif
115
116#if LIBMESH_DIM > 2
117 if (cl.search("--minnormalz"))
118 normals.min()(2) = cl.next(normals.min()(2));
119 if (cl.search("--maxnormalz"))
120 normals.max()(2) = cl.next(normals.max()(2));
121
122 if (cl.search("--minpointz"))
123 points.min()(2) = cl.next(points.min()(2));
124 if (cl.search("--maxpointz"))
125 points.max()(2) = cl.next(points.max()(2));
126#endif
127
128 libMesh::out <<
"min point = " << points.min() << std::endl;
129 libMesh::out <<
"max point = " << points.max() << std::endl;
130 libMesh::out <<
"min normal = " << normals.min() << std::endl;
131 libMesh::out <<
"max normal = " << normals.max() << std::endl;
132
133 bool matcholdbcid = false;
135 if (cl.search("--oldbcid"))
136 {
137 matcholdbcid = true;
138 oldbcid = cl.next(oldbcid);
139 if (oldbcid < 0)
141 }
142
145 fe->attach_quadrature_rule(&qface);
146 const std::vector<Point> & face_points = fe->get_xyz();
147 const std::vector<Point> & face_normals = fe->get_normals();
148
149 for (
auto & elem :
mesh.element_ptr_range())
150 {
151 unsigned int n_sides = elem->n_sides();
152
153
154 std::vector<boundary_id_type> ids;
155
156 for (unsigned short s=0; s != n_sides; ++s)
157 {
158 if (elem->neighbor_ptr(s))
159 continue;
160
161 fe->reinit(elem,s);
162 const Point & p = face_points[0];
163 const Point & n = face_normals[0];
164
165
166
167
168
169
170 if (points.contains_point(p) &&
171 normals.contains_point(n))
172 {
173
175
176
177
179
180
182
183 if (matcholdbcid && b_id != oldbcid)
184 continue;
185
188
189
190 }
191 }
192 }
193
194
195
196
198
199 std::string outputname;
200 if (cl.search("--output"))
201 {
202 outputname = cl.next("mesh.xda");
203 }
204 else
205 {
206 outputname = "new.";
207 outputname += meshname;
208 }
209
210
212 libMesh::out <<
"Wrote mesh " << outputname << std::endl;
213
214 return 0;
215}
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
static const boundary_id_type invalid_id
Number used for internal use.
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure.
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.
void remove_side(const Elem *elem, const unsigned short int side)
Removes all boundary conditions associated with side side of element elem, if any exist.
Defines a Cartesian bounding box by the two corner extremum.
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
virtual void write(const std::string &name) const =0
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false, bool skip_detect_interior_parents=false)=0
Interfaces for reading/writing a mesh to/from a file.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
A Point defines a location in LIBMESH_DIM dimensional Real space.
This class implements specific orders of Gauss quadrature.
void usage_error(const char *progname)
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.