DataTransferKit - Multiphysics Solution Transfer Services  2.0
DTK_ProjectionPrimitives.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 /*
3  Copyright (c) 2012, Stuart R. Slattery
4  All rights reserved.
5 
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions are
8  met:
9 
10  *: Redistributions of source code must retain the above copyright
11  notice, this list of conditions and the following disclaimer.
12 
13  *: Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in the
15  documentation and/or other materials provided with the distribution.
16 
17  *: Neither the name of the University of Wisconsin - Madison nor the
18  names of its contributors may be used to endorse or promote products
19  derived from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 //---------------------------------------------------------------------------//
39 //---------------------------------------------------------------------------//
40 
41 #ifndef DTK_PROJECTIONPRIMITIVES_HPP
42 #define DTK_PROJECTIONPRIMITIVES_HPP
43 
44 #include <cmath>
45 
46 #include "DTK_DBC.hpp"
47 
48 #include <Teuchos_ParameterList.hpp>
49 
50 #include <Shards_CellTopology.hpp>
51 
52 #include <Intrepid_Basis.hpp>
53 #include <Intrepid_FieldContainer.hpp>
54 
55 namespace DataTransferKit
56 {
57 //---------------------------------------------------------------------------//
62 //---------------------------------------------------------------------------//
64 {
65  public:
66  // Get the center of the reference cell of the given topology.
67  static void referenceCellCenter( const shards::CellTopology &cell_topo,
68  Intrepid::FieldContainer<double> &center );
69 
70  // Determine if a point is within the volume of influence of a face.
71  static bool pointInFaceVolumeOfInfluence(
72  const Teuchos::ParameterList &parameters,
73  const Intrepid::FieldContainer<double> &point,
74  const Intrepid::FieldContainer<double> &face_nodes,
75  const Intrepid::FieldContainer<double> &face_node_normals,
76  const shards::CellTopology &face_topology );
77 
78  // Project a point onto a face and return the physical and parametric
79  // coordinates of the projected point on that face. This
80  // requires the solution of a nonlinear parameterized projection problem.
81  static void projectPointToFace(
82  const Teuchos::ParameterList &parameters,
83  const Intrepid::FieldContainer<double> &point,
84  const Intrepid::FieldContainer<double> &face_nodes,
85  const Intrepid::FieldContainer<double> &face_node_normals,
86  const shards::CellTopology &face_topology,
87  Intrepid::FieldContainer<double> &parametric_point,
88  Intrepid::FieldContainer<double> &physical_point, int &face_edge_id,
89  int &face_node_id );
90 
91  // Project a feature point to a feature edge.
92  static bool projectPointFeatureToEdgeFeature(
93  const Teuchos::ParameterList &parameters,
94  const Intrepid::FieldContainer<double> &point,
95  const Intrepid::FieldContainer<double> &point_normal,
96  const Intrepid::FieldContainer<double> &edge_nodes,
97  const Intrepid::FieldContainer<double> &edge_node_normals,
98  Intrepid::FieldContainer<double> &projected_point, int &edge_node_id );
99 
100  // Intersect two edges in 3 dimensions and return their intersection point
101  // realized on both edges.
102  static bool edgeEdgeIntersection(
103  const Teuchos::ParameterList &parameters,
104  const Intrepid::FieldContainer<double> &edge_1,
105  const Intrepid::FieldContainer<double> &edge_2,
106  const Intrepid::FieldContainer<double> &edge_2_node_normals,
107  Intrepid::FieldContainer<double> &edge_1_intersection,
108  Intrepid::FieldContainer<double> &edge_2_intersection,
109  int &edge_1_node_id, int &edge_2_node_id );
110 
111  private:
112  // Compute the distance of a projected point onto a bilinear surface
113  // formed by a face edge and its normals.
114  static double distanceToFaceBilinearSurface(
115  const Teuchos::ParameterList &parameters,
116  const Intrepid::FieldContainer<double> &point,
117  const Intrepid::FieldContainer<double> &face_edge_nodes,
118  const Intrepid::FieldContainer<double> &face_edge_node_normals );
119 };
120 
121 //---------------------------------------------------------------------------//
122 
123 } // end namespace DataTransferKit
124 
125 //---------------------------------------------------------------------------//
126 
127 #endif // end DTK_PROJECTIONPRIMITIVES_HPP
128 
129 //---------------------------------------------------------------------------//
130 // end DTK_ProjectionPrimitives.hpp
131 //---------------------------------------------------------------------------//
static void referenceCellCenter(const shards::CellTopology &cell_topo, Intrepid::FieldContainer< double > &center)
Get the center of the reference cell of the given topology.
Assertions and Design-by-Contract for error handling.
static void projectPointToFace(const Teuchos::ParameterList &parameters, const Intrepid::FieldContainer< double > &point, const Intrepid::FieldContainer< double > &face_nodes, const Intrepid::FieldContainer< double > &face_node_normals, const shards::CellTopology &face_topology, Intrepid::FieldContainer< double > &parametric_point, Intrepid::FieldContainer< double > &physical_point, int &face_edge_id, int &face_node_id)
Project a point onto a face and return the physical coordinates of the projected point on that face...
A stateless class of projection primitive operations.
static bool edgeEdgeIntersection(const Teuchos::ParameterList &parameters, const Intrepid::FieldContainer< double > &edge_1, const Intrepid::FieldContainer< double > &edge_2, const Intrepid::FieldContainer< double > &edge_2_node_normals, Intrepid::FieldContainer< double > &edge_1_intersection, Intrepid::FieldContainer< double > &edge_2_intersection, int &edge_1_node_id, int &edge_2_node_id)
Intersect two edges in 3 dimensions and return their intersection point realized on both edges...
DTK_BasicEntitySet.cpp.
static bool pointInFaceVolumeOfInfluence(const Teuchos::ParameterList &parameters, const Intrepid::FieldContainer< double > &point, const Intrepid::FieldContainer< double > &face_nodes, const Intrepid::FieldContainer< double > &face_node_normals, const shards::CellTopology &face_topology)
Determine if a point is within the volume of influence of a face.