diff --git a/applications/test/GAMGAgglomeration/Make/options b/applications/test/GAMGAgglomeration/Make/options index fa15f124528ebfcaf279a88a73a0d7954f2e9dc1..d27c95d033dd5d7b1995c8ff8dc406e35ca1f586 100644 --- a/applications/test/GAMGAgglomeration/Make/options +++ b/applications/test/GAMGAgglomeration/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lfiniteVolume + -lfiniteVolume \ + -lmeshTools diff --git a/applications/test/GAMGAgglomeration/Test-GAMGAgglomeration.C b/applications/test/GAMGAgglomeration/Test-GAMGAgglomeration.C index b1d17278d342fc8bc64097b4ff1458a9e626a75e..82ccd8ce33605cb9e2dbbd91eb06de6780036199 100644 --- a/applications/test/GAMGAgglomeration/Test-GAMGAgglomeration.C +++ b/applications/test/GAMGAgglomeration/Test-GAMGAgglomeration.C @@ -31,14 +31,31 @@ Description #include "fvCFD.H" #include "GAMGAgglomeration.H" +#include "OFstream.H" +#include "meshTools.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: int main(int argc, char *argv[]) { + argList::addBoolOption + ( + "writeObj", + "write obj files of agglomeration" + ); + argList::addBoolOption + ( + "normalise", + "normalise agglomeration (0..1)" + ); + #include "setRootCase.H" #include "createTime.H" + + bool writeObj = args.optionFound("writeObj"); + bool normalise = args.optionFound("normalise"); + #include "createMesh.H" const fvSolution& sol = static_cast<const fvSolution&>(mesh); @@ -130,11 +147,47 @@ int main(int argc, char *argv[]) { fld[cellI] = cellToCoarse[cellI]; } - fld /= max(fld); + if (normalise) + { + fld /= max(fld); + } scalarAgglomeration.correctBoundaryConditions(); scalarAgglomeration.write(); } + if (writeObj) + { + OFstream str(runTime.path()/runTime.timeName()/"aggomeration.obj"); + label vertI = 0; + + // Write all mesh cc + forAll(mesh.cellCentres(), cellI) + { + meshTools::writeOBJ(str, mesh.cellCentres()[cellI]); + vertI++; + } + + // Determine coarse cc + forAll(coarseToCell, coarseI) + { + const labelList& cellLabels = coarseToCell[coarseI]; + + point coarseCc = average + ( + pointField(mesh.cellCentres(), cellLabels) + ); + meshTools::writeOBJ(str, coarseCc); + vertI++; + + forAll(cellLabels, i) + { + label cellI = cellLabels[i]; + + str << "l " << cellI+1 << ' ' << vertI << nl; + } + } + } + Info<< endl; }