Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization"
Chronological Thread
- From: Burak ER <>
- To:
- Subject: Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization"
- Date: Fri, 25 Oct 2013 12:14:47 +0300
Dear Sebastian,
This may not be a minimal example. I have created a python interface for my application. Within this interface I divide the off file into tetrahedrons with CGAL c++ api on the background. I use this generation code on the c++ side;
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/Polyhedral_mesh_domain_3.h>
#include <CGAL/make_mesh_3.h>
#include <CGAL/refine_mesh_3.h>
#include <iostream>
// IO
#include <CGAL/IO/Polyhedron_iostream.h>
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::Polyhedral_mesh_domain_3<Polyhedron, K> Mesh_domain;
// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
// To avoid verbose function and named parameters call
using namespace CGAL::parameters;
class MeshElement;
void Mesh(void)
{
boost::filesystem::path mypath(filename);
std::ifstream input(filename.data());
if(mypath.extension()!=boost::filesystem::path(".off")){
std::string errormessage ="Invalid extension is specified with the mesh file";
throw std::invalid_argument(errormessage);
}
// Create input polyhedron
Polyhedron polyhedron;
input >> polyhedron;
// Create domain
Mesh_domain domain(polyhedron);
// Mesh criteria (no cell_size set)
Mesh_criteria criteria(facet_angle, facet_size, facet_distance,/*facet_topology*/
cell_radius_edge_ratio, cell_size);
// Mesh generation
c3t3.clear();
c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
elems.clear();// clear our vector
interfacingpairs.clear();
handlemap.clear();
elems.resize(c3t3.number_of_cells_in_complex()); // resize it as the new number of elements
size_t i=0;
/*
* This is not a nice way to index elements
* we could use cell_with_info structure of cgal but really how to use that? No tutorial, no example at all on its document!!!
*
* */
for(C3t3::Cells_in_complex_iterator it=c3t3.cells_begin();it!=c3t3.cells_end();it++){
//Create new elements
//share_ptr handles deletion of the newly created element
elems[i]=shared_ptr<MeshElement>(new Linear4NodeTetMeshElem(it));
//Give an index to handle
handlemap[it]=i;
i++;
}
// Add interactions
for(C3t3::Cells_in_complex_iterator it=c3t3.cells_begin();it!=c3t3.cells_end();it++){
//For each neighbor of the currrent iterator
for(int j=0;j<4;j++)
{
C3t3::Cell_handle neigh=it->neighbor(j);
/*Check if we have this neighbor handle*/
if(c3t3.is_in_complex(neigh))
{
size_t indexel=handlemap[it];
size_t indexneigh=handlemap[neigh];
//Get element and its neighbors from element list
shared_ptr<MeshElement> el;
shared_ptr<MeshElement> neighel;
//Change the ordering of the elements
if(indexel<indexneigh){
el=elems[indexel];
neighel=elems[indexneigh];}
else{
neighel=elems[indexel];
el=elems[indexneigh];
}
nodePairsIndices indiceofpairs;
//Get shared node list
indiceofpairs=getNodeCon(el,neighel);
//check if there is a face share
if(indiceofpairs.size()>=3)
{
//Create the pair
ElementPair pair(el,neighel,indiceofpairs);
//Add it into the interfacing pair list
if(!interfacingpairs[pair])
{
interfacingpairs[pair]=shared_ptr<ElementPair>(new ElementPair(el,neighel,indiceofpairs));
}
}
}
}
}
std::cout<<"Meshing is complete "<<std::endl;
std::cout<<"Number of tetrahedral elements "<<elems.size()<<std::endl;
std::cout<<"Number of interaction elements "<<interfacingpairs.size()<<std::endl;
}
Using this function and the off file in the attachment;
When I use the parameters as
facet_angle=33,
facet_distance=.6,
facet_size=0.6,
cell_radius_edge_ratio=0.11,
cell_size=1e-3
The result is 5580 elements and they are distributed as here where you can see the empty parts on the boundary of the plate.
Also slight change on the cell_radius_edge_ratio=0.15 makes it even worser as here.
What do you think the problem is?
Burak
Cum, 2013-10-25 tarihinde 09:28 +0200 saatinde, Sebastien Loriot (GeometryFactory) yazdı:
It might help if you share a minimal example showing the pb. Sebastien. On 10/25/2013 09:26 AM, Burak ER wrote: > Dear Cgal Users, > > I really need help on this problem. Still waiting for an answer. > > Thank you in advance. > > Burak ER > > Pzt, 2013-10-21 tarihinde 18:40 +0300 saatinde, Burak ER yazdı: >> Dear Cgal Users, >> >> I am trying to mesh a rectengular prism domain from an off file into >> tetrahedral elements using cgal. But whatever parameters I use within >> criteria structure, I get a mesh where the boundaries are not conserved >> rather they are "uneven". >> >> What may cause that? How to force keeping boundaries exact while >> meshing? >> >> Thank you in advance. >> >> -- >> Burak ER >> >> Research Assistant >> Mechanical Engineering Department >> Bursa Technical University >> >> >> >
--
Burak ER Research Assistant Faculty of Natural Sciences & Engineering Bursa Technical University mailto:burak.er@btu.edu.tr https://github.com/burak-er |
Bu elektronik posta ve ekleri sadece adreste belirtilen kisi veya kurulusun kullanimi icin gonderilmektedir. Bu mesaj tarafiniza yanlislikla ulasirsa, lutfen gonderen kisiyi bilgilendiriniz ve mesaji sisteminizden siliniz. Mesajda ve eklerinde yer alan bilgilerin her ne sekilde olursa olsun ucuncu kisiler ile paylasilmasi hukuki ve cezai sorumluluk dogurabilir. Bursa Teknik Universitesi'nin, bu mesaj ve eklerinin icerigi ve yayimi ile ilgili hicbir sorumlulugu bulunmamaktadir.
This email and the attachments are sent to the individual or entity defined in the address field only. If you are not the intended recipient or have received the message in error, please notify the sender and remove the message from your system immediately. Sharing the information in the message or the attachments with the 3rd parties may cause legal rules and penalties to apply. Bursa Technical University has no responsibility on the submission of this message and the attachments.
OFF
8 12 0
4.83658 2 0.0946329
-0.163419 2 0.0946329
-0.163419 -2 -0.00536708
-0.163419 -2 0.0946329
-0.163419 2 -0.00536708
4.83658 -2 0.0946329
4.83658 -2 -0.00536708
4.83658 2 -0.00536708
3 7 4 0
3 0 4 1
3 2 6 3
3 3 6 5
3 5 0 3
3 3 0 1
3 2 3 4
3 4 3 1
3 2 4 6
3 6 4 7
3 5 6 0
3 0 6 7
- [cgal-discuss] "About conserving the boundary polyhedron", Burak ER, 10/21/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Sebastien Loriot (GeometryFactory), 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Sebastien Loriot (GeometryFactory), 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Sebastien Loriot (GeometryFactory), 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/26/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/28/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Sebastien Loriot (GeometryFactory), 10/28/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Laurent Rineau (CGAL/GeometryFactory), 10/30/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Sebastien Loriot (GeometryFactory), 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Sebastien Loriot (GeometryFactory), 10/25/2013
- Re: [cgal-discuss] "About conserving the boundary polyhedron while tetrahedral discretization", Burak ER, 10/25/2013
Archive powered by MHonArc 2.6.18.