-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDomain.h
More file actions
65 lines (57 loc) · 2.76 KB
/
Domain.h
File metadata and controls
65 lines (57 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// Created by simonepanzeri on 25/11/2021.
//
#ifndef DEV_FDAPDE_DOMAIN_H
#define DEV_FDAPDE_DOMAIN_H
#include "FdaPDE.h"
//! It defines geometric limits of a set of points.
//! The template parameter Shape is the original geometric figure (e.g., Point, Triangle, Tetrahedron, Box).
template<class Shape>
class Domain {
protected:
//! Origin of the object's bounding box = min(coord(*,1:number of points)).
// ex) 2D: xmin, ymin, xmin, ymin
std::vector<Real> origin_;
//! Scaling factors = 1./(max(coord(*,1:number of points)) - min(coord(*,1:number of points))).
// ex) 2D: xscale, yscale, xscale, yscale
std::vector<Real> scalingfactors_;
//! Tolerance being applied to the object's bounding box.
static Real tolerance_;
//! Minimum difference between coordinates allowed.
static Real mindiff_;
public:
//! Default constructor.
Domain();
/*! Another constructor
* \param[in] coord Point coordinates organized in a matrix (coord[i, j] is the i-th coordinate of the j-th point). \n
* This matrix is created through a vector of vectors in order to use standard algorithms.
*
* It finds geometric limits of a set of points first. Then adds a tolerance.
* Repeats the limits if the tree dimension is 2 * physical space dimension.
* This is an useful trick. For example, when you have to scale dimensions.
*/
Domain(std::vector<Real> const& origin, std::vector<Real> const& scalingfactors) :
origin_(origin), scalingfactors_(scalingfactors) {};
Domain(std::vector<std::vector<Real>> const& coord);
//! Sets the tolerance being applied to the object's bounding box.
inline static void settolerance(Real const& tol) { tolerance_ = tol; }
//! Gets the tolerance being applied to the object's bounding box.
inline static Real gettolerance() { return tolerance_; }
//! Sets the minimum difference between coordinates allowed.
inline static void setmindiff(Real const& md) { mindiff_ = md; }
//! Gets the minimum difference between coordinates allowed.
inline static Real getmindiff() { return mindiff_; }
//! Gets the i-th coordinate of the origin of the object's bounding box.
inline Real orig(int const& i) const { return origin_[i]; }
//! Gets the i-th scaling factor of the object's bounding box.
inline double scal(int const& i) const { return scalingfactors_[i]; }
//! Gets the size of origin_ vector.
inline int getoriginsize() { return int(origin_.size()); }
//! Gets the size of scalingfactors_ vector.
inline int getscalingsize() { return int(scalingfactors_.size()); }
//! Output operator.
template<class S>
friend std::ostream& operator<<(std::ostream&, Domain<S> const &);
};
#include "Domain_imp.h"
#endif //DEV_FDAPDE_DOMAIN_H