Skip to content

Commit

Permalink
Fix 2D regularization of cut tessellations
Browse files Browse the repository at this point in the history
Fixed case where a domedge of a tessellation has no domver, as when a
tess is cut by a full circle.
See #724 (comment).
  • Loading branch information
rquey committed Sep 13, 2024
1 parent a7ce0c6 commit 1c3ee06
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 16 deletions.
5 changes: 3 additions & 2 deletions VERSIONS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
New in 4.9.1-4 (27 Aug 2024):
New in 4.9.1-5 (13 Sep 2024):
- module -T: added -n ... -morpho lamellae and (the equivalent)
-morpho lamellar(n=...)", added tessellation key length(d_x,dd_y,d_z).
-morpho lamellar(n=...)", made minor fix to regularization of
2D cut domain, added tessellation key length(d_x,dd_y,d_z).
- made minor fixes and improvements.

New in 4.9.0 (15 May 2024):
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import sphinx_rtd_theme

project = u'Neper'
version = u'4.9.1-4'
release = u'4.9.1-4'
version = u'4.9.1-5'
release = u'4.9.1-5'
author = u'Romain Quey'
copyright = u'Romain Quey'
language = 'en'
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()

set(NEPER_VERSION \"4.9.1-4\")
set(NEPER_VERSION \"4.9.1-5\")
project(neper)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ int
UpdateVerCoo (struct TESS *pTess, int delver, int newver, int verbosity)
{
if ((*pTess).Dim == 2)
return UpdateVerCooBary (pTess, delver, newver);
return UpdateVerCooBary (pTess, delver, newver, verbosity);
else if ((*pTess).Dim == 3)
return UpdateVerCooMiniFF (pTess, newver, verbosity);
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ UpdateEdgeLength (struct TESS *pTess, int ver)
}

int
UpdateVerCooBary (struct TESS *pTess, int delver, int newver)
UpdateVerCooBary (struct TESS *pTess, int delver, int newver, int verbosity)
{
int i, domedge, domedgeqty, domver1, domver2, eqqty;
int *domedges = NULL;
Expand All @@ -284,11 +284,21 @@ UpdateVerCooBary (struct TESS *pTess, int delver, int newver)
vers[0] = delver;
vers[1] = newver;

if (verbosity)
printf ("delver = %d newver = %d\n", delver, newver);

neut_tess_vers_alldomedges (*pTess, vers, 2, &domedges, &domedgeqty);

eqqty = domedgeqty + 1;
eqs = ut_alloc_2d (eqqty, 4);
if (verbosity)
{
printf ("domedgeqty = %d\n", domedgeqty);
printf ("domedges = ");
ut_array_1d_int_fprintf (stdout, domedges, domedgeqty, "%d");
}

eqs = ut_alloc_2d (domedgeqty + 1, 4);

eqqty = 1;
ut_array_1d_memcpy ((*pTess).FaceEq[1], 4, eqs[0]);

if (domedgeqty > 0)
Expand All @@ -297,21 +307,48 @@ UpdateVerCooBary (struct TESS *pTess, int delver, int newver)
domedge = domedges[i];
domver1 = (*pTess).DomEdgeVerNb[domedge][0];
domver2 = (*pTess).DomEdgeVerNb[domedge][1];
ut_space_points_uvect ((*pTess).DomVerCoo[domver1],
(*pTess).DomVerCoo[domver2], v);
ut_vector_vectprod (v, eqs[0] + 1, n);
ut_space_point_normal_plane ((*pTess).DomVerCoo[domver1], n,
eqs[i + 1]);
if (verbosity)
printf ("domedge = %d domver1 = %d domver2 = %d\n", domedge, domver1, domver2);
if (domver1 > 0 && domver2 > 0)
{
eqqty++;
ut_space_points_uvect ((*pTess).DomVerCoo[domver1],
(*pTess).DomVerCoo[domver2], v);
ut_vector_vectprod (v, eqs[0] + 1, n);
ut_space_point_normal_plane ((*pTess).DomVerCoo[domver1], n,
eqs[i + 1]);
}
}

if (verbosity)
{
printf ("eqqty = %d\n", eqqty);
printf ("eqs = ");
ut_array_2d_fprintf (stdout, eqs, eqqty, 4, "%f");
}

ut_array_1d_memcpy ((*pTess).VerCoo[delver], 3, ptcoo[0]);
ut_array_1d_memcpy ((*pTess).VerCoo[newver], 3, ptcoo[1]);

if (verbosity)
{
printf ("ptcoo[0] = ");
ut_array_1d_fprintf (stdout, ptcoo[0], 3, "%f");
printf ("ptcoo[1] = ");
ut_array_1d_fprintf (stdout, ptcoo[1], 3, "%f");
}

ut_space_points_bary_constrained (ptcoo, NULL, 2, eqs, eqqty,
(*pTess).VerCoo[newver]);

if (verbosity)
{
printf ("(*pTess).VerCoo[newver] = ");
ut_array_1d_fprintf (stdout, (*pTess).VerCoo[newver], 3, "%f");
}

ut_free_2d (&ptcoo, 2);
ut_free_2d (&eqs, eqqty);
ut_free_2d (&eqs, domedgeqty + 1);
ut_free_1d (&v);
ut_free_1d (&n);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ extern void UpdateVerState (struct TESS *, int, int, int);
extern void UpdateVerEdge (struct TESS *, int, int, int, int);
extern int UpdateVerBound (struct TESS *, int, int);
extern int UpdateVerCoo (struct TESS *, int, int, int);
extern int UpdateVerCooBary (struct TESS *, int, int);
extern int UpdateVerCooBary (struct TESS *, int, int, int);
extern int UpdateVerCooMiniFF (struct TESS *, int, int);

0 comments on commit 1c3ee06

Please sign in to comment.