Flow123d  3.9.0-44fe12069
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
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_ */
SurfaceDepth::bih_tree_
BIHTree bih_tree_
Tree of mesh elements.
Definition: surface_depth.hh:66
SurfaceDepth::b_vecs_
std::vector< arma::vec3 > b_vecs_
vector of b-vectors (right side of equation system) of elements above which BIH tree is created
Definition: surface_depth.hh:78
SurfaceDepth::surface_norm_vec_
arma::vec3 surface_norm_vec_
normal vector of surface plane
Definition: surface_depth.hh:69
bih_tree.hh
SurfaceDepth::create_projection_matrix
void create_projection_matrix(arma::vec3 surface_vec)
Create projection matrix m_.
Definition: surface_depth.cc:41
BIHTree
Class for O(log N) lookup for intersections with a set of bounding boxes.
Definition: bih_tree.hh:38
std::vector< arma::mat >
SurfaceDepth::TYPEDEF_ERR_INFO
TYPEDEF_ERR_INFO(EI_Message, const std::string)
Declaration of exceptions.
arma::vec3
Definition: doxy_dummy_defs.hh:17
SurfaceDepth::searched_elements_
std::vector< unsigned int > searched_elements_
Surface region name (need for exception)
Definition: surface_depth.hh:87
Armor::mat
ArmaMat< double, N, M > mat
Definition: armor.hh:888
SurfaceDepth::DECLARE_INPUT_EXCEPTION
DECLARE_INPUT_EXCEPTION(ExcSurfaceProjection,<< EI_Message::val)
SurfaceDepth::surface_region_
std::string surface_region_
Surface region name (need for exception)
Definition: surface_depth.hh:84
SurfaceDepth::compute_distance
double compute_distance(arma::vec3 point)
Compute distance of point from given surface region (was set in constructor)
Definition: surface_depth.cc:112
SurfaceDepth::prepare_distance_solve
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.
Definition: surface_depth.cc:163
SurfaceDepth::inv_projection_
std::vector< arma::mat > inv_projection_
vector of inversion projection matrices of elements above which BIH tree is created
Definition: surface_depth.hh:75
input_exception.hh
SurfaceDepth
Definition: surface_depth.hh:30
Mesh
Definition: mesh.h:361
SurfaceDepth::projection_search_radius_
double projection_search_radius_
Projection search radius given from global_snap_radius of mesh.
Definition: surface_depth.hh:81
SurfaceDepth::SurfaceDepth
SurfaceDepth(const Mesh *mesh, std::string surface_region, std::string surface_direction)
Definition: surface_depth.cc:32
SurfaceDepth::m_
arma::mat m_
projection matrix
Definition: surface_depth.hh:72
SurfaceDepth::construct_bih_tree
void construct_bih_tree(Mesh *mesh, std::string surface_region)
Construct BIH tree above surface region of given name.
Definition: surface_depth.cc:59