Skip to content

Transform: breakElements (NGON & MIXED) to ME in api3#574

Open
vincentcasseau wants to merge 3 commits intoonera:devfrom
vincentcasseau:dev-breakElements2
Open

Transform: breakElements (NGON & MIXED) to ME in api3#574
vincentcasseau wants to merge 3 commits intoonera:devfrom
vincentcasseau:dev-breakElements2

Conversation

@vincentcasseau
Copy link
Copy Markdown
Collaborator

T.breakElements (NGON & MIXED) returns a ME (thus api3) instead of a list of BEs

Regressions

Apps            : createDragonMesh_t1.py                  : 0m1.87s   : 0m2.26s   : 25/11/25 11h30  : 0%   :   :  FAILED    
Converter       : convertArray2Hexa_t1.py                 : 0m0.45s   : 0m0.47s   : 12/01/26 09h56  : 92%  :   :  OK    
Converter       : convertArray2Tetra_t1.py                : 0m0.45s   : 0m0.39s   : 07/05/24 14h48  : 100% :   :  OK
Transform       : breakElementsPT_t1.py                   : 0m0.48s   : 0m0.39s   : 07/05/24 15h01  : 0%   :   :  FAILED   
Transform       : breakElements_t1.py                     : 0m0.44s   : 0m0.39s   : 07/05/24 15h01  : 100% :   :  OK    

where:

  • OK means geometrically identical
  • FAILED means different output

Regression breakElementsPT_t1

DIFF: longueur des fils differente pour le noeud: Base.
  - Noms des noeuds de courant qui ne sont pas dans ref:
TETRA,PENTA,HEXA.
  - Noms des noeuds de ref qui ne sont pas dans courant:
TETRA, PENTA, HEXA.

Regression createDragonMesh_t1

This test shows that permuting vertex indices without changing the geometry produces a different output in G.tetraMesher

# - tetraMesher (pyTree) -
import Generator.PyTree as G
import Converter.PyTree as C
import Converter.Internal as Internal
import Post.PyTree as P
import Transform.PyTree as T

def _remap(ext):
    import numpy as np
    np.random.seed(42)

    gcx = Internal.getNodeFromName(ext, 'CoordinateX')[1]
    gcy = Internal.getNodeFromName(ext, 'CoordinateY')[1]
    gcz = Internal.getNodeFromName(ext, 'CoordinateZ')[1]
    ec = Internal.getNodeFromName(ext, 'ElementConnectivity')[1]

    npts = gcx.shape[0]
    # indir maps new -> old
    indir = np.random.permutation(npts)
    gcx[:] = gcx[indir]
    gcy[:] = gcy[indir]
    gcz[:] = gcz[indir]

    # inverse mapping old -> new
    invIndir = np.empty_like(indir)
    invIndir[indir] = np.arange(npts)
    ec[:] = invIndir[ec-1] + 1

a = G.cart((0,0,0), (1,1,1), (10,10,10))
ext = P.exteriorFaces(a)
ext = C.convertArray2Tetra(ext)
ext = G.close(ext)
ext = T.reorder(ext, (-1,))
m1 = G.tetraMesher(ext, algo=1)
_remap(ext)
m2 = G.tetraMesher(ext, algo=1)
C.convertPyTree2File(m1, 'out1.cgns')
C.convertPyTree2File(m2, 'out2.cgns')

print(m1[1], m2[1])

Perfos

Using this test case:

# - breakElements (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Transform.PyTree as T
import time

a1 = G.cartNGon((-1.,0.,0.),(0.01,0.01,0.01),(110,30,30)) # 3D
a6 = G.cartTetra((-0.4,1.,0),(0.0025,0.0025,0.0025),(100,100,100)) # 3D
a7 = G.cartPenta((-0.4,1.4,0),(0.0025,0.0025,0.0025),(100,100,100)) # 3D
A = [a1,a6,a7]

A = C.convertArray2NGon(A)
a = T.join(A)
C._initVars(a,'{F}={CoordinateX}+{CoordinateY}**2')
res = T.breakElements(a)

Elapsed CPU time of T.breakElements:

  • old algo: 5.348 sec
  • new algo: 0.594 sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant