Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Error when using Periodic_3_Mesh_3 with a Periodic_3_function_wrapper
Chronological Thread
- From: Mael Rouxel-Labbé <>
- To:
- Subject: Re: [cgal-discuss] Error when using Periodic_3_Mesh_3 with a Periodic_3_function_wrapper
- Date: Fri, 30 Apr 2021 17:24:38 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-hdrordr: A9a23:a4zj7a4R4YP7d85EuAPXwGLXdLJzesId70hD6mlaTxtJfsuE0/20lPMA2hPuzBoXUncsmdePUZPwJk/035hz/IUXIPOeTBDr0VHYSL1KwKnD53nbGyP4/vNAzqsIScMVNPTcBUV35Pya3CCWH9osy9GM8uSJqI7lvhFQZC5wbaUI1WtEIySWAlNxXwRdbKBJcaa0wupii36edW8MbsK9b0NpY8Hmq8fQnJzrJT4qbiRJ1CC0gTml6KH3HnGjt38jeghC2LIztVXC+jaJhJmLif29xxPGvlWjjKh+osfryddIGaW35PQ9FzOEsGaVTbUkYZG5+BYove+o6FEl+eO82isdAw==
- Ironport-phdr: A9a23:egTU8RcrSY+OWYDNqTiXL97LlGM+0NvLVj590bIXzolWe6HmxazJeXLljd1ThVPEFb/W9+hDw7KP9fy5CCpau8vK6SlfOLV3FDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3OgV6PPn6FZDPhMqrye+y54fTYwJVjzahfL9+Nhq7oRjVu8UMn4duNKY8xhTUrndVe+ld2H9lK0+Ukxvg/Mm74YRt8z5Xu/Iv9s5AVbv1cqElRrFGDzooLn446tTzuRbMUQWA6H0cUn4LkhVTGAjK8Av6XpbqvSTksOd2xTSXMtf3TbAwXjSi8rtrRRr1gyoJKzI17GfagdF2galGohyuugZ/zpbJbo+LOvpwfqDTc90USmVOXMleSzdMDZmgY4YVFecNIehVoov7qlATrRW+Hw6sBOb3xzFPnHD5w6k63Pw9HwHBwQwhEMwBsHDNoNv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duJ4QR7O75NZMs0p1ZB22WevAN0OtmsLrtpm0UFIDlxpF7k9wlyDtBAjdQytyFtixFjLLqRllJHbTKRm57qfabGL3H7uxGpZamR0V7X1JOa+7wE9e8j+GjlpxyjKkcy7yBnz8VNyCnboY7bCRIbF5P3SEc+sRZg4KrLZzE0oILS23orOqa9tnrO2skiGfA+mSqnKtxQOafBGA7pGNABHOCvLvYrkh6ndEEqJudXoYs9MseRTfybyKOvecJpljgnxTBC6Y15lFiL6jpxTqjM1pwPztmX0wyCWivmnVmoudzwg5ECbjYXSDnsgRP4DZJcM/UhNb0ADn2jdpXf7uU7vIbkXjtjzHDmH0kPsOemdB2XYkDnzANZ3lgQu23hkiy9nWQcuwFslbKW2Wn1+8qncRMGPmBRQ2wKpVjhJo25k8oLUkGjcw8zhV2u4kOon8BzlOFEN2DWBHxwUW32ImVlOoPp6fyHZJMJ7ZoptWBQTfj6Zk6aDLjwv0lCux4=
Hello,
In the package Periodic_3_mesh_3, the canonical domain must currently be a cube, and not a cuboid.
There is on-going work on periodic triangulations capable of handling cuboids (and even more generic domains), which will be available in an upcoming release. A stable "alpha" version is available in the branch https://github.com/MaelRL/cgal/tree/Generic_Periodic_Triangulations and it might be possible to adjust the code of Periodic_3_mesh_3 to make it work with those generic periodic triangulations too, but I have not looked into it yet.
Best,
Mael
On 30/04/2021 17:02, Nicolas Renaud
( via cgal-discuss Mailing List) wrote:
Dear CGAL community,
Thanks for all the work developing and maintaining CGAL !
I'm very new to CGAL and I'm trying to mesh an
non-periodic function using `Periodic_3_mesh_3` with a
`Periodic_3_function_wrapper` following the documentation for
the sphere (https://doc.cgal.org/latest/Periodic_3_mesh_3/index.html#title4).
Most of the times everything works fine. However for some
dimensions of the canonical cube I get the following error :
what(): CGAL ERROR: assertion violation!
File: /home/nico/anaconda3/include/CGAL/Mesh_3/Refine_facets_3.h
Line: 1486
Explanation: Mesh_3 ERROR: A facet is not in conflict with its refinement point!```
This is for example the case in the example below where the
cube is specified as (0, 0, 0, 1, 1, 0.85). But for a cube of
(0, 0, 0, 1, 1, 1) the meshing succeeds.
I don't understand what I'm doing wrong and I would gladly
welcome any help !
Thanks for your help !
Nico
#include <CGAL/Periodic_3_mesh_3/config.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/make_periodic_3_mesh_3.h>
#include <CGAL/optimize_periodic_3_mesh_3.h>
#include <CGAL/Periodic_3_mesh_3/IO/File_medit.h>
#include <CGAL/Periodic_3_mesh_triangulation_3.h>
#include <CGAL/Periodic_3_function_wrapper.h>
#include <CGAL/Labeled_mesh_domain_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/number_type_config.h> // CGAL_PI
#include <cmath>
#include <iostream>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Iso_cuboid_3 Iso_cuboid;
// Domain
typedef FT (Function)(const Point&);
typedef CGAL::Labeled_mesh_domain_3<K> Periodic_mesh_domain;
// Triangulation
typedef CGAL::Periodic_3_mesh_triangulation_3<Periodic_mesh_domain>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Periodic_mesh_criteria;
typedef CGAL::Periodic_3_function_wrapper<Function, K> Periodic_function;
// To avoid verbose function and named parameters call
using namespace CGAL::parameters;
// Implicit function
// A sphere centered on (0.5, 0.5, 0.5) with radius sqrt(0.2)
FT sphere_function (const Point& p) {
return CGAL::squared_distance(p, Point(0.5, 0.5, 0.5)) - 0.2;
}
int main(int argc, char** argv)
{
// 'int' because the 'schwarz_p' function is periodic over the domain only if
// the length of the side of the domain is an integer.
int domain_size = (argc > 1) ? atoi(argv[1]) : 1;
int number_of_copies_in_output = (argc > 2) ? atoi(argv[2]) : 4; // can be 1, 2, 4, or 8
bool verbose = true;
Iso_cuboid canonical_cube(0, 0, 0, 1, 1, 0.85);
Periodic_mesh_domain domain =
Periodic_mesh_domain::create_implicit_mesh_domain(
Periodic_function(sphere_function, canonical_cube), canonical_cube);
Periodic_mesh_criteria criteria(facet_angle = 30,
facet_size = 0.035 * domain_size,
facet_distance = 0.025 * domain_size,
cell_radius_edge_ratio = 2.,
cell_size = 0.05);
// Mesh generation
if (!verbose) {
// suppress output
std::cerr.setstate(std::ios_base::failbit);
}
// Mesh generation
C3t3 c3t3 = CGAL::make_periodic_3_mesh_3<C3t3>(domain, criteria);
if (!verbose) {
std::cerr.clear();
}
std::ofstream medit_file("output_implicit_shape.mesh");
CGAL::output_periodic_mesh_to_medit(medit_file, c3t3, number_of_copies_in_output);
std::cout << "EXIT SUCCESS" << std::endl;
return 0;
}
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] Error when using Periodic_3_Mesh_3 with a Periodic_3_function_wrapper, Nicolas Renaud, 04/30/2021
- Re: [cgal-discuss] Error when using Periodic_3_Mesh_3 with a Periodic_3_function_wrapper, Mael Rouxel-Labbé, 04/30/2021
- Re: [cgal-discuss] Error when using Periodic_3_Mesh_3 with a Periodic_3_function_wrapper, Nicolas Renaud, 04/30/2021
- Re: [cgal-discuss] Error when using Periodic_3_Mesh_3 with a Periodic_3_function_wrapper, Mael Rouxel-Labbé, 04/30/2021
Archive powered by MHonArc 2.6.19+.