Flow123d  release_3.0.0-922-g9fcbba1
surface_depth.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file surface_depth.hh
15  * @brief
16  */
17 
18 #ifndef SURFACE_DEPTH_HH_
19 #define SURFACE_DEPTH_HH_
20 
21 #include <string>
22 #include <vector>
23 #include <armadillo>
24 #include "mesh/bih_tree.hh"
25 #include "input/input_exception.hh"
26 
27 class Mesh;
28 
29 
31 {
32 public:
33  /// Declaration of exceptions
34  TYPEDEF_ERR_INFO( EI_Message, const std::string);
35  TYPEDEF_ERR_INFO( EI_RegionName, const std::string);
36  TYPEDEF_ERR_INFO( EI_FieldTime, double);
37  TYPEDEF_ERR_INFO( EI_Xcoord, double);
38  TYPEDEF_ERR_INFO( EI_Ycoord, double);
39  TYPEDEF_ERR_INFO( EI_Zcoord, double);
40  TYPEDEF_ERR_INFO( EI_SnapDistance, double);
41  DECLARE_INPUT_EXCEPTION(ExcSurfaceProjection, << EI_Message::val );
42  DECLARE_INPUT_EXCEPTION(ExcTooLargeSnapDistance, << "Distance of projected point during calculation of surface depth is larger "
43  << "than the global snap radius limit!\nRegion: " << EI_RegionName::qval << ", time: " << EI_FieldTime::val
44  << ", coordinates of projected point: [" << EI_Xcoord::val << ", " << EI_Ycoord::val << ", " << EI_Zcoord::val
45  << "], distance of nearest element: " << EI_SnapDistance::val );
46 
47  /**
48  * Constructor
49  */
50  SurfaceDepth(const Mesh *mesh, std::string surface_region, std::string surface_direction);
51 
52  /// Compute distance of point from given surface region (was set in constructor)
53  double compute_distance(arma::vec3 point);
54 
55 protected:
56  /// Create projection matrix \p m_
57  void create_projection_matrix(arma::vec3 surface_vec);
58 
59  /// Construct BIH tree above surface region of given name.
60  void construct_bih_tree(Mesh *mesh, std::string surface_region);
61 
62  /// Precompute solve of distance in transformed coordinations of surface element plane.
63  void prepare_distance_solve(unsigned int elem_idx, arma::vec3 &point, arma::vec3 &x);
64 
65  /// Tree of mesh elements
67 
68  /// normal vector of surface plane
70 
71  /// projection matrix
72  arma::mat m_;
73 
74  /// vector of inversion projection matrices of elements above which BIH tree is created
76 
77  /// vector of b-vectors (right side of equation system) of elements above which BIH tree is created
79 
80  /// Projection search radius given from global_snap_radius of mesh
82 
83  /// Surface region name (need for exception)
84  std::string surface_region_;
85 
86  /// Surface region name (need for exception)
88 };
89 
90 #endif /* SURFACE_DEPTH_HH_ */
std::vector< arma::mat > inv_projection_
vector of inversion projection matrices of elements above which BIH tree is created ...
arma::mat m_
projection matrix
std::vector< unsigned int > searched_elements_
Surface region name (need for exception)
double projection_search_radius_
Projection search radius given from global_snap_radius of mesh.
arma::vec3 surface_norm_vec_
normal vector of surface plane
SurfaceDepth(const Mesh *mesh, std::string surface_region, std::string surface_direction)
Definition: mesh.h:80
std::vector< arma::vec3 > b_vecs_
vector of b-vectors (right side of equation system) of elements above which BIH tree is created ...
void construct_bih_tree(Mesh *mesh, std::string surface_region)
Construct BIH tree above surface region of given name.
Class for O(log N) lookup for intersections with a set of bounding boxes.
Definition: bih_tree.hh:38
BIHTree bih_tree_
Tree of mesh elements.
void prepare_distance_solve(unsigned int elem_idx, arma::vec3 &point, arma::vec3 &x)
Precompute solve of distance in transformed coordinations of surface element plane.
TYPEDEF_ERR_INFO(EI_Message, const std::string)
Declaration of exceptions.
void create_projection_matrix(arma::vec3 surface_vec)
Create projection matrix m_.
DECLARE_INPUT_EXCEPTION(ExcSurfaceProjection,<< EI_Message::val)
std::string surface_region_
Surface region name (need for exception)
double compute_distance(arma::vec3 point)
Compute distance of point from given surface region (was set in constructor)