diff --git a/fdaPDE/core.h b/fdaPDE/core.h
index e904448d..1f0852da 100644
--- a/fdaPDE/core.h
+++ b/fdaPDE/core.h
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-#ifndef __FDAPDE_CORE_MOUDLE_H__
-#define __FDAPDE_CORE_MOUDLE_H__
+#ifndef __FDAPDE_CORE_MODULE_H__
+#define __FDAPDE_CORE_MODULE_H__
#include "utils.h"
#include "fields.h"
@@ -26,4 +26,4 @@
#include "splines.h"
#include "multithreading.h"
-#endif // __FDAPDE_CORE_MOUDLE_H__
+#endif // __FDAPDE_CORE_MODULE_H__
diff --git a/fdaPDE/fields.h b/fdaPDE/fields.h
index 63595edf..676af1c3 100644
--- a/fdaPDE/fields.h
+++ b/fdaPDE/fields.h
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-#ifndef __FDAPDE_FIELDS_MOUDLE_H__
-#define __FDAPDE_FIELDS_MOUDLE_H__
+#ifndef __FDAPDE_FIELDS_MODULE_H__
+#define __FDAPDE_FIELDS_MODULE_H__
#include "fields/differentiable_field.h"
#include "fields/dot_product.h"
@@ -27,4 +27,4 @@
#include "fields/vector_expressions.h"
#include "fields/vector_field.h"
-#endif // __FDAPDE_FIELDS_MOUDLE_H__
+#endif // __FDAPDE_FIELDS_MODULE_H__
diff --git a/fdaPDE/finite_elements/basis/lagrangian_element.h b/fdaPDE/finite_elements/basis/lagrangian_element.h
index 8376ae13..559d3615 100644
--- a/fdaPDE/finite_elements/basis/lagrangian_element.h
+++ b/fdaPDE/finite_elements/basis/lagrangian_element.h
@@ -27,7 +27,7 @@ namespace fdapde {
namespace core {
// A Lagrangian basis of degree R over an M-dimensional element
-template class LagrangianElement {
+template class LagrangianElement {
private:
std::array, ct_binomial_coefficient(M_ + R_, R_)> nodes_; // nodes of the Lagrangian basis
std::array, ct_binomial_coefficient(M_ + R_, R_)> basis_;
@@ -35,9 +35,9 @@ template class LagrangianElement {
void compute_coefficients_(const std::array, ct_binomial_coefficient(M_ + R_, R_)>& nodes);
public:
// compile time informations
- static constexpr unsigned int R = R_; // basis order
- static constexpr unsigned int M = M_; // input space dimension
- static constexpr unsigned int n_basis = ct_binomial_coefficient(M + R, R);
+ static constexpr int R = R_; // basis order
+ static constexpr int M = M_; // input space dimension
+ static constexpr int n_basis = ct_binomial_coefficient(M + R, R);
typedef MultivariatePolynomial ElementType;
typedef typename std::array, n_basis>::const_iterator const_iterator;
@@ -59,11 +59,11 @@ template class LagrangianElement {
// implementative details
// compute coefficients via Vandermonde matrix
-template
+template
void LagrangianElement::compute_coefficients_(
const std::array, ct_binomial_coefficient(M_ + R_, R_)>& nodes) {
// build vandermonde matrix
- constexpr unsigned int n_basis = ct_binomial_coefficient(M_ + R_, R_);
+ constexpr int n_basis = ct_binomial_coefficient(M_ + R_, R_);
constexpr std::array, n_basis> poly_table = MultivariatePolynomial::poly_table;
// Vandermonde matrix construction
diff --git a/fdaPDE/finite_elements/basis/multivariate_polynomial.h b/fdaPDE/finite_elements/basis/multivariate_polynomial.h
index 70d7da65..20d8c5c2 100644
--- a/fdaPDE/finite_elements/basis/multivariate_polynomial.h
+++ b/fdaPDE/finite_elements/basis/multivariate_polynomial.h
@@ -47,10 +47,9 @@ namespace core {
// 2 0 0 | 2
//
// ct_poly_exp() computes the above table for any choice of N and R at compile time.
-template
-using PolyTable = std::array, ct_binomial_coefficient(R + N, R)>;
+template using PolyTable = std::array, ct_binomial_coefficient(R + N, R)>;
-template constexpr PolyTable ct_poly_exp() {
+template constexpr PolyTable ct_poly_exp() {
const int monomials = ct_binomial_coefficient(R + N, R); // number of monomials in polynomial p(x)
// initialize empty array
PolyTable coeff {};
@@ -98,10 +97,10 @@ template constexpr PolyTable ct_poly_exp(
// PolyTable PolyGradTable
//
// ct_grad_exp() computes the PolyGradTable above from a PolyTable for any choice of N and R at compile time.
-template
+template
using PolyGradTable = std::array, ct_binomial_coefficient(R + N, R)>, N>;
-template constexpr PolyGradTable ct_grad_exp(const PolyTable poly_table) {
+template constexpr PolyGradTable ct_grad_exp(const PolyTable poly_table) {
const int monomials = ct_binomial_coefficient(R + N, R); // number of monomials in polynomial p(x)
// initialize empty array
PolyGradTable coeff {};
@@ -120,9 +119,9 @@ template constexpr PolyGradTable ct_grad_
}
// recursive template based unfolding of monomial product x1^i1*x2^i2*...*xN^iN.
-template // a row of the polynomial PolyTable (i.e. an array of coefficients [i1 i2 ... iN])
+template // a row of the polynomial PolyTable (i.e. an array of coefficients [i1 i2 ... iN])
struct MonomialProduct {
static constexpr double unfold(const P& p, const V& v) {
return v[N] == 0 ? MonomialProduct::unfold(p, v) :
@@ -135,11 +134,11 @@ template struct MonomialProduct<0, P, V> { // base ca
};
// unfold the sum of monomials at compile time to produce the complete polynomial expression
-template // the whole polynomial PolyTable
+template // the whole polynomial PolyTable
struct MonomialSum {
static constexpr double unfold(const std::array& c, const P& p, const V& v) {
return (c[I] * MonomialProduct, std::array>::unfold(p, v[I])) +
@@ -147,14 +146,14 @@ struct MonomialSum {
}
};
// end of recursion
-template struct MonomialSum<0, N, M, P, V> {
+template struct MonomialSum<0, N, M, P, V> {
static constexpr double unfold(const std::array& c, const P& p, const V& v) {
return c[0] * MonomialProduct, std::array>::unfold(p, v[0]);
}
};
// functor implementing the derivative of a multivariate N-dimensional polynomial of degree R along a given direction
-template
+template
class PolynomialDerivative : public VectorExpr> {
private:
// compile time informations
@@ -184,17 +183,17 @@ class PolynomialDerivative : public VectorExpr>
};
// class representing a multivariate polynomial of degree R defined over a space of dimension N
-template
+template
class MultivariatePolynomial : public ScalarExpr> {
private:
- static const constexpr unsigned MON = ct_binomial_coefficient(R + N, R);
+ static const constexpr int MON = ct_binomial_coefficient(R + N, R);
std::array coeff_vector_; // vector of coefficients
VectorField> gradient_;
public:
// compute this at compile time once, let public access
static constexpr PolyTable poly_table = ct_poly_exp();
- static constexpr unsigned int order = R; // polynomial order
- static constexpr unsigned int input_space_dimension = N; // input space dimension
+ static constexpr int order = R; // polynomial order
+ static constexpr int input_space_dimension = N; // input space dimension
// constructor
MultivariatePolynomial() = default;
@@ -202,7 +201,7 @@ class MultivariatePolynomial : public ScalarExpr
// prepare gradient vector
std::array, N> gradient;
// define i-th element of gradient field
- for (size_t i = 0; i < N; ++i) { gradient[i] = PolynomialDerivative(coeff_vector, i); }
+ for (std::size_t i = 0; i < N; ++i) { gradient[i] = PolynomialDerivative(coeff_vector, i); }
gradient_ = VectorField>(gradient);
};
// evaluate polynomial at point
diff --git a/fdaPDE/linear_algebra.h b/fdaPDE/linear_algebra.h
index de0f32b9..f45c5a90 100644
--- a/fdaPDE/linear_algebra.h
+++ b/fdaPDE/linear_algebra.h
@@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-#ifndef __FDAPDE_LINEAR_ALGEBRA_MOUDLE_H__
-#define __FDAPDE_LINEAR_ALGEBRA_MOUDLE_H__
+#ifndef __FDAPDE_LINEAR_ALGEBRA_MODULE_H__
+#define __FDAPDE_LINEAR_ALGEBRA_MODULE_H__
#include "linear_algebra/kronecker_product.h"
#include "linear_algebra/smw.h"
#include "linear_algebra/sparse_block_matrix.h"
#include "linear_algebra/vector_space.h"
-#endif // __FDAPDE_LINEAR_ALGEBRA_MOUDLE_H__
+#endif // __FDAPDE_LINEAR_ALGEBRA_MODULE_H__
diff --git a/fdaPDE/linear_algebra/vector_space.h b/fdaPDE/linear_algebra/vector_space.h
index 2bfa21c5..95541fa3 100644
--- a/fdaPDE/linear_algebra/vector_space.h
+++ b/fdaPDE/linear_algebra/vector_space.h
@@ -27,7 +27,7 @@ namespace core {
// a template class to perform geometric operations in general vector and affine spaces.
// M is the vector space dimension, N is the dimension of the embedding space
-template class VectorSpace {
+template class VectorSpace {
private:
std::array, M> basis_ {}; // the set of vectors generating the vector space
SVector offset_ {}; // a point throught which the vector space passes. (offset_ \neq 0 \implies affine space)
@@ -51,12 +51,12 @@ template class VectorSpace {
// implementation details
-template
+template
SVector VectorSpace::orthogonal_project(const SVector& u, const SVector& v) const {
return ((v.dot(u) / u.squaredNorm()) * (u.array())).matrix();
}
-template void VectorSpace::orthonormalize() {
+template void VectorSpace::orthonormalize() {
std::array, M> orthonormal_basis;
orthonormal_basis[0] = basis_[0] / basis_[0].norm();
// implementation of the modified Gram-Schmidt method, see theory for details
@@ -70,7 +70,7 @@ template void VectorSpace::orthonormalize
}
// projects the point x onto the space.
-template SVector VectorSpace::project_onto(const SVector& x) {
+template SVector VectorSpace::project_onto(const SVector& x) {
if constexpr (M == N) { // you are projecting over the same space!
return x;
} else {
@@ -82,7 +82,7 @@ template SVector VectorSpace::project_
}
// project the point x into the space
-template SVector VectorSpace::project_into(const SVector& x) {
+template SVector VectorSpace::project_into(const SVector& x) {
// build the projection operator on the space spanned by the basis
Eigen::Matrix A;
A.resize(N, basis_.size());
@@ -93,12 +93,12 @@ template SVector VectorSpace::project_
}
// euclidean distance from x
-template double VectorSpace::distance(const SVector& x) {
+template double VectorSpace::distance(const SVector& x) {
return (x - project_into(x)).squaredNorm();
}
// develops the linear combination of basis vectors with respect to the given vector of coefficients.
-template
+template
SVector VectorSpace::operator()(const std::array& coeffs) const {
SVector result = offset_;
for (std::size_t i = 0; i < M; ++i) result += coeffs[i] * basis_[i];
diff --git a/fdaPDE/mesh.h b/fdaPDE/mesh.h
index 4e930a1d..682acae4 100644
--- a/fdaPDE/mesh.h
+++ b/fdaPDE/mesh.h
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-#ifndef __FDAPDE_MESH_MOUDLE_H__
-#define __FDAPDE_MESH_MOUDLE_H__
+#ifndef __FDAPDE_MESH_MODULE_H__
+#define __FDAPDE_MESH_MODULE_H__
#include "mesh/mesh.h"
#include "mesh/element.h"
@@ -25,4 +25,4 @@
#include "mesh/point_location/barycentric_walk.h"
#include "mesh/point_location/adt.h"
-#endif // __FDAPDE_MESH_MOUDLE_H__
+#endif // __FDAPDE_MESH_MODULE_H__
diff --git a/fdaPDE/mesh/element.h b/fdaPDE/mesh/element.h
index 08636762..9353f497 100644
--- a/fdaPDE/mesh/element.h
+++ b/fdaPDE/mesh/element.h
@@ -29,24 +29,24 @@ namespace fdapde {
namespace core {
// M local dimension, N embedding dimension, R order of the element (defaulted to linear finite elements)
-template class Element; // forward declaration
+template class Element; // forward declaration
// using declarations for manifold specialization
-template using SurfaceElement = Element<2, 3, R>;
-template using NetworkElement = Element<1, 2, R>;
+template using SurfaceElement = Element<2, 3, R>;
+template using NetworkElement = Element<1, 2, R>;
// number of degrees of freedom associated to an M-dimensional element of degree R
-constexpr unsigned int ct_nnodes(const unsigned int M, const unsigned int R) {
+constexpr int ct_nnodes(const int M, const int R) {
return ct_factorial(M + R) / (ct_factorial(M) * ct_factorial(R));
}
// number of vertices of an M-dimensional element
-constexpr unsigned int ct_nvertices(const unsigned int M) { return M + 1; }
+constexpr int ct_nvertices(const int M) { return M + 1; }
// number of edges of an M-dimensional element
-constexpr unsigned int ct_nedges(const unsigned int M) { return (M * (M + 1)) / 2; }
+constexpr int ct_nedges(const int M) { return (M * (M + 1)) / 2; }
// A single mesh element. This object represents the main **geometrical** abstraction of a physical element.
// No functional information is carried by instances of this object.
-template class Element {
+template class Element {
private:
std::size_t ID_; // ID of this element
std::array node_ids_ {}; // ID of nodes composing the element
@@ -60,11 +60,11 @@ template class Element {
SMatrix J_; // [J_]_ij = (coords_[j][i] - coords_[0][i])
SMatrix inv_J_; // J^{-1} (Penrose pseudo-inverse for manifold elements)
public:
- static constexpr unsigned int nodes = ct_nnodes(M, R);
- static constexpr unsigned int vertices = ct_nvertices(M);
- static constexpr unsigned int local_dimension = M;
- static constexpr unsigned int embedding_dimension = N;
- static constexpr unsigned int order = R;
+ static constexpr int nodes = ct_nnodes(M, R);
+ static constexpr int vertices = ct_nvertices(M);
+ static constexpr int local_dimension = M;
+ static constexpr int embedding_dimension = N;
+ static constexpr int order = R;
// constructor
Element() = default;
@@ -74,7 +74,7 @@ template class Element {
// getters
const std::array, ct_nvertices(M)> coords() const { return coords_; }
const std::vector neighbors() const { return neighbors_; }
- const unsigned int ID() const { return ID_; }
+ const int ID() const { return ID_; }
Eigen::Matrix barycentric_matrix() const { return J_; }
Eigen::Matrix inv_barycentric_matrix() const { return inv_J_; }
std::array node_ids() const { return node_ids_; }
@@ -99,7 +99,7 @@ template class Element {
// implementation details
-template
+template
Element::Element(
std::size_t ID, const std::array& node_ids,
const std::array, ct_nvertices(M)>& coords, const std::vector& neighbors, bool boundary) :
@@ -127,7 +127,7 @@ Element::Element(
}
}
-template
+template
SVector Element::to_barycentric_coords(const SVector& x) const {
// solve: barycenitrc_matrix_*z = (x-ref)
SVector z = inv_J_ * (x - coords_[0]);
@@ -137,7 +137,7 @@ SVector Element::to_barycentric_coords(const SVector& x) cons
return result;
}
-template SVector Element::mid_point() const {
+template SVector Element::mid_point() const {
// The center of gravity of an element has all its barycentric coordinates equal to 1/(M+1).
// The midpoint of an element can be computed by mapping it to a cartesian reference system
SVector barycentric_mid_point;
@@ -145,7 +145,7 @@ template SVector Element
+template
std::pair, SVector> Element::bounding_box() const {
// define lower-left and upper-right corner of bounding box
SVector ll, ur;
@@ -164,14 +164,14 @@ std::pair, SVector> Element::bounding_box() const {
}
// check if a point is contained in the element
-template
+template
template
typename std::enable_if::type Element::contains(const SVector& x) const {
// A point is inside the element if all its barycentric coordinates are positive
return (to_barycentric_coords(x).array() >= -10 * std::numeric_limits::epsilon()).all();
}
-template VectorSpace Element::spanned_space() const {
+template VectorSpace Element::spanned_space() const {
// build a basis for the space containing the element
std::array, M> basis;
for (size_t i = 0; i < M; ++i) { basis[i] = (coords_[i + 1] - coords_[0]); }
@@ -179,7 +179,7 @@ template VectorSpace Elem
}
// specialization for manifold elements of contains() routine.
-template
+template
template
typename std::enable_if::type Element::contains(const SVector& x) const {
// check if the point is contained in the affine space spanned by the element
diff --git a/fdaPDE/mesh/mesh.h b/fdaPDE/mesh/mesh.h
index 69fabe5c..f0305f46 100644
--- a/fdaPDE/mesh/mesh.h
+++ b/fdaPDE/mesh/mesh.h
@@ -33,30 +33,30 @@ namespace fdapde {
namespace core {
// trait to detect if the mesh is a manifold
-template struct is_manifold {
+template struct is_manifold {
static constexpr bool value = (M != N);
};
// trait to detect if the mesh is a linear network
-template struct is_linear_network {
+template struct is_linear_network {
static constexpr bool value = std::conditional<(M == 1 && N == 2), std::true_type, std::false_type>::type::value;
};
// trait to select a proper neighboring storage structure depending on the type of mesh. In case of linear networks this
// information is stored as a sparse matrix where entry (i,j) is set to 1 if and only if elements i and j are neighbors
-template struct neighboring_structure {
+template struct neighboring_structure {
using type = typename std::conditional::value, SpMatrix, DMatrix>::type;
};
// access to domain's triangulation, M: tangent space dimension, N: embedding space dimension, R: FEM mesh order
-template class Mesh {
+template class Mesh {
private:
// coordinates of points costituting the vertices of mesh elements
DMatrix points_ {};
- unsigned int num_nodes_ = 0;
+ int num_nodes_ = 0;
// identifiers of points (as row indexes in points_ matrix) composing each element, by row
Eigen::Matrix elements_ {};
- unsigned int num_elements_ = 0;
+ int num_elements_ = 0;
// vector of binary coefficients such that, boundary_[j] = 1 \iff node j is on boundary
DMatrix boundary_ {};
std::size_t dof_; // degrees of freedom, i.e. the maximmum ID in the dof_table
@@ -79,12 +79,12 @@ template class Mesh {
const typename neighboring_structure::type& neighbors, const DMatrix& boundary);
// getters
- const Element& element(unsigned int ID) const { return cache_[ID]; }
- Element& element(unsigned int ID) { return cache_[ID]; }
- SVector node(unsigned int ID) const { return points_.row(ID); }
+ const Element& element(int ID) const { return cache_[ID]; }
+ Element& element(int ID) { return cache_[ID]; }
+ SVector node(int ID) const { return points_.row(ID); }
bool is_on_boundary(size_t j) const { return boundary_(j) == 1; }
- unsigned int elements() const { return num_elements_; }
- unsigned int nodes() const { return num_nodes_; }
+ int elements() const { return num_elements_; }
+ int nodes() const { return num_nodes_; }
std::array, N> range() const { return range_; }
// support for the definition of a finite element basis
@@ -154,17 +154,17 @@ template class Mesh {
};
// alias exports
-template using Mesh2D = Mesh<2, 2, R>;
-template using Mesh3D = Mesh<3, 3, R>;
+template using Mesh2D = Mesh<2, 2, R>;
+template using Mesh3D = Mesh<3, 3, R>;
// manifold cases
-template using SurfaceMesh = Mesh<2, 3, R>;
-template using NetworkMesh = Mesh<1, 2, R>;
+template using SurfaceMesh = Mesh<2, 3, R>;
+template using NetworkMesh = Mesh<1, 2, R>;
// implementative details
// builds a node enumeration for the support of a basis of order R. This fills both the elements_ table
// and recompute the boundary informations. (support only for order 2 basis)
-template
+template
void Mesh::dof_enumerate(const DMatrix& boundary) {
// algorithm initialization
int next = num_nodes_; // next valid ID to assign
@@ -213,7 +213,7 @@ void Mesh::dof_enumerate(const DMatrix& boundary) {
}
// construct directly from raw eigen matrix (used from wrappers)
-template
+template
Mesh::Mesh(
const DMatrix& points, const DMatrix& elements,
const typename neighboring_structure::type& neighbors, const DMatrix& boundary) :
@@ -251,7 +251,7 @@ Mesh::Mesh(
}
// construct a mesh from .csv files
-template
+template
Mesh::Mesh(
const std::string& points, const std::string& elements, const std::string& neighbors, const std::string& boundary) {
// open and parse CSV files
@@ -305,7 +305,7 @@ Mesh::Mesh(
}
// fill the cache_ data structure with pointers to element objects
-template void Mesh::fill_cache() {
+template void Mesh::fill_cache() {
// reserve space for cache
cache_.reserve(num_elements_);
@@ -351,7 +351,7 @@ template void Mesh::fi
}
// produce the matrix of dof coordinates
-template DMatrix Mesh