Triangulation Merge Error

21 views
Skip to first unread message

pushkar...@gmail.com

unread,
Dec 15, 2020, 11:19:53 AM12/15/20
to deal.II User Group
Dear deal.II community

As a beginner trying to understand this library I tried to merge two traingulations namely "cheese" and "hyper_cube" by modifying step-1 as -
void first_grid ()
{
  Triangulation<2> tria1,tria2,tria_merge;
  /*const double R = 13.0;
  const double r =7.0;*/
  const double  left = 0.0;
  const double right = 1.0;
  const std::vector<unsigned int> holes={6,5};
  GridGenerator::cheese(tria1, holes);
  GridGenerator::hyper_cube(tria2, left, right);
  GridGenerator::merge_triangulations(tria1, tria2, tria_merge);
  unsigned int cells = tria_merge.n_cells(4);
  std::ofstream out ("grid-1.vtk");
  GridOut grid_out;
  grid_out.write_vtk (tria_merge, out);
  std::cout << "Grid written to grid-1.vtk" << std::endl;
  std::cout << "Number of cells:" << cells << std::endl;
}
int main ()
{
  first_grid ();
  //second_grid ();
}

After compiling I ran into an error that -

terminate called after throwing an instance of 'dealii::StandardExceptions::ExcInternalError'
  what():  
--------------------------------------------------------
An error occurred in line <1999> of file </home/pushkar/dealii-9.0.0/source/grid/tria.cc> in function
    static void dealii::internal::TriangulationImplementation::Implementation::create_triangulation(const std::vector<dealii::Point<dim> >&, const std::vector<dealii::CellData<2> >&, const dealii::SubCellData&, dealii::Triangulation<2, spacedim>&) [with int spacedim = 2]
The violated condition was:
    (n_adj_cells >= 1) && (n_adj_cells <= 2)
Additional information:
    This exception -- which is used in many places in the library -- usually indicates that some condition which the author of the code thought must be satisfied at a certain point in an algorithm, is not fulfilled. An example would be that the first part of an algorithm sorts elements of an array in ascending order, and a second part of the algorithm later encounters an element that is not larger than the previous one.

There is usually not very much you can do if you encounter such an exception since it indicates an error in deal.II, not in your own program. Try to come up with the smallest possible program that still demonstrates the error and contact the deal.II mailing lists with it to obtain help.
--------------------------------------------------------

So I am wondering that am I doing something wrong or is there any consistency check that needs to be performed while merging triangulations. Any direction in this regard will surely be beneficial.

Thanks
Pushkar




Wolfgang Bangerth

unread,
Dec 15, 2020, 7:23:32 PM12/15/20
to dea...@googlegroups.com
On 12/15/20 9:19 AM, pushkar...@gmail.com wrote:
>
> So I am wondering that am I doing something wrong or is there any consistency
> check that needs to be performed while merging triangulations. Any direction
> in this regard will surely be beneficial.

Pushkar,
I suspect (knowing where the error message is coming from) that the two
triangulations overlap each other and that the algorithm is matching an
internal edge of one triangulation with a boundary edge of the other
triangulation. That doesn't work, but you can at least try that out by
outputting the two triangulations and plotting them at the same time.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages