Skip to content

Commit

Permalink
CPlot: update tkTetraMesher
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit128 committed Dec 20, 2024
1 parent 1d4be56 commit ce653b5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
5 changes: 4 additions & 1 deletion Cassiopee/CPlot/apps/tkBC.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ def view(event=None):
#==============================================================================
def check():
if CTK.t == []: return

if CTK.CADHOOK is not None: return

node = Internal.getNodeFromName(CTK.t, 'EquationDimension')
if node is not None: ndim = Internal.getValue(node)
else:
Expand Down Expand Up @@ -514,6 +515,8 @@ def connectNearMatch():
#==============================================================================
def fillEmptyBCWith():
if CTK.t == []: return
if CTK.CADHOOK is not None: return # not coded for now

typeBC = VARS[4].get()
if typeBC not in Internal.KNOWNBCS:
nameBC = typeBC; typeBC = 'FamilySpecified:'+typeBC
Expand Down
8 changes: 4 additions & 4 deletions Cassiopee/CPlot/apps/tkTetraMesher.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def tetraMesher():
out.append(CTK.t[2][nob][2][noz])

try:
mesh = G.tetraMesher(out, algo=algo, grading=0.3)
mesh = G.tetraMesher(out, algo=algo, grading=0.3, recoverBC=True)
CTK.t = C.addBase2PyTree(CTK.t, 'MESHES')
bases = Internal.getNodesFromName1(CTK.t, 'MESHES')
nob = C.getNobOfBase(bases[0], CTK.t)
Expand Down Expand Up @@ -82,12 +82,12 @@ def createApp(win):
if 'tkTetraMesherType' in CTK.PREFS: V.set(CTK.PREFS['tkTetraMesherType'])

# - mesher menu -
B = TTK.OptionMenu(Frame, VARS[0], 'netgen', 'tetgen')
B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)
#B = TTK.OptionMenu(Frame, VARS[0], 'netgen', 'tetgen')
#B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)

# - Run -
B = TTK.Button(Frame, text="tetraMesher", command=tetraMesher)
B.grid(row=0, column=0, sticky=TK.EW)
B.grid(row=0, column=0, columnspan=2, sticky=TK.EW)
WIDGETS['tetraMesher'] = B
BB = CTK.infoBulle(parent=B, text='Mesh with TETRAs or TRIs.')

Expand Down
20 changes: 9 additions & 11 deletions Cassiopee/Converter/Converter/IO/GenIO_fmtfoam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool dirExist(char* path)
// return 0: OK, 1: FAILED
E_Int createDir(char* path)
{
if (dirExist(path) == true) { printf("exists : %s\n", path); return 0; }
if (dirExist(path) == true) { printf("exists: %s\n", path); return 0; }
#if defined(_WIN32)
int ret = _mkdir(path);
#else
Expand Down Expand Up @@ -273,7 +273,7 @@ E_Int K_IO::GenIO::readScalarField(char *file, FldArrayF& f, E_Int idx,
char buf[128];
readWord(ptrFile, buf);
E_Float val = strtod(buf, NULL);
printf("Info; foamread: uniform " SF_F_ ".\n", val);
printf("Info: foamread: uniform " SF_F_ ".\n", val);
for (E_Int j = 0; j < bcsize; j++) {
bcf[j] = val;
}
Expand All @@ -291,7 +291,7 @@ E_Int K_IO::GenIO::readScalarField(char *file, FldArrayF& f, E_Int idx,
if (strcmp(buf, "uniform") == 0) {
readWord(ptrFile, buf);
E_Float val = strtod(buf, NULL);
printf("Info; foamread: uniform " SF_F_ ".\n", val);
printf("Info: foamread: uniform " SF_F_ ".\n", val);
for (E_Int j = 0; j < bcsize; j++) {
bcf[i] = val;
}
Expand Down Expand Up @@ -352,7 +352,7 @@ E_Int K_IO::GenIO::readScalarField(char *file, FldArrayF& f, E_Int idx,
char buf[128];
readWord(ptrFile, buf);
E_Float val = strtod(buf, NULL);
printf("Info; foamread: uniform " SF_F_ ".\n", val);
printf("Info: foamread: uniform " SF_F_ ".\n", val);
for (E_Int j = 0; j < bcsize; j++) {
bcf[j] = val;
}
Expand Down Expand Up @@ -494,7 +494,7 @@ E_Int K_IO::GenIO::readVectorField(char *file, FldArrayF& f, E_Int idx,
readInt(buf, 1024, pos, nfaces);
assert(nfaces == bcsize);

printf("Info; foamread: " SF_D_ " faces.", nfaces);
printf("Info: foamread: " SF_D_ " faces.", nfaces);

skipLine(ptrFile);

Expand Down Expand Up @@ -989,7 +989,7 @@ E_Int K_IO::GenIO::foamReadPoints(char* file, FldArrayF& f)
}
fclose(ptrFile);

printf("points: " SF_D_ "\n", f.getSize());
printf("Info: foamread: points: " SF_D_ "\n", f.getSize());

return 0;
}
Expand Down Expand Up @@ -1057,7 +1057,7 @@ E_Int K_IO::GenIO::foamReadFaces(char* file, E_Int& nfaces, FldArrayI& cn)
}
fclose(ptrFile);

printf("faces: " SF_D_ "\n", nfaces);
printf("Info: foamread: faces: " SF_D_ "\n", nfaces);

return 0;
}
Expand Down Expand Up @@ -1153,7 +1153,7 @@ E_Int K_IO::GenIO::foamReadNeighbour(char* file, FldArrayI& PE)
PE(i,2) = 0; // exterior
}

printf("internal faces: " SF_D_ "\n", nifaces);
printf("Info: foamread: internal faces: " SF_D_ "\n", nifaces);

fclose(ptrFile);

Expand All @@ -1172,7 +1172,7 @@ E_Int K_IO::GenIO::foamReadBoundary(char* file,
FILE* ptrFile = fopen(fullPath, "r");
if (ptrFile == NULL)
{
printf("foamread: can not open constant/polyMesh/boundary.\n");
printf("Info: foamread: can not open constant/polyMesh/boundary.\n");
return 1;
}
E_Int ret;
Expand Down Expand Up @@ -1546,8 +1546,6 @@ E_Int K_IO::GenIO::foamwrite(

E_Int nzone = unstructField.size();

std::cout << "nzone = " << nzone << std::endl;

// All zones must have posx, posy, posz
E_Int posx, posy, posz;
posx = K_ARRAY::isCoordinateXPresent(varString);
Expand Down
2 changes: 1 addition & 1 deletion Cassiopee/Generator/Generator/Generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ def T3mesher2D(a, grading=1.2, triangulateOnly=0, metricInterpType=0):
except:
return generator.T3mesher2D(a, grading, triangulateOnly, metricInterpType)

def tetraMesher(a, maxh=-1., grading=0.4, triangulateOnly=0,
def tetraMesher(a, maxh=-1., grading=0.4,
remeshBoundaries=0, algo=1, optionString=""):
"""Create a TRI/TETRA mesh given a set of BAR or surfaces in a.
Usage: tetraMesher(a, maxh, grading)"""
Expand Down
4 changes: 2 additions & 2 deletions Cassiopee/Generator/doc/source/Generator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,10 @@ General purpose grid generator
:type maxh: float
:param grading: max adjacent cell ratio [tetgen]
:type grading: float
:param optionString: string of options identical to tetgen [tetgen]
:type optionString: string
:param algo: choice parameter between netgen and tetgen
:type algo: integer (0 or 1)
:param optionString: string of options identical to tetgen [tetgen]
:type optionString: string
:return: 3D mesh
:rtype: [array] or [pyTree zone]

Expand Down

0 comments on commit ce653b5

Please sign in to comment.