hi all, I tried to create a mesh as follws: 1. Generate the initial mesh using gmsh. Use 1, 2, 3 as boundary_indicator to denote three diffenrent boundary. Then I got the initial square.msh file. It looks like this:
<https://lh3.googleusercontent.com/-B9nFe31_nm0/WucM0SD0buI/AAAAAAAAAEU/W-6SNDv7WhUf1atPyc_A_Ar1k226Wi5-QCLcBGAs/s1600/square.png> 2. Read the mesh into dealii. Refine those cells with boundary indicator 3 and output to square_refined0.msh. When output this refined mesh, I used flags to keep the boundary indicators. so the boundary faces still have correct boundary_indicators after refinement. <https://lh3.googleusercontent.com/-bL-WfDv6tBs/WucO5rF0STI/AAAAAAAAAEg/kLIBz66R6ZY_UKtv3rbcgQCogDjMVs14QCLcBGAs/s1600/square_refined0.msh.png> My problem is: When I use the following code to test the resulting mesh square_refined0.msh. The result shows that there are 24 faces whose boundary_id is 0 in the triangulation. Since from the initial mesh, I only set boundary_ids to 1,2,3. Why the resulting mesh have boundary_id 0? Is this a bug? My code is like: void test_square(){ Triangulation<2> triangulation; GridIn<2> gridin; gridin.attach_triangulation(triangulation); std::ifstream f("square_good_refined0.msh"); gridin.read_msh(f); int i1=0; typename Triangulation<2>::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); for(; cell!=endc; cell++) for(unsigned int face = 0; face<GeometryInfo<2>::faces_per_cell; face++){ if(cell->face(face)->boundary_id()==0) i1 ++; } std::cout<<"number of boundary_id=0 faces "<<i1<<std::endl; } -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
square_refined0.msh
Description: Mesh model
#include<deal.II/grid/tria.h>
#include<deal.II/grid/tria_accessor.h>
#include<deal.II/grid/tria_iterator.h>
#include<deal.II/grid/grid_generator.h>
#include<deal.II/grid/grid_tools.h>
#include<deal.II/grid/manifold_lib.h>
#include<deal.II/grid/grid_in.h>
#include<deal.II/grid/grid_out.h>
#include<iostream>
#include<fstream>
#include<map>
using namespace dealii;
void test_square(){
void test_square(){
Triangulation<2> triangulation;
GridIn<2> gridin;
gridin.attach_triangulation(triangulation);
std::ifstream f("square_refined0.msh");
gridin.read_msh(f);
int i1=0;
typename Triangulation<2>::active_cell_iterator
cell = triangulation.begin_active(),
endc = triangulation.end();
for(; cell!=endc; cell++)
for(unsigned int face = 0; face<GeometryInfo<2>::faces_per_cell; face++){
if(cell->face(face)->boundary_id()==0)
i1 ++;
}
std::cout<<"number of boundary_id=0 faces "<<i1<<std::endl;
}
int main(){
try{
test_square();
}
catch(std::exception &exc){
std::cerr<<std::endl<<std::endl<<"--------------"<<std::endl;
std::cerr<<"exception on processing:"<<std::endl<<exc.what()<<std::endl;
return 1;
}
catch(...){
std::cerr<<std::endl<<"---------------"<<std::endl;
std::cerr<<"unknown exception"<<std::endl;
return 1;
}
}
