summaryrefslogtreecommitdiff
path: root/src/Coxeter_triangulation/example
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-09-22 18:12:31 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-09-22 18:12:31 +0200
commitbe7555abfb97f02c37de96736f7a0993d4d47f03 (patch)
tree180f618a1db3a8b866f43f66210ac38c028d74dd /src/Coxeter_triangulation/example
parente0041b766b647f3906b52f861e97edba1f089312 (diff)
clang-format files
Diffstat (limited to 'src/Coxeter_triangulation/example')
-rw-r--r--src/Coxeter_triangulation/example/manifold_tracing_custom_function.cpp35
-rw-r--r--src/Coxeter_triangulation/example/manifold_tracing_flat_torus_with_boundary.cpp25
2 files changed, 24 insertions, 36 deletions
diff --git a/src/Coxeter_triangulation/example/manifold_tracing_custom_function.cpp b/src/Coxeter_triangulation/example/manifold_tracing_custom_function.cpp
index 95f63b4f..7e3d95a4 100644
--- a/src/Coxeter_triangulation/example/manifold_tracing_custom_function.cpp
+++ b/src/Coxeter_triangulation/example/manifold_tracing_custom_function.cpp
@@ -20,41 +20,34 @@ using namespace Gudhi::coxeter_triangulation;
* The embedding consists of restricting the manifold to the affine subspace z = 1.
*/
struct Function_surface_on_CP2_in_R4 : public Function {
-
virtual Eigen::VectorXd operator()(const Eigen::VectorXd& p) const override {
// The real and imaginary parts of the variables x and y
double xr = p(0), xi = p(1), yr = p(2), yi = p(3);
Eigen::VectorXd result(cod_d());
-
+
// Squares and cubes of real and imaginary parts used in the computations
- double
- xr2 = xr*xr, xi2 = xi*xi, yr2 = yr*yr, yi2 = yi*yi,
- xr3 = xr2*xr, xi3 = xi2*xi, yr3 = yr2*yr, yi3 = yi2*yi;
+ double xr2 = xr * xr, xi2 = xi * xi, yr2 = yr * yr, yi2 = yi * yi, xr3 = xr2 * xr, xi3 = xi2 * xi, yr3 = yr2 * yr,
+ yi3 = yi2 * yi;
// The first coordinate of the output is Re(x^3*y + y^3 + x)
- result(0) =
- xr3*yr - 3*xr*xi2*yr - 3*xr2*xi*yi + xi3*yi
- + yr3 - 3*yr*yi2 + xr;
+ result(0) = xr3 * yr - 3 * xr * xi2 * yr - 3 * xr2 * xi * yi + xi3 * yi + yr3 - 3 * yr * yi2 + xr;
// The second coordinate of the output is Im(x^3*y + y^3 + x)
- result(1) =
- 3*xr2*xi*yr + xr3*yi - 3*xr*xi2*yi - xi3*yr
- + 3*yr2*yi - yi3 + xi;
+ result(1) = 3 * xr2 * xi * yr + xr3 * yi - 3 * xr * xi2 * yi - xi3 * yr + 3 * yr2 * yi - yi3 + xi;
return result;
}
- virtual std::size_t amb_d() const override {return 4;};
- virtual std::size_t cod_d() const override {return 2;};
+ virtual std::size_t amb_d() const override { return 4; };
+ virtual std::size_t cod_d() const override { return 2; };
virtual Eigen::VectorXd seed() const override {
Eigen::VectorXd result = Eigen::VectorXd::Zero(4);
return result;
}
- Function_surface_on_CP2_in_R4() {}
+ Function_surface_on_CP2_in_R4() {}
};
int main(int argc, char** argv) {
-
// The function for the (non-compact) manifold
Function_surface_on_CP2_in_R4 fun;
@@ -74,24 +67,22 @@ int main(int argc, char** argv) {
Coxeter_triangulation<> cox_tr(oracle.amb_d());
cox_tr.change_offset(Eigen::VectorXd::Random(oracle.amb_d()));
cox_tr.change_matrix(lambda * cox_tr.matrix());
-
+
// Manifold tracing algorithm
using MT = Manifold_tracing<Coxeter_triangulation<> >;
using Out_simplex_map = typename MT::Out_simplex_map;
std::vector<Eigen::VectorXd> seed_points(1, seed);
Out_simplex_map interior_simplex_map, boundary_simplex_map;
manifold_tracing_algorithm(seed_points, cox_tr, oracle, interior_simplex_map, boundary_simplex_map);
-
+
// Constructing the cell complex
std::size_t intr_d = oracle.amb_d() - oracle.cod_d();
Cell_complex<Out_simplex_map> cell_complex(intr_d);
cell_complex.construct_complex(interior_simplex_map, boundary_simplex_map);
// Output the cell complex to a file readable by medit
- output_meshes_to_medit(3,
- "manifold_on_CP2_with_boundary",
- build_mesh_from_cell_complex(cell_complex,
- Configuration(true, true, true, 1, 5, 3),
- Configuration(true, true, true, 2, 13, 14)));
+ output_meshes_to_medit(3, "manifold_on_CP2_with_boundary",
+ build_mesh_from_cell_complex(cell_complex, Configuration(true, true, true, 1, 5, 3),
+ Configuration(true, true, true, 2, 13, 14)));
return 0;
}
diff --git a/src/Coxeter_triangulation/example/manifold_tracing_flat_torus_with_boundary.cpp b/src/Coxeter_triangulation/example/manifold_tracing_flat_torus_with_boundary.cpp
index c83fdd5d..2260e692 100644
--- a/src/Coxeter_triangulation/example/manifold_tracing_flat_torus_with_boundary.cpp
+++ b/src/Coxeter_triangulation/example/manifold_tracing_flat_torus_with_boundary.cpp
@@ -1,7 +1,7 @@
// workaround for the annoying boost message in boost 1.69
#define BOOST_PENDING_INTEGER_LOG2_HPP
#include <boost/integer/integer_log2.hpp>
-// end workaround
+// end workaround
#include <iostream>
@@ -21,7 +21,6 @@
using namespace Gudhi::coxeter_triangulation;
int main(int argc, char** argv) {
-
// Creating a circle S1 in R2 of specified radius
double radius = 1.0;
Function_Sm_in_Rd fun_circle(radius, 1);
@@ -34,14 +33,14 @@ int main(int argc, char** argv) {
auto fun_flat_torus_rotated = make_linear_transformation(fun_flat_torus, matrix);
// Computing the seed of the function fun_flat_torus
- Eigen::VectorXd seed = fun_flat_torus_rotated.seed();
-
- // Defining a domain function that defines the boundary, which is a hyperplane passing by the origin and orthogonal to x.
+ Eigen::VectorXd seed = fun_flat_torus_rotated.seed();
+
+ // Defining a domain function that defines the boundary, which is a hyperplane passing by the origin and orthogonal to
+ // x.
Eigen::MatrixXd normal_matrix = Eigen::MatrixXd::Zero(4, 1);
- for (std::size_t i = 0; i < 4; i++)
- normal_matrix(i,0) = -seed(i);
- Function_affine_plane_in_Rd fun_bound(normal_matrix, -seed/2);
-
+ for (std::size_t i = 0; i < 4; i++) normal_matrix(i, 0) = -seed(i);
+ Function_affine_plane_in_Rd fun_bound(normal_matrix, -seed / 2);
+
// Defining the intersection oracle
auto oracle = make_oracle(fun_flat_torus_rotated, fun_bound);
@@ -65,11 +64,9 @@ int main(int argc, char** argv) {
cell_complex.construct_complex(interior_simplex_map, boundary_simplex_map);
// Output the cell complex to a file readable by medit
- output_meshes_to_medit(3,
- "flat_torus_with_boundary",
- build_mesh_from_cell_complex(cell_complex,
- Configuration(true, true, true, 1, 5, 3),
- Configuration(true, true, true, 2, 13, 14)));
+ output_meshes_to_medit(3, "flat_torus_with_boundary",
+ build_mesh_from_cell_complex(cell_complex, Configuration(true, true, true, 1, 5, 3),
+ Configuration(true, true, true, 2, 13, 14)));
return 0;
}