Branch data Line data Source code
1 : : //-------------------------------------------------------------------------
2 : : // Filename : PartSurfFacetTool.hpp
3 : : //
4 : : // Purpose : Code for initializing PartitionSurface facetting and
5 : : // other misc. facet-related code moved from PartitionSurf.
6 : : //
7 : : // Special Notes :
8 : : //
9 : : // Creator : Jason Kraftcheck
10 : : //
11 : : // Creation Date : 03/11/04
12 : : //-------------------------------------------------------------------------
13 : :
14 : :
15 : : #ifndef PART_SURF_FACET_TOOL_HPP
16 : : #define PART_SURF_FACET_TOOL_HPP
17 : :
18 : : #include <set>
19 : : #include <DLIList.hpp>
20 : :
21 : : class CubitVector;
22 : : class Curve;
23 : :
24 : : class PartitionSurface;
25 : : class PartitionCurve;
26 : : class PartitionPoint;
27 : :
28 : : class CubitFacet;
29 : : class CubitFacetEdge;
30 : : class CubitPoint;
31 : :
32 : : class CubitFacetData;
33 : : class CubitFacetEdgeData;
34 : : class CubitPointData;
35 : :
36 [ # # ]: 0 : class PartSurfFacetTool
37 : : {
38 : :
39 : : public:
40 : :
41 : : /** Interface for initializing PartitionSurface facets */
42 : :
43 : : PartSurfFacetTool(PartitionSurface* surface);
44 : :
45 : : CubitStatus init_facet_data( DLIList<CubitFacetData*>& facets );
46 : :
47 : : /** Debugging functions */
48 : : static void validate_facets(PartitionSurface* surf);
49 : :
50 : : /** Remove small edges */
51 : :
52 : : /** Misc. static utility functions */
53 : :
54 : : static CubitStatus split_edge( CubitFacetEdge* edge_to_split,
55 : : const CubitVector& split_location,
56 : : CubitFacet* edge_facet,
57 : : CubitPoint*& new_split_point,
58 : : CubitFacetEdge*& new_edge,
59 : : CubitFacet*& new_facet );
60 : : //- Split a facet edge and any adjacent facets.
61 : : //I edge_to_split
62 : : //I- The edge to split
63 : : //I split_location
64 : : //I- The location at which to split the edge
65 : : //I edge_facet
66 : : //I- Optional argument - facet adjacent to edge
67 : : //O new_split_point
68 : : //O- The new point splitting the edge
69 : : //O new_Edge
70 : : //O- The new edge (from new_split_point to the original end point)
71 : : //O new_facet
72 : : //O- If edge_facet is not NULL, the new facet resulting from
73 : : //O- splitting edge_facet.
74 : :
75 : :
76 : : static CubitStatus collapse_edge( CubitPoint* keep_point,
77 : : CubitPoint* dead_point,
78 : : DLIList<CubitFacetData*>* unowned = 0 );
79 : : //- Combine the two passed points, removing the edge connecting
80 : : //- them and collapsing any facets adjacent to that edge.
81 : :
82 : : static CubitFacet* closest_facet( const CubitVector& input_position,
83 : : const DLIList<CubitFacetData*>& facets,
84 : : CubitVector& result_position );
85 : : //- Find the facet and point on that facet closest to the passed position.
86 : : //R CubitFacet*
87 : : //R- The closest facet
88 : : //I input_position
89 : : //I- The location to test
90 : : //O facets
91 : : //O- The set of facets to test
92 : : //O result_position
93 : : //O- The closest position on the returned facet.
94 : :
95 : :
96 : : static CubitStatus seam_curve( DLIList<CubitFacetEdgeData*>& new_edge_list,
97 : : PartitionCurve *curve,
98 : : DLIList <CubitFacetData*> &adjacent_facets,
99 : : DLIList <CubitFacetEdgeData*>* dead_edge_ptrs = 0 );
100 : : //- Given two lists of facet edges, the passed one and the one associated
101 : : //- with the passed curve, split and merge edges to seam the two lists
102 : : //- together.
103 : : //I new_edge_list
104 : : //I- The list of edges to seam
105 : : //I curve
106 : : //I- The curve who's edges are to be seamed with the input list.
107 : : //I adjacent_facets
108 : : //I- The list of un-owned facets which may need to be modified during
109 : : //I- this operation. For any owned facets, the owning PartitionSurface
110 : : //I- will be updated appropriately. For any un-owned facets, this list
111 : : //I- will be updated.
112 : :
113 : : static CubitPoint* split_edge_closest( CubitFacetEdgeData* edge,
114 : : const CubitVector& pos,
115 : : double tolerance,
116 : : CubitFacetEdgeData*& new_edge,
117 : : DLIList<CubitFacetData*>& new_facets );
118 : : //- If the input position is sufficiently close to the end of the passed
119 : : //- edge, return the corresponding end point of the edge. Otherwise
120 : : //- split the edge and any adjacent facets.
121 : : //-
122 : : //- Effects: For each adjacent facet that is split, if the facet has
123 : : //- an owning PartitionSurface, the owning surface will be
124 : : //- updated for the facet split. OTHERWISE the new facet
125 : : //- will be appended to new_facets.
126 : : //-
127 : : //- Notes: The edge is always split such that the original edge
128 : : //- is between the original start point and the new point
129 : : //- and the new edge contains the new point and the
130 : : //- original end point.
131 : : //-
132 : : //R CubitPoint*
133 : : //R- The new point used to split the edge, or the closest edge end
134 : : //R- point if the edge was not split.
135 : : //I edge
136 : : //I- The edge to split
137 : : //I pos
138 : : //I- The location at which to split the edge
139 : : //O new_edge
140 : : //O- The new edge, or NULL if the edge was not split.
141 : : //O new_facets
142 : : //O- New facets created by splitting un-owned facets adjacent to
143 : : //O- the input edge.
144 : :
145 : : static CubitStatus fix_move_point( CubitPoint* point,
146 : : const CubitVector& new_pos,
147 : : const DLIList<CubitFacetData*>& facets,
148 : : DLIList<CubitFacetData*>& old_facets,
149 : : DLIList<CubitFacetData*>& new_facets,
150 : : PartitionSurface* owning_surf = 0 );
151 : : //- Given a patch of facets, a point on the perimeter of that patch
152 : : //- of facets and a new position for that point, check if any re-facetting
153 : : //- is required keep from inverting facets, and if so refacet.
154 : : //I point
155 : : //I- The point to move
156 : : //I new_pos
157 : : //I- The desired new position for the point
158 : : //I facets
159 : : //I- The patch of facets
160 : : //O old_facets
161 : : //O- Facets removed during refacetting.
162 : : //O new_facets
163 : : //O- New facets created during refacetting.
164 : : //I owning_surf
165 : : //I- Optional argument. If specified, function assumes that all
166 : : //I- facets in passed list are owned by this surface. Uses facet
167 : : //I- owner rather than list search to see if facet is in list.
168 : :
169 : :
170 : :
171 : : static CubitStatus get_facet_points_and_edges(
172 : : const DLIList<CubitFacetData*>& facets,
173 : : DLIList<CubitPoint*>& boundary_points,
174 : : DLIList<CubitPoint*>& interior_points,
175 : : DLIList<CubitFacetEdge*>& boundary_edges,
176 : : DLIList<CubitFacetEdge*>& interior_edges );
177 : : //- Given a patch of facets, get all points and edges classified
178 : : //- as either boundary or interior.
179 : :
180 : :
181 : : private:
182 : :
183 : : static void edge_facets( CubitFacetEdge* edge,
184 : : const DLIList<CubitFacet*>& input_facets,
185 : : DLIList<CubitFacet*>& output_list );
186 : :
187 : : static void edge_facets( PartitionSurface* surface,
188 : : CubitFacetEdge* edge,
189 : : DLIList<CubitFacet*>& facets );
190 : :
191 : : /** Helper functions for init_facet_data */
192 : :
193 : : static void closest_pt_on_facet( CubitFacet* facet,
194 : : const CubitVector& input_position,
195 : : CubitVector& result_position );
196 : :
197 : :
198 : : CubitStatus seam_curves( DLIList<PartitionCurve*>& curve_list,
199 : : DLIList<CubitFacetEdge*>& edge_list,
200 : : DLIList<CubitFacetData*>& adjacent_facets );
201 : : //- Do seam_curve for the set of all partitions of a real curve.
202 : :
203 : : static CubitStatus associate_points( DLIList<CubitPoint*>& facet_points,
204 : : DLIList<PartitionPoint*>& geom_points );
205 : : //- For each pointin geom_points, find closest point in facet_points
206 : : //- and attach that facet point to the geometric point. If the geometric
207 : : //- point already has an attached facet point, the facet points are merged
208 : : //- such that the point from facet_points is destroyed during the merge.
209 : :
210 : : static Curve* get_real_curve( DLIList<PartitionCurve*>& curve_list,
211 : : PartitionPoint*& start_point,
212 : : PartitionPoint*& end_point );
213 : : //- Verify that the passed set of curves are exactly the set of
214 : : //- partitions of a single real curve. Return the real curve and
215 : : //- the PartitionPoints corresponding to the start and end of the
216 : : //- real curve.
217 : :
218 : : CubitStatus get_boundary_chain( CubitPoint* start_point,
219 : : CubitFacetEdge* start_edge,
220 : : CubitPoint* end_point,
221 : : DLIList<CubitFacetEdge*>& result );
222 : : //- Helper function for init_facet_data().
223 : : //- NOTE: expects marks on facet edges to be set by init_facet_data.().
224 : : //-
225 : : //- Given an edge and a point on that edge, find the chain of
226 : : //- boundary edges beginning with the edge and ending at the passesd
227 : : //- end point
228 : : //- Assumes: all boundary edges marked with a '1'.
229 : : //- chain of edges may not cross a vertex with more than
230 : : //- two adjacent boundaryt edges.
231 : : //- chain of edges may not corss a vertex owned by a
232 : : //- partition point.
233 : :
234 : : CubitStatus seam_nonmanifold_curves( DLIList<PartitionCurve*>& partitions,
235 : : DLIList<CubitFacetData*>& facet_list );
236 : : //- Helper function for init_facet_data()
237 : : //- Associate facet edges in the interior of the passed facet patch
238 : : //- with the passed list of partitions of a real, non-manifold curve.
239 : : //- NOTE: Assumes edges internal to the facet list have been marked
240 : : //- with a '2' by the caller.
241 : :
242 : :
243 : : std::set<CubitFacetEdge*> boundary_set, interior_set;
244 : : PartitionSurface *const mySurface;
245 : : };
246 : :
247 : 0 : inline PartSurfFacetTool::PartSurfFacetTool(PartitionSurface* surface)
248 [ # # ]: 0 : : mySurface(surface) {}
249 : :
250 : : #endif
|