QUGaR 0.0.4
Loading...
Searching...
No Matches
impl_utils.hpp
Go to the documentation of this file.
1// --------------------------------------------------------------------------
2//
3// Copyright (C) 2025-present by Pablo Antolin
4//
5// This file is part of the QUGaR library.
6//
7// SPDX-License-Identifier: MIT
8//
9// --------------------------------------------------------------------------
10
11#ifndef QUGAR_IMPL_UTILS_HPP
12#define QUGAR_IMPL_UTILS_HPP
13
20
22#include <qugar/point.hpp>
23#include <qugar/tolerance.hpp>
24#include <qugar/types.hpp>
25#include <qugar/vector.hpp>
26
27#include <utility>
28#include <vector>
29
30
31namespace qugar::impl {
32
43template<int dim>
44[[nodiscard]] bool on_levelset(const ImplicitFunc<dim> &phi, const Point<dim> &point, Tolerance tol = Tolerance());
45
54template<int dim> [[nodiscard]] int get_facet_constant_dir(int local_facet_id);
55
68template<int dim> [[nodiscard]] int get_facet_side(int local_facet_id);
69
80template<int dim> [[nodiscard]] int get_local_facet_id(int const_dir, int side);
81
88template<int dim> [[nodiscard]] Vector<int, dim - 1> get_edge_constant_dirs(int local_edge_id);
89
99template<int dim> [[nodiscard]] Vector<int, dim - 1> get_edge_sides(int local_edge_id);
100
101
102template<int dim, int range> class ImplReparamMesh;
103
104
108template<int dim> struct RootsIntervals
109{
111 std::vector<real> roots;
115 std::vector<int> func_ids;
117 std::vector<bool> active_intervals;
118
119private:
120 std::vector<std::pair<real, int>> roots_ids;
121
122public:
125
127 void clear();
128
136 void add_root(real root, int func_id);
137
141 [[nodiscard]] bool empty() const;
142
146 [[nodiscard]] int get_num_roots() const;
147
151
158 void adjust_roots(const Tolerance &tol, real x0, real x1);
159};
160}// namespace qugar::impl
161
162#endif// QUGAR_IMPL_UTILS_HPP
Class for tolerance related computations.
Definition tolerance.hpp:33
Domain functions.
Definition domain_function.hpp:41
Class for storing an implicit domain reparameterization using Lagrange cells.
Definition impl_utils.hpp:102
Declaration of a few implicit functions template class ready to be consumed by Algoim.
Definition affine_transf.hpp:28
Vector< int, dim - 1 > get_edge_constant_dirs(int local_edge_id)
Gets the constant directions of the local edge.
int get_facet_side(int local_facet_id)
Gets the side of the facet. Either 0 or 1.
int get_facet_constant_dir(int local_facet_id)
Gets the constant direction of the local facet.
Vector< int, dim - 1 > get_edge_sides(int local_edge_id)
Gets the sides of the edge. Either 0 or 1 along each constant direction.
bool on_levelset(const ImplicitFunc< dim > &phi, const Point< dim > &point, Tolerance tol=Tolerance())
Checks if a point belongs to the levelset of an implicit function phi.
int get_local_facet_id(int const_dir, int side)
Get the local facet ID for a given const direction and side.
double real
Definition types.hpp:18
::algoim::uvector< T, dim > Vector
Class representing a vector.
Definition vector.hpp:31
Vector< T, dim > Point
Class representing a dim-dimensional Point.
Definition point.hpp:34
Definition and implementation of Point class.
Struct for storing and managing computed roots and intervals of an implicit function.
Definition impl_utils.hpp:109
int get_num_roots() const
Gets the number of roots in the container.
std::vector< real > roots
List of roots.
Definition impl_utils.hpp:111
std::vector< bool > active_intervals
Flags indicating if the intervals defined by two consecutive roots are active.
Definition impl_utils.hpp:117
void clear()
Clears the container to the initial state.
std::vector< std::pair< real, int > > roots_ids
Definition impl_utils.hpp:120
std::vector< int > func_ids
Restrictions to which root correspond to (there is a one to correspondence).
Definition impl_utils.hpp:115
void sort_roots()
Sorts (in increasing order) the roots in the container and the according restriction indices func_ids...
bool empty() const
Checks whether the container is empty.
Point< dim > point
Point at which roots are computed.
Definition impl_utils.hpp:113
void adjust_roots(const Tolerance &tol, real x0, real x1)
Adjust the container roots by sorting them and forcing near roots (up to a _olerance) to be coinciden...
void add_root(real root, int func_id)
Adds a new root.
RootsIntervals()
Default constructor.
Definition of tolerance related functionalities.
Declaration of types.