summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/utilities
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-07-31 14:33:49 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-07-31 14:33:49 +0000
commitc89ae478ea5d6685c862533fac1aea973e9cda02 (patch)
tree8557a50f16155e082cc8b76ffd1831a5a3969604 /src/Alpha_complex/utilities
parentd5b5de5aa50c2fdc73d00bbdcf295caf44237a34 (diff)
Add unitary tests and documentation
Fix debug exception mechanism git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3712 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 43f66f3843981ab9cd74c117c2b1c6bb9b94810b
Diffstat (limited to 'src/Alpha_complex/utilities')
-rw-r--r--src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp29
-rw-r--r--src/Alpha_complex/utilities/alphacomplex.md44
2 files changed, 19 insertions, 54 deletions
diff --git a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp
index 00ede9ce..536de444 100644
--- a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp
+++ b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp
@@ -45,12 +45,13 @@ using Persistent_cohomology =
Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Gudhi::persistent_cohomology::Field_Zp>;
void program_options(int argc, char *argv[], std::string &off_file_points, bool& exact, std::string &weight_file,
- std::string &cuboid_file, std::string &output_file_diag, int &coeff_field_characteristic,
- Filtration_value &min_persistence);
+ std::string &cuboid_file, std::string &output_file_diag, Filtration_value &alpha_square_max_value,
+ int &coeff_field_characteristic, Filtration_value &min_persistence);
template<typename AlphaComplex3d>
-bool create_complex(AlphaComplex3d& alpha_complex, Simplex_tree& simplex_tree) {
- return alpha_complex.create_complex(simplex_tree);
+bool create_complex(AlphaComplex3d& alpha_complex, Simplex_tree& simplex_tree,
+ Filtration_value alpha_square_max_value) {
+ return alpha_complex.create_complex(simplex_tree, alpha_square_max_value);
}
bool read_weight_file(const std::string& weight_file, std::vector<double>& weights) {
@@ -87,6 +88,7 @@ int main(int argc, char **argv) {
std::string weight_file;
std::string cuboid_file;
std::string output_file_diag;
+ Filtration_value alpha_square_max_value = 0.;
int coeff_field_characteristic = 0;
Filtration_value min_persistence = 0.;
bool exact_version = false;
@@ -94,7 +96,7 @@ int main(int argc, char **argv) {
bool periodic_version = false;
program_options(argc, argv, off_file_points, exact_version, weight_file, cuboid_file, output_file_diag,
- coeff_field_characteristic, min_persistence);
+ alpha_square_max_value, coeff_field_characteristic, min_persistence);
// Read the OFF file (input file name given as parameter) and triangulate points
Gudhi::Points_3D_off_reader<Alpha_complex_3d::Point_3> off_reader(off_file_points);
@@ -131,25 +133,25 @@ int main(int argc, char **argv) {
exit(-1);
} else {
Exact_alpha_complex_3d alpha_complex(off_reader.get_point_cloud());
- create_complex(alpha_complex, simplex_tree);
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
}
} else {
if (weighted_version) {
if (periodic_version) {
Weighted_periodic_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights,
x_min, y_min, z_min, x_max, y_max, z_max);
- create_complex(alpha_complex, simplex_tree);
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
} else {
Weighted_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights);
- create_complex(alpha_complex, simplex_tree);
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
}
} else {
if (periodic_version) {
Periodic_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), x_min, y_min, z_min, x_max, y_max, z_max);
- create_complex(alpha_complex, simplex_tree);
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
} else {
Alpha_complex_3d alpha_complex(off_reader.get_point_cloud());
- create_complex(alpha_complex, simplex_tree);
+ create_complex(alpha_complex, simplex_tree, alpha_square_max_value);
}
}
}
@@ -179,8 +181,8 @@ int main(int argc, char **argv) {
}
void program_options(int argc, char *argv[], std::string &off_file_points, bool& exact, std::string &weight_file,
- std::string &cuboid_file, std::string &output_file_diag, int &coeff_field_characteristic,
- Filtration_value &min_persistence) {
+ std::string &cuboid_file, std::string &output_file_diag, Filtration_value &alpha_square_max_value,
+ int &coeff_field_characteristic, Filtration_value &min_persistence) {
namespace po = boost::program_options;
po::options_description hidden("Hidden options");
hidden.add_options()("input-file", po::value<std::string>(&off_file_points),
@@ -196,6 +198,9 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool&
"Name of file describing the periodic domain. Format is:\n min_hx min_hy min_hz\n max_hx max_hy max_hz")(
"output-file,o", po::value<std::string>(&output_file_diag)->default_value(std::string()),
"Name of file in which the persistence diagram is written. Default print in std::cout")(
+ "max-alpha-square-value,r", po::value<Filtration_value>(&alpha_square_max_value)
+ ->default_value(std::numeric_limits<Filtration_value>::infinity()),
+ "Maximal alpha square value for the Alpha complex construction.")(
"field-charac,p", po::value<int>(&coeff_field_characteristic)->default_value(11),
"Characteristic p of the coefficient field Z/pZ for computing homology.")(
"min-persistence,m", po::value<Filtration_value>(&min_persistence),
diff --git a/src/Alpha_complex/utilities/alphacomplex.md b/src/Alpha_complex/utilities/alphacomplex.md
index 7ae5f913..7fc6cc0c 100644
--- a/src/Alpha_complex/utilities/alphacomplex.md
+++ b/src/Alpha_complex/utilities/alphacomplex.md
@@ -94,6 +94,8 @@ where `<input OFF file>` is the path to the input point cloud in
* `-h [ --help ]` Produce help message
* `-o [ --output-file ]` Name of file in which the persistence diagram is
written. Default print in standard output.
+* `-r [ --max-alpha-square-value ]` (default = inf) Maximal alpha square value
+for the Alpha complex construction.
* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient
field Z/pZ for computing homology.
* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature
@@ -120,45 +122,3 @@ N.B.:
[Alpha shape](https://doc.cgal.org/latest/Alpha_shapes_3/index.html#title0)
and
[Regular triangulation](https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation3secclassRegulartriangulation) documentation.
-
-
-
-
-
-
-
-
-## periodic_alpha_complex_3d_persistence ##
-Same as `alpha_complex_3d_persistence`, but using periodic alpha shape 3d.
-Refer to the [CGAL's 3D Periodic Triangulations User Manual](https://doc.cgal.org/latest/Periodic_3_triangulation_3/index.html) for more details.
-
-**Usage**
-
-```
- periodic_alpha_complex_3d_persistence [options] <input OFF file> <cuboid file>
-```
-
-where
-
-* `<input OFF file>` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html).
-* `<cuboid file>` is the path to the file describing the periodic domain. It must be in the format described
-[here](/doc/latest/fileformats.html#FileFormatsIsoCuboid).
-
-**Allowed options**
-
-* `-h [ --help ]` Produce help message
-* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output.
-* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology.
-* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals
-
-
-**Example**
-
-```
-periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off ../../data/points/iso_cuboid_3_in_0_1.txt -p 3 -m 1.0
-```
-
-N.B.:
-
-* Cuboid file must be in the format described [here](/doc/latest/fileformats.html#FileFormatsIsoCuboid).
-* Filtration values are alpha square values.