Skip to content

Commit

Permalink
Colorize hyper recangle with simplices
Browse files Browse the repository at this point in the history
  • Loading branch information
nmuch committed Mar 6, 2024
1 parent 3fc2fae commit ab2c3d5
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions source/grid/grid_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2634,7 +2634,7 @@ namespace GridGenerator
// use a large epsilon to
// compare numbers to avoid
// roundoff problems.
double epsilon = 10;
double epsilon = std::numeric_limits<double>::max();
for (unsigned int i = 0; i < dim; ++i)
epsilon = std::min(epsilon, 0.01 * delta[i][i]);
Assert(epsilon > 0,
Expand Down Expand Up @@ -8645,8 +8645,6 @@ namespace GridGenerator
{
AssertDimension(dim, spacedim);

AssertThrow(colorize == false, ExcNotImplemented());

std::vector<Point<spacedim>> vertices;
std::vector<CellData<dim>> cells;

Expand Down Expand Up @@ -8782,11 +8780,34 @@ namespace GridGenerator
}
else
{
AssertThrow(colorize == false, ExcNotImplemented());
AssertThrow(false, ExcNotImplemented());
}

// actually create triangulation
tria.create_triangulation(vertices, cells, SubCellData());

if (colorize)
{
// to colorize, run through all
// faces of all cells and set
// boundary indicator to the
// correct value if it was 0.

// use a large epsilon to
// compare numbers to avoid
// roundoff problems.
double epsilon = std::numeric_limits<double>::max();
for (unsigned int i = 0; i < dim; ++i)
epsilon = std::min(epsilon,
0.01 * (std::abs(p2[i] - p1[i]) / repetitions[i]));
Assert(epsilon > 0,
ExcMessage(
"The distance between corner points must be positive."));

// actual code is external since
// 1-D is different from 2/3d.
colorize_subdivided_hyper_rectangle(tria, p1, p2, epsilon);
}
}


Expand Down

0 comments on commit ab2c3d5

Please sign in to comment.