diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C index 37e9c24992..b4692d201a 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C +++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,7 +48,7 @@ Note creating the cellTable information. See also - Foam::cellTable, Foam::meshWriter and Foam::meshWriters::STARCD + Foam::cellTable, Foam::meshWriter and Foam::fileFormats::STARCDMeshWriter \*---------------------------------------------------------------------------*/ @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) if (!timeI || state != polyMesh::UNCHANGED) { - meshWriters::STARCD writer(mesh, scaleFactor); + fileFormats::STARCDMeshWriter writer(mesh, scaleFactor); if (args.optionFound("noBnd")) { diff --git a/applications/utilities/mesh/conversion/sammToFoam/Make/files b/applications/utilities/mesh/conversion/sammToFoam/Make/files deleted file mode 100644 index b0b81c5ea5..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/Make/files +++ /dev/null @@ -1,17 +0,0 @@ -sammMesh.C -fillSammCellShapeTable.C -fillSammAddressingTable.C -readPoints.C -readCells.C -readBoundary.C -fixCollapsedEdges.C -readCouples.C -calcPointCells.C -createPolyCells.C -createBoundaryFaces.C -createPolyBoundary.C -purgeCellShapes.C -writeMesh.C -sammToFoam.C - -EXE = $(FOAM_APPBIN)/sammToFoam diff --git a/applications/utilities/mesh/conversion/sammToFoam/Make/options b/applications/utilities/mesh/conversion/sammToFoam/Make/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/applications/utilities/mesh/conversion/sammToFoam/calcPointCells.C b/applications/utilities/mesh/conversion/sammToFoam/calcPointCells.C deleted file mode 100644 index 1204fb810f..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/calcPointCells.C +++ /dev/null @@ -1,139 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::calcPointCells() const -{ - static const label UNIT_POINT_CELLS = 12; - - if (pointCellsPtr_) - { - FatalErrorInFunction - << "PointCells already calculated" - << abort(FatalError); - } - - - pointCellsPtr_ = new labelListList(points_.size()); - - labelListList& pc = *pointCellsPtr_; - - forAll(pc, i) - { - pc[i].setSize(UNIT_POINT_CELLS); - } - - // Initialise the list of labels which will hold the count the - // actual number of cells per point during the analysis - labelList cellCount(points_.size()); - - forAll(cellCount, i) - { - cellCount[i] = 0; - } - - // Note. Unlike the standard point-cell algorithm, which asks the cell for - // the supporting point labels, we need to work based on the cell faces. - // This is because some of the faces for meshes with arbitrary interfaces - // do not come from the cell shape, but from the slaves of the coupled - // match. It is also adventageous to remove the duplicates from the - // point-cell addressing, because this removes a lot of waste later. - // - - // For each cell - forAll(cellShapes_, celli) - { - const faceList& faces = cellFaces_[celli]; - - forAll(faces, i) - { - // For each vertex - const labelList& labels = faces[i]; - - forAll(labels, j) - { - // Set working point label - label curPoint = labels[j]; - labelList& curPointCells = pc[curPoint]; - label curCount = cellCount[curPoint]; - - // check if the cell has been added before - bool found = false; - - for (label f = 0; f < curCount; f++) - { - if (curPointCells[f] == celli) - { - found = true; - - break; - } - } - - if (!found) - { - - // If the list of pointCells is not big enough, double it - if (curPointCells.size() <= curCount) - { - curPointCells.setSize(curPointCells.size()*2); - } - - // Enter the cell label in the point's cell list - curPointCells[curCount] = celli; - - // Increment the cell count for the point addressed - cellCount[curPoint]++; - } - } - } - } - - // Finally, truncate the lists made to their active size - forAll(pc, i) - { - pc[i].setSize(cellCount[i]); - } -} - - -const Foam::labelListList& Foam::sammMesh::pointCells() const -{ - if (!pointCellsPtr_) - { - calcPointCells(); - } - - return *pointCellsPtr_; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/createBoundaryFaces.C b/applications/utilities/mesh/conversion/sammToFoam/createBoundaryFaces.C deleted file mode 100644 index e3d3ed1f44..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/createBoundaryFaces.C +++ /dev/null @@ -1,126 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool Foam::sammMesh::sammEqualFace -( - const face& boundaryFace, - const face& cellFace -) const -{ - // A PROSTAR boundary face is defined by 4 vertices irrespective - // of its topology. - // In order to deal with all possibilities, two faces will be - // considered equal if three of the vertices are the same. - label nEqual = 0; - - forAll(cellFace, cellFaceLabelI) - { - const label curCellFaceLabel = cellFace[cellFaceLabelI]; - - forAll(boundaryFace, bouFaceLabelI) - { - if (boundaryFace[bouFaceLabelI] == curCellFaceLabel) - { - nEqual++; - - break; - } - } - } - - if (nEqual >= 3) - { - return true; - } - else - { - return false; - } -} - - -void Foam::sammMesh::createBoundaryFaces() -{ - forAll(boundary_, patchi) - { - faceList& patchFaces = boundary_[patchi]; - - const labelListList& PointCells = pointCells(); - - forAll(patchFaces, facei) - { - bool found = false; - - face& curFace = patchFaces[facei]; - const labelList& facePoints = curFace; - - forAll(facePoints, pointi) - { - const labelList& facePointCells = - PointCells[facePoints[pointi]]; - - forAll(facePointCells, celli) - { - const faceList& curCellFaces = - cellFaces_[facePointCells[celli]]; - - forAll(curCellFaces, cellFacei) - { - if (sammEqualFace(curCellFaces[cellFacei], curFace)) - { - // Found the cell face corresponding to this face - found = true; - - // Set boundary face to the corresponding cell face - // which guarantees it is outward-pointing - curFace = curCellFaces[cellFacei]; - } - if (found) break; - } - if (found) break; - } - if (found) break; - } - if (!found) - { - FatalErrorInFunction - << "Face " << facei - << " does not have neighbour cell." << endl - << " face : " << endl << curFace - << abort(FatalError); - } - } - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/createPolyBoundary.C b/applications/utilities/mesh/conversion/sammToFoam/createPolyBoundary.C deleted file mode 100644 index 3bdafa60d8..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/createPolyBoundary.C +++ /dev/null @@ -1,144 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" -#include "polyPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::createPolyBoundary() -{ - label nBoundaryFacesFound = 0; - - polyBoundaryPatchStartIndices_.setSize(boundary_.size()); - - label nCreatedFaces = nInternalFaces_; - - const labelListList& PointCells = pointCells(); - - forAll(boundary_, patchi) - { - const faceList& curShapePatch = boundary_[patchi]; - - polyBoundaryPatchStartIndices_[patchi] = nCreatedFaces; - - forAll(curShapePatch, facei) - { - bool found = false; - - const face& curFace = curShapePatch[facei]; - - meshFaces_[nCreatedFaces] = curFace; - - // Must find which cell this face belongs to in order to - // mark it in the cellPolys_ - const labelList& facePoints = curFace; - - forAll(facePoints, pointi) - { - const labelList& facePointCells = - PointCells[facePoints[pointi]]; - - forAll(facePointCells, celli) - { - const faceList& curCellFaces = - cellFaces_[facePointCells[celli]]; - - forAll(curCellFaces, cellFacei) - { - if (curCellFaces[cellFacei] == curFace) - { - // Found the cell face corresponding to this face - found = true; - - // Debugging - if - ( - cellPolys_[facePointCells[celli]][cellFacei] - != -1 - ) - { - FatalErrorInFunction - << "This looks like an already detected " - << "internal face" - << abort(FatalError); - } - - cellPolys_[facePointCells[celli]][cellFacei] = - nCreatedFaces; - - nBoundaryFacesFound++; - } - if (found) break; - } - if (found) break; - } - if (found) break; - } - - nCreatedFaces++; - } - } - - // reset the size of the face list - meshFaces_.setSize(nCreatedFaces); - - Info<< "Number of boundary faces: " << nBoundaryFacesFound << endl; - Info<< "Total number of faces: " << nCreatedFaces << endl; -} - - -Foam::List Foam::sammMesh::polyBoundaryPatches -( - const polyMesh& pMesh -) -{ - List p(boundary_.size()); - - forAll(boundary_, patchi) - { - const faceList& curShapePatch = boundary_[patchi]; - - p[patchi] = polyPatch::New - ( - patchTypes_[patchi], - patchNames_[patchi], - curShapePatch.size(), - polyBoundaryPatchStartIndices_[patchi], - patchi, - pMesh.boundaryMesh() - ).ptr(); - - p[patchi]->physicalType() = patchPhysicalTypes_[patchi]; - } - - return p; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/createPolyCells.C b/applications/utilities/mesh/conversion/sammToFoam/createPolyCells.C deleted file mode 100644 index 8ae1dafe01..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/createPolyCells.C +++ /dev/null @@ -1,188 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::createPolyCells() -{ - // loop through all cell faces and create connectivity. This will produce - // a global face list and will describe all cells as lists of face labels - - // count the maximum number of faces and set the size of the cellPolys_ - cellPolys_.setSize(cellShapes_.size()); - - label maxFaces = 0; - - forAll(cellPolys_, celli) - { - cell& curCell = cellPolys_[celli]; - - curCell.setSize(cellFaces_[celli].size()); - - forAll(curCell, fI) - { - curCell[fI] = -1; - } - - maxFaces += cellFaces_[celli].size(); - } - - Info<< "Maximum possible number of faces in mesh: " << maxFaces << endl; - - meshFaces_.setSize(maxFaces); - - // set reference to point-cell addressing - const labelListList& PointCells = pointCells(); - - bool found = false; - - nInternalFaces_ = 0; - - forAll(cellFaces_, celli) - { - // Note: - // Insertion cannot be done in one go as the faces need to be - // added into the list in the increasing order of neighbour - // cells. Therefore, all neighbours will be detected first - // and then added in the correct order. - - const faceList& curFaces = cellFaces_[celli]; - - // Record the neighbour cell - labelList neiCells(curFaces.size(), -1); - - // Record the face of neighbour cell - labelList faceOfNeiCell(curFaces.size(), -1); - - label nNeighbours = 0; - - // For all faces ... - forAll(curFaces, facei) - { - // Skip faces that have already been matched - if (cellPolys_[celli][facei] >= 0) continue; - - found = false; - - const face& curFace = curFaces[facei]; - - // get the list of labels - const labelList& curPoints = curFace; - - // For all points - forAll(curPoints, pointi) - { - // get the list of cells sharing this point - const labelList& curNeighbours = PointCells[curPoints[pointi]]; - - // For all neighbours - forAll(curNeighbours, neiI) - { - label curNei = curNeighbours[neiI]; - - // reject neighbours with the lower label. This should - // also reject current cell. - if (curNei > celli) - { - // get the list of search faces - const faceList& searchFaces = cellFaces_[curNei]; - - forAll(searchFaces, neiFacei) - { - if (searchFaces[neiFacei] == curFace) - { - // match!! - found = true; - - // Record the neighbour cell and face - neiCells[facei] = curNei; - faceOfNeiCell[facei] = neiFacei; - nNeighbours++; - - break; - } - } - if (found) break; - } - if (found) break; - } - if (found) break; - } // End of current points - } // End of current faces - - // Add the faces in the increasing order of neighbours - for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++) - { - // Find the lowest neighbour which is still valid - label nextNei = -1; - label minNei = cellPolys_.size(); - - forAll(neiCells, ncI) - { - if (neiCells[ncI] > -1 && neiCells[ncI] < minNei) - { - nextNei = ncI; - minNei = neiCells[ncI]; - } - } - - if (nextNei > -1) - { - // Add the face to the list of faces - meshFaces_[nInternalFaces_] = curFaces[nextNei]; - - // Mark for owner - cellPolys_[celli][nextNei] = nInternalFaces_; - - // Mark for neighbour - cellPolys_[neiCells[nextNei]][faceOfNeiCell[nextNei]] = - nInternalFaces_; - - // Stop the neighbour from being used again - neiCells[nextNei] = -1; - - // Increment number of faces counter - nInternalFaces_++; - } - else - { - FatalErrorInFunction - << "Error in internal face insertion" - << abort(FatalError); - } - } - } - - // I won't reset the size of internal faces, because more faces will be - // added in createPolyBoundary() -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/fillSammAddressingTable.C b/applications/utilities/mesh/conversion/sammToFoam/fillSammAddressingTable.C deleted file mode 100644 index 529d996d69..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/fillSammAddressingTable.C +++ /dev/null @@ -1,216 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::sammMesh::fillSammAddressingTable() -{ - // SAMM trim type 1: 8 models - static label SammTrim1Rot0[10] = {1, 5, 6, 2, 8, 10, 4, 7, 3, 9}; - static label SammTrim1Rot1[10] = {2, 6, 7, 3, 8, 10, 5, 4, 0, 9}; - static label SammTrim1Rot2[10] = {3, 7, 4, 0, 8, 10, 6, 5, 1, 9}; - static label SammTrim1Rot3[10] = {0, 4, 5, 1, 8, 10, 7, 6, 2, 9}; - static label SammTrim1Rot4[10] = {7, 3, 2, 6, 8, 10, 0, 1, 5, 9}; - static label SammTrim1Rot5[10] = {4, 0, 3, 7, 8, 10, 1, 2, 6, 9}; - static label SammTrim1Rot6[10] = {5, 1, 0, 4, 8, 10, 2, 3, 7, 9}; - static label SammTrim1Rot7[10] = {6, 2, 1, 5, 8, 10, 3, 0, 4, 9}; - - sammAddressingTable[1] = SammTrim1Rot0; - sammAddressingTable[2] = SammTrim1Rot1; - sammAddressingTable[4] = SammTrim1Rot2; - sammAddressingTable[8] = SammTrim1Rot3; - sammAddressingTable[16] = SammTrim1Rot4; - sammAddressingTable[32] = SammTrim1Rot5; - sammAddressingTable[64] = SammTrim1Rot6; - sammAddressingTable[128] = SammTrim1Rot7; - - - // SAMM trim type 2: 12 models - static label SammTrim2Rot0[10] = {9, 3, 7, 4, 10, 8, 2, 6, 5, 11}; - static label SammTrim2Rot1[10] = {9, 1, 5, 6, 10, 8, 0, 4, 7, 11}; - static label SammTrim2Rot2[10] = {9, 2, 1, 5, 10, 8, 3, 0, 4, 11}; - static label SammTrim2Rot3[10] = {9, 0, 3, 7, 10, 8, 1, 2, 6, 11}; - - static label SammTrim2Rot4[10] = {9, 4, 5, 1, 10, 8, 7, 6, 2, 11}; - static label SammTrim2Rot5[10] = {9, 5, 1, 0, 10, 8, 6, 2, 3, 11}; - static label SammTrim2Rot6[10] = {9, 1, 0, 4, 10, 8, 2, 3, 7, 11}; - static label SammTrim2Rot7[10] = {9, 0, 4, 5, 10, 8, 3, 7, 6, 11}; - - static label SammTrim2Rot8[10] = {9, 1, 2, 3, 10, 8, 5, 6, 7, 11}; - static label SammTrim2Rot9[10] = {9, 2, 3, 0, 10, 8, 6, 7, 4, 11}; - static label SammTrim2Rot10[10] = {9, 3, 0, 1, 10, 8, 7, 4, 5, 11}; - static label SammTrim2Rot11[10] = {9, 0, 1, 2, 10, 8, 4, 5, 6, 11}; - - sammAddressingTable[3] = SammTrim2Rot0; - sammAddressingTable[12] = SammTrim2Rot1; - sammAddressingTable[192] = SammTrim2Rot2; - sammAddressingTable[48] = SammTrim2Rot3; - sammAddressingTable[9] = SammTrim2Rot4; - sammAddressingTable[144] = SammTrim2Rot5; - sammAddressingTable[96] = SammTrim2Rot6; - sammAddressingTable[6] = SammTrim2Rot7; - sammAddressingTable[17] = SammTrim2Rot8; - sammAddressingTable[34] = SammTrim2Rot9; - sammAddressingTable[68] = SammTrim2Rot10; - sammAddressingTable[136] = SammTrim2Rot11; - - - // SAMM trim type 3: 24 models - static label SammTrim3Rot0[10] = {5, 4, 7, 6, 11, 10, 9, 3, 8, 12}; - static label SammTrim3Rot1[10] = {6, 5, 4, 7, 11, 10, 9, 0, 8, 12}; - static label SammTrim3Rot2[10] = {7, 6, 5, 4, 11, 10, 9, 1, 8, 12}; - static label SammTrim3Rot3[10] = {4, 7, 6, 5, 11, 10, 9, 2, 8, 12}; - static label SammTrim3Rot4[10] = {1, 2, 3, 0, 11, 10, 9, 7, 8, 12}; - static label SammTrim3Rot5[10] = {2, 3, 0, 1, 11, 10, 9, 4, 8, 12}; - static label SammTrim3Rot6[10] = {3, 0, 1, 2, 11, 10, 9, 5, 8, 12}; - static label SammTrim3Rot7[10] = {0, 1, 2, 3, 11, 10, 9, 6, 8, 12}; - static label SammTrim3Rot8[10] = {0, 3, 7, 4, 11, 10, 9, 6, 8, 12}; - static label SammTrim3Rot9[10] = {3, 7, 4, 0, 11, 10, 9, 5, 8, 12}; - static label SammTrim3Rot10[10] = {7, 4, 0, 3, 11, 10, 9, 1, 8, 12}; - static label SammTrim3Rot11[10] = {4, 0, 3, 7, 11, 10, 9, 2, 8, 12}; - static label SammTrim3Rot12[10] = {1, 5, 6, 2, 11, 10, 9, 7, 8, 12}; - static label SammTrim3Rot13[10] = {2, 1, 5, 6, 11, 10, 9, 4, 8, 12}; - static label SammTrim3Rot14[10] = {6, 2, 1, 5, 11, 10, 9, 0, 8, 12}; - static label SammTrim3Rot15[10] = {5, 6, 1, 2, 11, 10, 9, 3, 8, 12}; - static label SammTrim3Rot16[10] = {7, 3, 2, 6, 11, 10, 9, 1, 8, 12}; - static label SammTrim3Rot17[10] = {6, 7, 3, 2, 11, 10, 9, 0, 8, 12}; - static label SammTrim3Rot18[10] = {2, 6, 7, 3, 11, 10, 9, 4, 8, 12}; - static label SammTrim3Rot19[10] = {3, 2, 6, 7, 11, 10, 9, 5, 8, 12}; - static label SammTrim3Rot20[10] = {4, 5, 1, 0, 11, 10, 9, 2, 8, 12}; - static label SammTrim3Rot21[10] = {5, 1, 0, 4, 11, 10, 9, 3, 8, 12}; - static label SammTrim3Rot22[10] = {1, 0, 4, 5, 11, 10, 9, 7, 8, 12}; - static label SammTrim3Rot23[10] = {0, 4, 5, 1, 11, 10, 9, 6, 8, 12}; - - sammAddressingTable[7] = SammTrim3Rot0; - sammAddressingTable[14] = SammTrim3Rot1; - sammAddressingTable[13] = SammTrim3Rot2; - sammAddressingTable[11] = SammTrim3Rot3; - sammAddressingTable[112] = SammTrim3Rot4; - sammAddressingTable[224] = SammTrim3Rot5; - sammAddressingTable[208] = SammTrim3Rot6; - sammAddressingTable[176] = SammTrim3Rot7; - sammAddressingTable[38] = SammTrim3Rot8; - sammAddressingTable[70] = SammTrim3Rot9; - sammAddressingTable[100] = SammTrim3Rot10; - sammAddressingTable[98] = SammTrim3Rot11; - sammAddressingTable[25] = SammTrim3Rot12; - sammAddressingTable[137] = SammTrim3Rot13; - sammAddressingTable[152] = SammTrim3Rot14; - sammAddressingTable[145] = SammTrim3Rot15; - sammAddressingTable[49] = SammTrim3Rot16; - sammAddressingTable[50] = SammTrim3Rot17; - sammAddressingTable[35] = SammTrim3Rot18; - sammAddressingTable[19] = SammTrim3Rot19; - sammAddressingTable[200] = SammTrim3Rot20; - sammAddressingTable[196] = SammTrim3Rot21; - sammAddressingTable[76] = SammTrim3Rot22; - sammAddressingTable[140] = SammTrim3Rot23; - - - // SAMM trim type 4: 8 models - static label SammTrim4Rot0[10] = {6, 7, 2, 5, 13, 12 ,11, 10, 9, 8}; - static label SammTrim4Rot1[10] = {7, 4, 3, 6, 13, 12 ,11, 10, 9, 8}; - static label SammTrim4Rot2[10] = {4, 5, 6, 7, 13, 12 ,11, 10, 9, 8}; - static label SammTrim4Rot3[10] = {5, 6, 1, 4, 13, 12 ,11, 10, 9, 8}; - static label SammTrim4Rot4[10] = {2, 1, 6, 3, 13, 12 ,11, 10, 9, 8}; - static label SammTrim4Rot5[10] = {3, 2, 7, 0, 13, 12 ,11, 10, 9, 8}; - static label SammTrim4Rot6[10] = {0, 3, 4, 1, 13, 12 ,11, 10, 9, 8}; - static label SammTrim4Rot7[10] = {1, 0, 5, 2, 13, 12 ,11, 10, 9, 8}; - - sammAddressingTable[27] = SammTrim4Rot0; - sammAddressingTable[39] = SammTrim4Rot1; - sammAddressingTable[78] = SammTrim4Rot2; - sammAddressingTable[141] = SammTrim4Rot3; - sammAddressingTable[177] = SammTrim4Rot4; - sammAddressingTable[114] = SammTrim4Rot5; - sammAddressingTable[228] = SammTrim4Rot6; - sammAddressingTable[216] = SammTrim4Rot7; - - - // SAMM trim type 5: 24 models - static label SammTrim5Rot0[8] = {12, 0, 1, 2, 8, 11, 10, 9}; - static label SammTrim5Rot1[8] = {12, 1, 2, 3, 8, 11, 10, 9}; - static label SammTrim5Rot2[8] = {12, 2, 3, 0, 8, 11, 10, 9}; - static label SammTrim5Rot3[8] = {12, 3, 0, 1, 8, 11, 10, 9}; - static label SammTrim5Rot4[8] = {12, 6, 5, 4, 8, 11, 10, 9}; - static label SammTrim5Rot5[8] = {12, 7, 6, 5, 8, 11, 10, 9}; - static label SammTrim5Rot6[8] = {12, 4, 7, 6, 8, 11, 10, 9}; - static label SammTrim5Rot7[8] = {12, 5, 4, 7, 8, 11, 10, 9}; - static label SammTrim5Rot8[8] = {12, 2, 1, 5, 8, 11, 10, 9}; - static label SammTrim5Rot9[8] = {12, 6, 2, 1, 8, 11, 10, 9}; - static label SammTrim5Rot10[8] = {12, 5, 6, 2, 8, 11, 10, 9}; - static label SammTrim5Rot11[8] = {12, 1, 5, 6, 8, 11, 10, 9}; - static label SammTrim5Rot12[8] = {12, 4, 0, 3, 8, 11, 10, 9}; - static label SammTrim5Rot13[8] = {12, 0, 3, 7, 8, 11, 10, 9}; - static label SammTrim5Rot14[8] = {12, 3, 7, 4, 8, 11, 10, 9}; - static label SammTrim5Rot15[8] = {12, 7, 4, 0, 8, 11, 10, 9}; - static label SammTrim5Rot16[8] = {12, 0, 4, 5, 8, 11, 10, 9}; - static label SammTrim5Rot17[8] = {12, 4, 5, 1, 8, 11, 10, 9}; - static label SammTrim5Rot18[8] = {12, 5, 1, 0, 8, 11, 10, 9}; - static label SammTrim5Rot19[8] = {12, 1, 0, 4, 8, 11, 10, 9}; - static label SammTrim5Rot20[8] = {12, 6, 7, 3, 8, 11, 10, 9}; - static label SammTrim5Rot21[8] = {12, 2, 6, 7, 8, 11, 10, 9}; - static label SammTrim5Rot22[8] = {12, 3, 2, 6, 8, 11, 10, 9}; - static label SammTrim5Rot23[8] = {12, 7, 3, 2, 8, 11, 10, 9}; - - sammAddressingTable[248] = SammTrim5Rot0; - sammAddressingTable[241] = SammTrim5Rot1; - sammAddressingTable[242] = SammTrim5Rot2; - sammAddressingTable[244] = SammTrim5Rot3; - sammAddressingTable[143] = SammTrim5Rot4; - sammAddressingTable[31] = SammTrim5Rot5; - sammAddressingTable[47] = SammTrim5Rot6; - sammAddressingTable[79] = SammTrim5Rot7; - sammAddressingTable[217] = SammTrim5Rot8; - sammAddressingTable[185] = SammTrim5Rot9; - sammAddressingTable[155] = SammTrim5Rot10; - sammAddressingTable[157] = SammTrim5Rot11; - sammAddressingTable[230] = SammTrim5Rot12; - sammAddressingTable[118] = SammTrim5Rot13; - sammAddressingTable[103] = SammTrim5Rot14; - sammAddressingTable[110] = SammTrim5Rot15; - sammAddressingTable[206] = SammTrim5Rot16; - sammAddressingTable[205] = SammTrim5Rot17; - sammAddressingTable[220] = SammTrim5Rot18; - sammAddressingTable[236] = SammTrim5Rot19; - sammAddressingTable[55] = SammTrim5Rot20; - sammAddressingTable[59] = SammTrim5Rot21; - sammAddressingTable[179] = SammTrim5Rot22; - sammAddressingTable[115] = SammTrim5Rot23; - - - // SAMM trim type 8: 1 model - static label SammTrim8[12] = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; - - sammAddressingTable[255] = SammTrim8; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/fillSammCellShapeTable.C b/applications/utilities/mesh/conversion/sammToFoam/fillSammCellShapeTable.C deleted file mode 100644 index 551d9aa745..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/fillSammCellShapeTable.C +++ /dev/null @@ -1,131 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - SAMM cell shape lookup table - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::sammMesh::fillSammCellShapeTable() -{ - // Fill the list by hand - - // SAMM trim type 1: 8 models - sammShapeLookup[1] = sammTrim1Ptr_; - sammShapeLookup[2] = sammTrim1Ptr_; - sammShapeLookup[4] = sammTrim1Ptr_; - sammShapeLookup[8] = sammTrim1Ptr_; - sammShapeLookup[16] = sammTrim1Ptr_; - sammShapeLookup[32] = sammTrim1Ptr_; - sammShapeLookup[64] = sammTrim1Ptr_; - sammShapeLookup[128] = sammTrim1Ptr_; - - //SAMM trim type 2: 12 models - sammShapeLookup[3] = sammTrim2Ptr_; - sammShapeLookup[12] = sammTrim2Ptr_; - sammShapeLookup[192] = sammTrim2Ptr_; - sammShapeLookup[48] = sammTrim2Ptr_; - sammShapeLookup[9] = sammTrim2Ptr_; - sammShapeLookup[144] = sammTrim2Ptr_; - sammShapeLookup[96] = sammTrim2Ptr_; - sammShapeLookup[6] = sammTrim2Ptr_; - sammShapeLookup[17] = sammTrim2Ptr_; - sammShapeLookup[34] = sammTrim2Ptr_; - sammShapeLookup[68] = sammTrim2Ptr_; - sammShapeLookup[136] = sammTrim2Ptr_; - - // SAMM trim type 3: 24 models - sammShapeLookup[7] = sammTrim3Ptr_; - sammShapeLookup[14] = sammTrim3Ptr_; - sammShapeLookup[13] = sammTrim3Ptr_; - sammShapeLookup[11] = sammTrim3Ptr_; - sammShapeLookup[112] = sammTrim3Ptr_; - sammShapeLookup[224] = sammTrim3Ptr_; - sammShapeLookup[208] = sammTrim3Ptr_; - sammShapeLookup[176] = sammTrim3Ptr_; - sammShapeLookup[38] = sammTrim3Ptr_; - sammShapeLookup[70] = sammTrim3Ptr_; - sammShapeLookup[100] = sammTrim3Ptr_; - sammShapeLookup[98] = sammTrim3Ptr_; - sammShapeLookup[25] = sammTrim3Ptr_; - sammShapeLookup[137] = sammTrim3Ptr_; - sammShapeLookup[152] = sammTrim3Ptr_; - sammShapeLookup[145] = sammTrim3Ptr_; - sammShapeLookup[49] = sammTrim3Ptr_; - sammShapeLookup[50] = sammTrim3Ptr_; - sammShapeLookup[35] = sammTrim3Ptr_; - sammShapeLookup[19] = sammTrim3Ptr_; - sammShapeLookup[200] = sammTrim3Ptr_; - sammShapeLookup[196] = sammTrim3Ptr_; - sammShapeLookup[76] = sammTrim3Ptr_; - sammShapeLookup[140] = sammTrim3Ptr_; - - // SAMM trim type 4: 8 models - sammShapeLookup[27] = sammTrim4Ptr_; - sammShapeLookup[39] = sammTrim4Ptr_; - sammShapeLookup[78] = sammTrim4Ptr_; - sammShapeLookup[141] = sammTrim4Ptr_; - sammShapeLookup[177] = sammTrim4Ptr_; - sammShapeLookup[114] = sammTrim4Ptr_; - sammShapeLookup[228] = sammTrim4Ptr_; - sammShapeLookup[216] = sammTrim4Ptr_; - - // SAMM trim type 5: 24 models - sammShapeLookup[248] = sammTrim5Ptr_; - sammShapeLookup[241] = sammTrim5Ptr_; - sammShapeLookup[242] = sammTrim5Ptr_; - sammShapeLookup[244] = sammTrim5Ptr_; - sammShapeLookup[143] = sammTrim5Ptr_; - sammShapeLookup[31] = sammTrim5Ptr_; - sammShapeLookup[47] = sammTrim5Ptr_; - sammShapeLookup[79] = sammTrim5Ptr_; - sammShapeLookup[217] = sammTrim5Ptr_; - sammShapeLookup[185] = sammTrim5Ptr_; - sammShapeLookup[155] = sammTrim5Ptr_; - sammShapeLookup[157] = sammTrim5Ptr_; - sammShapeLookup[230] = sammTrim5Ptr_; - sammShapeLookup[118] = sammTrim5Ptr_; - sammShapeLookup[103] = sammTrim5Ptr_; - sammShapeLookup[110] = sammTrim5Ptr_; - sammShapeLookup[206] = sammTrim5Ptr_; - sammShapeLookup[205] = sammTrim5Ptr_; - sammShapeLookup[220] = sammTrim5Ptr_; - sammShapeLookup[236] = sammTrim5Ptr_; - sammShapeLookup[55] = sammTrim5Ptr_; - sammShapeLookup[59] = sammTrim5Ptr_; - sammShapeLookup[179] = sammTrim5Ptr_; - sammShapeLookup[115] = sammTrim5Ptr_; - - // SAMM hexagonal prism (trim type 8): 1 model - sammShapeLookup[255] = sammTrim8Ptr_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/fixCollapsedEdges.C b/applications/utilities/mesh/conversion/sammToFoam/fixCollapsedEdges.C deleted file mode 100644 index 8cebcb2728..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/fixCollapsedEdges.C +++ /dev/null @@ -1,149 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::fixCollapsedEdges() -{ - cellFaces_.setSize(cellShapes_.size()); - - forAll(cellShapes_, celli) - { - cellFaces_[celli] = cellShapes_[celli].faces(); - } - - // go through the faces and find if there exist faces with duplicate - // vertices. If so, purge the duplicates and mark the mesh as a polyMesh - - forAll(cellFaces_, celli) - { - faceList& curFaces = cellFaces_[celli]; - - forAll(curFaces, facei) - { - face& vertexLabels = curFaces[facei]; - - bool duplicatesFound = false; - - forAll(vertexLabels, vI) - { - label curLabel = vertexLabels[vI]; - - label nFound = 0; - - forAll(vertexLabels, searchI) - { - if (vertexLabels[searchI] == curLabel) - { - nFound++; - } - } - - if (nFound > 1) - { - duplicatesFound = true; - - break; - } - } - - if (duplicatesFound) - { - // this mesh cannot be described as a shapeMesh - isShapeMesh_ = false; - - // I am not allowed to reset the shape pointer to unknown - // here as the shape is still needed to determine which face - // of the shape is used in potential couple matches. This - // will be done in the end using the purgeShapes() - // - - // create a new face without duplicates and replace original - face newFace(vertexLabels.size()); - - label nNewVertices = 0; - - forAll(vertexLabels, vI) - { - // In order for a face to be a valid entity, duplicate - // vertices can only be consecutive (othervise, the - // collapse creates an invalid face). We shall use this - // property in the creation of the collapsed face - - label curLabel = vertexLabels[vI]; - - bool found = false; - - // search through all vertices from the new face. If the - // current label has not been added, add it to the end. - for (label searchI = 0; searchI < nNewVertices; searchI++) - { - if (newFace[searchI] == curLabel) - { - found = true; - - break; - } - } - - if (!found) - { - newFace[nNewVertices] = curLabel; - nNewVertices++; - } - } - - newFace.setSize(nNewVertices); - - // If the number of non-duplicate labels in the face is less - // than three, the face has been collapsed in an invalid - // manner. Error. - - if (nNewVertices < 3) - { - FatalErrorInFunction - << "face " << facei << " of cell " << celli - << " is colapsed down to a point or edge, which is " - << "not permitted" << endl - << "original face: " << vertexLabels << endl - << "purged face: " << newFace << endl - << abort(FatalError); - } - else - { - vertexLabels = newFace; - } - } - } - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/purgeCellShapes.C b/applications/utilities/mesh/conversion/sammToFoam/purgeCellShapes.C deleted file mode 100644 index 83b01bf72d..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/purgeCellShapes.C +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Purge cell shapes which have been rendered invalid by cell face collapse - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::sammMesh::purgeCellShapes() -{ - forAll(cellFaces_, celli) - { - const faceList& curFaces = cellFaces_[celli]; - - // Get model faces - faceList shapeFaces = cellShapes_[celli].faces(); - - forAll(shapeFaces, facei) - { - bool found = false; - - forAll(curFaces, i) - { - if (shapeFaces[facei] == curFaces[i]) - { - found = true; - break; - } - } - - if (!found) - { - Info<< "Purging cell shape " << celli << endl; - cellShapes_[celli] = cellShape(*unknownPtr_, labelList(0)); - break; - } - } - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/readBoundary.C b/applications/utilities/mesh/conversion/sammToFoam/readBoundary.C deleted file mode 100644 index 8502c312ae..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/readBoundary.C +++ /dev/null @@ -1,258 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" -#include "Time.H" -#include "wallPolyPatch.H" -#include "oldCyclicPolyPatch.H" -#include "symmetryPolyPatch.H" -#include "preservePatchTypes.H" -#include "IFstream.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::readBoundary() -{ - label nPatches=0, nFaces=0; - labelList nPatchFaces(1000); - - label lineIndex, sammLabel; - label sammRegion, configNumber; - - labelList pointLabels(4); - labelList pointLabelsTri(3); - - labelList patchLabels(1000, label(-1)); - - word patchType; - patchTypes_.setSize(1000); - patchNames_.setSize(1000); - - fileName boundaryFileName(casePrefix_ + ".bnd"); - - { - IFstream boundaryFile(boundaryFileName); - - // Collect no. of faces (nFaces), - // no. of patches (nPatches) - // and for each of these patches the number of faces - // (nPatchFaces[patchLabel]) - // and a conversion table from Samm regions to (Foam) patchLabels - - if (boundaryFile.good()) - { - forAll(nPatchFaces, faceLabel) - { - nPatchFaces[faceLabel] = 0; - } - - while ((boundaryFile >> lineIndex).good()) - { - nFaces++; - - // Skip point numbers - for (int i=0; i<4; i++) - { - boundaryFile >> sammLabel; - } - - boundaryFile >> sammRegion; - boundaryFile >> configNumber; - boundaryFile >> patchType; - - // Build translation table to convert samm patch to foam patch - label patchLabel = patchLabels[sammRegion]; - if (patchLabel == -1) - { - patchLabel = nPatches; - patchLabels[sammRegion] = patchLabel; - patchTypes_[patchLabel] = patchType; - patchNames_[patchLabel] = patchType + name(sammRegion); - - nPatches++; - - Info<< "Samm region " << sammRegion - << " with type " << patchType - << " is now Foam patch " << patchLabel << endl; - - } - - nPatchFaces[patchLabel]++; - } - - - Info<< nl - << "Setting size of shapePatchList to " << nPatches - << nl << endl; - - nPatchFaces.setSize(nPatches); - patchTypes_.setSize(nPatches); - patchNames_.setSize(nPatches); - } - else - { - FatalErrorInFunction - << "Cannot read file " - << boundaryFileName - << abort(FatalError); - } - } - - if (nPatches > 0) - { - boundary_.setSize(nPatchFaces.size()); - patchTypes_.setSize(nPatchFaces.size()); - patchNames_.setSize(nPatchFaces.size()); - - // size the lists and reset the counters to be used again - forAll(boundary_, patchLabel) - { - boundary_[patchLabel].setSize(nPatchFaces[patchLabel]); - - nPatchFaces[patchLabel] = 0; - } - - IFstream boundaryFile(boundaryFileName); - - for (label facei=0; facei> lineIndex; - - for (int i = 0; i < 4; i++) - { - boundaryFile >> sammLabel; - - // convert Samm label to Foam point label - // through lookup-list starPointLabelLookup_ - pointLabels[i] = starPointLabelLookup_[sammLabel]; - - if (pointLabels[i] < 0) - { - Info<< "Boundary file not consistent with vertex file\n" - << "Samm vertex number " << sammLabel - << " does not exist\n"; - } - - } - - boundaryFile >> sammRegion; - label patchLabel = patchLabels[sammRegion]; - - boundaryFile >> configNumber; - boundaryFile >> patchType; - - if // Triangle - ( - pointLabels[2] == pointLabels[3] - ) - { - //Info<< "Converting collapsed quad into triangle" - // << " for face " << facei - // << " in Samm boundary " << lineIndex << endl; - - pointLabelsTri[0] = pointLabels[0]; - pointLabelsTri[1] = pointLabels[1]; - pointLabelsTri[2] = pointLabels[2]; - - boundary_[patchLabel][nPatchFaces[patchLabel]] - = face(pointLabelsTri); - } - else - { - boundary_[patchLabel][nPatchFaces[patchLabel]] - = face(pointLabels); - } - - // increment counter of faces in current patch - nPatchFaces[patchLabel]++; - } - - forAll(boundary_, patchLabel) - { - word patchType = patchTypes_[patchLabel]; - - if (patchType == "SYMP") - { - patchTypes_[patchLabel] = symmetryPolyPatch::typeName; - } - else if (patchType == "WALL") - { - patchTypes_[patchLabel] = wallPolyPatch::typeName; - } - else if (patchType == "CYCL") - { - // incorrect. should be cyclicPatch but this - // requires info on connected faces. - patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName; - } - else - { - patchTypes_[patchLabel] = polyPatch::typeName; - } - - Info<< "Foam patch " << patchLabel - << " is of type " << patchTypes_[patchLabel] - << " with name " << patchNames_[patchLabel] << endl; - } - } - else - { - FatalErrorInFunction - << "No boundary faces in file " - << boundaryFileName - << endl; - } - - patchPhysicalTypes_.setSize(patchTypes_.size()); - - PtrList patchDicts; - - preservePatchTypes - ( - runTime_, - runTime_.constant(), - polyMesh::meshSubDir, - patchNames_, - patchDicts, - defaultFacesName_, - defaultFacesType_ - ); - - forAll(patchDicts, patchi) - { - if (patchDicts.set(patchi)) - { - const dictionary& dict = patchDicts[patchi]; - dict.readIfPresent("type", patchTypes_[patchi]); - dict.readIfPresent("physicalType", patchPhysicalTypes_[patchi]); - } - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/readCells.C b/applications/utilities/mesh/conversion/sammToFoam/readCells.C deleted file mode 100644 index 355596b711..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/readCells.C +++ /dev/null @@ -1,319 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" -#include "IFstream.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::addRegularCell -( - const labelList& labels, - const label nCreatedCells -) -{ - // Momory management - static labelList labelsHex(8); - static labelList labelsWedge(7); - static labelList labelsPrism(6); - static labelList labelsPyramid(5); - static labelList labelsTet(4); - static labelList labelsTetWedge(5); - - if // Tetrahedron - ( - labels[2] == labels[3] - && labels[4] == labels[5] - && labels[5] == labels[6] - && labels[6] == labels[7] - ) - { - labelsTet[0] = labels[0]; - labelsTet[1] = labels[1]; - labelsTet[2] = labels[2]; - labelsTet[3] = labels[4]; - cellShapes_[nCreatedCells] = cellShape(*tetPtr_, labelsTet); - } - - else if // Square-based pyramid - ( - labels[4] == labels[5] - && labels[5] == labels[6] - && labels[6] == labels[7] - ) - { - labelsPyramid[0] = labels[0]; - labelsPyramid[1] = labels[1]; - labelsPyramid[2] = labels[2]; - labelsPyramid[3] = labels[3]; - labelsPyramid[4] = labels[4]; - cellShapes_[nCreatedCells] = cellShape(*pyrPtr_, labelsPyramid); - } - - else if // Tet Wedge - ( - labels[2] == labels[3] - && labels[4] == labels[5] - && labels[6] == labels[7] - ) - { - labelsTetWedge[0] = labels[0]; - labelsTetWedge[1] = labels[1]; - labelsTetWedge[2] = labels[2]; - labelsTetWedge[3] = labels[4]; - labelsTetWedge[4] = labels[6]; - cellShapes_[nCreatedCells] = cellShape(*tetWedgePtr_, labelsTetWedge); - } - - else if // Triangular prism - ( - labels[2] == labels[3] - && labels[6] == labels[7] - ) - { - labelsPrism[0] = labels[0]; - labelsPrism[1] = labels[1]; - labelsPrism[2] = labels[2]; - labelsPrism[3] = labels[4]; - labelsPrism[4] = labels[5]; - labelsPrism[5] = labels[6]; - cellShapes_[nCreatedCells] = cellShape(*prismPtr_, labelsPrism); - } - - else if // Wedge - ( - labels[4] == labels[7] - ) - { - labelsWedge[0] = labels[7]; - labelsWedge[1] = labels[6]; - labelsWedge[2] = labels[5]; - labelsWedge[3] = labels[3]; - labelsWedge[4] = labels[2]; - labelsWedge[5] = labels[1]; - labelsWedge[6] = labels[0]; - cellShapes_[nCreatedCells] = cellShape(*wedgePtr_, labelsWedge); - } - - else // Hex - { - labelsHex[0] = labels[0]; - labelsHex[1] = labels[1]; - labelsHex[2] = labels[2]; - labelsHex[3] = labels[3]; - labelsHex[4] = labels[4]; - labelsHex[5] = labels[5]; - labelsHex[6] = labels[6]; - labelsHex[7] = labels[7]; - cellShapes_[nCreatedCells] = cellShape(*hexPtr_, labelsHex); - } -} - - -void Foam::sammMesh::addSAMMcell -( - const label typeFlag, - const labelList& globalLabels, - const label nCreatedCells -) -{ - - // grab the shape from the table - if (!sammShapeLookup[typeFlag] || !sammAddressingTable[typeFlag]) - { - FatalErrorInFunction - << "SAMM type " << typeFlag << " has no registered label. BUG!" - << abort(FatalError); - } - - const cellModel& curModel = *(sammShapeLookup[typeFlag]); - - // get reference to the addressing list - const label* addressing = sammAddressingTable[typeFlag]; - - // make a list of labels - labelList sammCellLabels(curModel.nPoints(), -1); - - forAll(sammCellLabels, labelI) - { - sammCellLabels[labelI] = globalLabels[addressing[labelI]]; - } - - cellShapes_[nCreatedCells] = cellShape(curModel, sammCellLabels); -} - - -void Foam::sammMesh::readCells() -{ - label nCells = 0; - label maxLabel = -1; - - fileName cellsFileName(casePrefix_ + ".cel"); - - { - IFstream cellsFile(cellsFileName); - - if (cellsFile.good()) - { - label lineLabel, cellLabel = -1, pointLabel, regionLabel, typeFlag; - - maxLabel = -1; - while (!(cellsFile >> lineLabel).eof()) - { - maxLabel = max(maxLabel, lineLabel); - for (int i=0; i<8; i++) - { - cellsFile >> pointLabel; - } - - cellsFile >> regionLabel; - cellsFile >> typeFlag; - - if (lineLabel != cellLabel) - { - cellLabel = lineLabel; - nCells++; - } - } - } - else - { - FatalErrorInFunction - << "Cannot read file " - << cellsFileName - << abort(FatalError); - } - } - - Info<< "Number of cells = " << nCells << endl << endl; - - cellShapes_.setSize(nCells); - - starCellLabelLookup_.setSize(maxLabel+1); - - // reset point labels to invalid value - forAll(starCellLabelLookup_, i) - { - starCellLabelLookup_[i] = -1; - } - - - if (nCells > 0) - { - IFstream cellsFile(cellsFileName); - - labelList labels(24, label(-1)); - label lineLabel, sammLabel, regionLabel, typeFlag; - - for (label celli = 0; celli < nCells; celli++) - { - label nLabels = 0; - - bool addOnToCell = false; - - do - { - if (nLabels > 24) - { - FatalErrorInFunction - << "Unknown SAMM cell. " - << "More than 24 vertices" - << abort(FatalError); - } - - if ((cellsFile >> lineLabel).eof()) - { - FatalErrorInFunction - << "Reached end of cells file before " - << "all cells are read in." - << abort(FatalError); - } - - // prepare for possible continuation - nLabels += 8; - - for (int i=nLabels-8; i> sammLabel; - - if (sammLabel != 0) - { - // Convert Samm vertex number to point label - labels[i] = starPointLabelLookup_[sammLabel]; - - if (labels[i] < 0) - { - Info<< "Cell file not consistent with vertex file. " - << "Samm vertex number " << sammLabel - << " does not exist\n"; - } - } - else - { - labels[i] = -1; - } - } - - cellsFile >> regionLabel; - cellsFile >> typeFlag; - - // check for continuation line - if (!addOnToCell && typeFlag == 255) - { - addOnToCell = true; - } - else - { - addOnToCell = false; - } - - } while (typeFlag == -1 || addOnToCell); - - starCellLabelLookup_[lineLabel] = celli; - - if (nLabels == 8) - { - addRegularCell(labels, celli); - } - else - { - addSAMMcell(typeFlag, labels, celli); - } - } - } - else - { - FatalErrorInFunction - << "No cells in file " - << cellsFileName - << abort(FatalError); - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/readCouples.C b/applications/utilities/mesh/conversion/sammToFoam/readCouples.C deleted file mode 100644 index 542aa7be31..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/readCouples.C +++ /dev/null @@ -1,177 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" -#include "IFstream.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::readCouples() -{ - fileName couplesFileName(casePrefix_ + ".cpl"); - - IFstream couplesFile(couplesFileName); - - if (couplesFile.good()) - { - Info<< "\nReading couples" << endl; - - // A mesh with couples cannot be a shape mesh - isShapeMesh_ = false; - - label matchLabel, nEntries, typeFlag; - label masterCell, masterFace; - label slaveCell, slaveFace; - - while (!(couplesFile >> matchLabel).eof()) - { - // read number of entries and match type. - // Note. At the moment, only integral matches are supported - couplesFile >> nEntries; - - couplesFile >> typeFlag; - - if (typeFlag > 1) - { - Info - << "void sammMesh::readCouples() : " - << "couple " << matchLabel << " is not an integral match. " - << "Currently not supported" << endl; - } - - // read master cell and face - couplesFile >> masterCell >> masterFace; - - // get reference to master cell faces - faceList& masterFaces = cellFaces_[masterCell - 1]; - -// Info<< "Master cell: " << masterCell - 1 << " index: " -// << cellShapes_[masterCell - 1].model().index() -// << " face: " << -// masterFaces -// [ -// shapeFaceLookup -// [cellShapes_[masterCell - 1].model().index()] -// [masterFace] -// ] -// << endl; - - // reset master face to zero size. It cannot be removed at this - // stage because thisw would mess up the numbering in case of - // more than one couple an a single master cell - masterFaces - [ - shapeFaceLookup - [cellShapes_[masterCell - 1].model().index()] - [masterFace] - ].setSize(0); - - // number of slave faces - label nSlavesToRead = nEntries - 1; - - // get index for slave face add - label slaveToAdd = masterFaces.size(); - - // reset size of master faces to accept new (couple) faces - masterFaces.setSize(masterFaces.size() + nSlavesToRead); - - for (int i = 0; i < nSlavesToRead; i++) - { - couplesFile >> slaveCell >> slaveFace; - - masterFaces[slaveToAdd] = - cellFaces_ - [ - slaveCell - 1 - ] - [ - shapeFaceLookup - [cellShapes_[slaveCell - 1].model().index()] - [slaveFace] - ].reverseFace(); - -// Info<< " slave cell: " << slaveCell - 1 << " index: " -// << cellShapes_[slaveCell - 1].model().index() -// << " face: " << masterFaces[slaveToAdd] << endl; - - slaveToAdd++; - - } -// Info<< endl; - - } - - // Once all couples are read, remove zero size faces from all cells - forAll(cellFaces_, celli) - { - faceList& curFaces = cellFaces_[celli]; - - label zeroSizeFound = 0; - - forAll(curFaces, facei) - { - if (curFaces[facei].empty()) - { - zeroSizeFound++; - } - } - - if (zeroSizeFound > 0) - { - // compress the list. A copy needs to made first - faceList oldFaces = curFaces; - - curFaces.setSize(curFaces.size() - zeroSizeFound); - - label nFaces = 0; - - forAll(oldFaces, facei) - { - if (oldFaces[facei].size()) - { - curFaces[nFaces] = oldFaces[facei]; - - nFaces++; - } - } - } - } - } - else - { - Info - << "void sammMesh::readCouples() : " - << "Cannot read file " - << couplesFileName - << ". No matches defined." - << endl; - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/readPoints.C b/applications/utilities/mesh/conversion/sammToFoam/readPoints.C deleted file mode 100644 index 94bec96ce1..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/readPoints.C +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh from SAMM files - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define starMesh sammMesh -#include "../star3ToFoam/readPoints.C" - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammMesh.C b/applications/utilities/mesh/conversion/sammToFoam/sammMesh.C deleted file mode 100644 index 5b62de154a..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/sammMesh.C +++ /dev/null @@ -1,220 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" -#include "emptyPolyPatch.H" -#include "demandDrivenData.H" -#include "cellModeller.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -// Cell shape models -const Foam::cellModel* Foam::sammMesh::unknownPtr_ = - Foam::cellModeller::lookup("unknown"); -const Foam::cellModel* Foam::sammMesh::hexPtr_ = - Foam::cellModeller::lookup("hex"); -const Foam::cellModel* Foam::sammMesh::wedgePtr_ = - Foam::cellModeller::lookup("wedge"); -const Foam::cellModel* Foam::sammMesh::prismPtr_ = - Foam::cellModeller::lookup("prism"); -const Foam::cellModel* Foam::sammMesh::pyrPtr_ = - Foam::cellModeller::lookup("pyr"); -const Foam::cellModel* Foam::sammMesh::tetPtr_ = - Foam::cellModeller::lookup("tet"); -const Foam::cellModel* Foam::sammMesh::tetWedgePtr_ = - Foam::cellModeller::lookup("tetWedge"); - -const Foam::cellModel* Foam::sammMesh::sammTrim1Ptr_ = - Foam::cellModeller::lookup("sammTrim1"); -const Foam::cellModel* Foam::sammMesh::sammTrim2Ptr_ = - Foam::cellModeller::lookup("sammTrim2"); -const Foam::cellModel* Foam::sammMesh::sammTrim3Ptr_ = - Foam::cellModeller::lookup("sammTrim3"); -const Foam::cellModel* Foam::sammMesh::sammTrim4Ptr_ = - Foam::cellModeller::lookup("sammTrim4"); -const Foam::cellModel* Foam::sammMesh::sammTrim5Ptr_ = - Foam::cellModeller::lookup("sammTrim5"); -const Foam::cellModel* Foam::sammMesh::sammTrim8Ptr_ = - Foam::cellModeller::lookup("hexagonalPrism"); - -// lookup table giving OpenFOAM face number when looked up with shape index -// (first index) and STAR face number -// - first column is always -1 -// - last column is -1 for all but hexagonal prism -// WARNING: Possible bug for sammTrim2 -// There is a possibility that the lookup table for SAMM shapes is based on -// the rotation of the shape. This would imply that the table below would need -// to be split between the regular shapes (3-9), which are OK, and the SAMM -// shapes, for which the face lookup needs to be done based on the rotation. -// However, at the moment I haven't got enough info to complete the toble and -// there are no cases that break it. Please reconsider in the light of mode -// information. -const Foam::label Foam::sammMesh::shapeFaceLookup[19][9] = -{ - {-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 0 - empty+ - {-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 1 - empty+ - {-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 2 - empty+ - {-1, 4, 5, 2, 3, 0, 1, -1, -1}, // shape 3 - hex+ - {-1, 4, 5, 2, 3, 0, 1, -1, -1}, // shape 4 - wedge+ - {-1, 0, 1, 4, -1, 2, 3, -1, -1}, // shape 5 - prism+ - {-1, 0, -1, 4, 2, 1, 3, -1, -1}, // shape 6 - pyr+ - {-1, 3, -1, 2, -1, 1, 0, -1, -1}, // shape 7 - tet+ - {-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 8 - splitHex (empty) - {-1, 0, -1, 1, -1, 2, 3, -1, -1}, // shape 9 - tetWedge+ - {-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 10 - empty+ - {-1, 5, 4, 0, 1, 2, 3, 6, -1}, // shape 11 - sammTrim1+ -// {-1, 1, 0, 2, 3, 4, 5, 6, -1}, // shape 12 - sammTrim2 ? - {-1, 1, 0, 2, 4, 3, 5, 6, -1}, // shape 12 - sammTrim2 f(4)=4 - {-1, 5, 4, 0, 1, 2, 3, 6, -1}, // shape 13 - sammTrim3+ - {-1, 5, 4, 1, 0, 3, 2, 6, -1}, // shape 14 - sammTrim4 - {-1, 4, 3, 2, 5, 1, 0, -1, -1}, // shape 15 - sammTrim5 - {-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 16 - empty - {-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 17 - empty - {-1, 0, 1, 2, 5, 3, 6, 4, 7} // shape 18 - sammTrim8 -}; - -// SAMM cell lookup data - -// List of pointers used instead of pointer list o avoid -// de-allocation problems -Foam::List Foam::sammMesh::sammShapeLookup -( - 256, - reinterpret_cast(0) -); - -Foam::List Foam::sammMesh::sammAddressingTable -( - 256, - reinterpret_cast(0) -); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::sammMesh::createPolyMeshData() -{ - Info<< "Creating a polyMesh" << endl; - - createPolyCells(); - - Info<< "\nNumber of internal faces: " - << nInternalFaces_ << endl; - - createPolyBoundary(); - - label nProblemCells = 0; - - // check that there is no zeros in the cellPolys_ - forAll(cellPolys_, celli) - { - const labelList& curFaceLabels = cellPolys_[celli]; - - forAll(curFaceLabels, facei) - { - if (curFaceLabels[facei] == -1) - { - Info<< "cell " << celli - << " has got an unmatched face. " - << "Index: " << cellShapes_[celli].model().index() << endl -// << "cell shape: " << cellShapes_[celli] << endl -// << "shape faces: " << cellShapes_[celli].faces() << endl - << "cellPolys: " << cellPolys_[celli] << endl -// << "cell faces: " << cellFaces_[celli] - << endl; - - nProblemCells++; - - break; - } - } - } - - if (nProblemCells > 0) - { - Info<< "Number of problem cells: " << nProblemCells << endl; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::sammMesh::sammMesh -( - const fileName& prefix, - const Time& rt, - const scalar scaleFactor -) -: - casePrefix_(prefix), - runTime_(rt), - points_(0), - cellShapes_(0), - boundary_(0), - patchTypes_(0), - defaultFacesName_("defaultFaces"), - defaultFacesType_(emptyPolyPatch::typeName), - patchNames_(0), - patchPhysicalTypes_(0), - starPointLabelLookup_(0), - starCellLabelLookup_(0), - cellFaces_(0), - meshFaces_(0), - cellPolys_(0), - nInternalFaces_(0), - polyBoundaryPatchStartIndices_(0), - pointCellsPtr_(nullptr), - isShapeMesh_(true) -{ - // Fill in the lookup tables - fillSammCellShapeTable(); - fillSammAddressingTable(); - - readPoints(scaleFactor); - - readCells(); - - readBoundary(); - - fixCollapsedEdges(); - - readCouples(); - - // create boundary faces - createBoundaryFaces(); - - // after all this is done do couples -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::sammMesh::~sammMesh() -{ - deleteDemandDrivenData(pointCellsPtr_); -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammMesh.H b/applications/utilities/mesh/conversion/sammToFoam/sammMesh.H deleted file mode 100644 index a00ff8d7e9..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/sammMesh.H +++ /dev/null @@ -1,253 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::sammMesh - -Description - A messy mesh class which supports the possibility of creating a shapeMesh - for regular Samm meshes (no arbitrary interfaces or collapsed SAMM cells). - If any of these special feateres exist, the mesh is created as polyMesh - -SourceFiles - sammMesh.C - -\*---------------------------------------------------------------------------*/ - -#ifndef sammMesh_H -#define sammMesh_H - -#include "polyMesh.H" -#include "cellShape.H" -#include "cellList.H" -#include "polyPatchList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class sammMesh Declaration -\*---------------------------------------------------------------------------*/ - -class sammMesh -{ - // Private data - - //- Name of the case - fileName casePrefix_; - - //- Database - const Time& runTime_; - - //- Points supporting the mesh - pointField points_; - - //- Cell shapes - cellShapeList cellShapes_; - - //- Boundary faces - faceListList boundary_; - - //- Boundary patch types - wordList patchTypes_; - - //- Default boundary patch name - word defaultFacesName_; - - //- Default boundary patch types - word defaultFacesType_; - - //- Boundary patch names - wordList patchNames_; - - //- Boundary patch physical types - wordList patchPhysicalTypes_; - - //- Point labels (SAMM point numbering is not necessarily contiguous) - labelList starPointLabelLookup_; - - //- Point labels (SAMM point numbering is not necessarily contiguous) - labelList starCellLabelLookup_; - - //- List of faces for every cell - faceListList cellFaces_; - - //- Global face list for polyMesh - faceList meshFaces_; - - //- Cells as polyhedra for polyMesh - cellList cellPolys_; - - //- Number of internal faces for polyMesh - label nInternalFaces_; - - //- Polyhedral mesh boundary patch start indices - labelList polyBoundaryPatchStartIndices_; - - //- Point-cell addressing. Used for topological analysis - // Warning. This point cell addressing list potentially contains - // duplicate cell entries. Use additional checking - mutable labelListList* pointCellsPtr_; - - //- Can the mesh be treated as a shapeMesh? - bool isShapeMesh_; - - // Private static data members - - //- Pointers to cell models - static const cellModel* unknownPtr_; - static const cellModel* hexPtr_; - static const cellModel* wedgePtr_; - static const cellModel* prismPtr_; - static const cellModel* pyrPtr_; - static const cellModel* tetPtr_; - static const cellModel* tetWedgePtr_; - - static const cellModel* sammTrim1Ptr_; - static const cellModel* sammTrim2Ptr_; - static const cellModel* sammTrim3Ptr_; - static const cellModel* sammTrim4Ptr_; - static const cellModel* sammTrim5Ptr_; - static const cellModel* sammTrim8Ptr_; - - static const label shapeFaceLookup[19][9]; - - - //- SAMM addressing data - static List sammShapeLookup; - static List sammAddressingTable; - - // Private Member Functions - - //- Disallow default bitwise copy construct - sammMesh(const sammMesh&); - - //- Disallow default bitwise assignment - void operator=(const sammMesh&); - - - //- Fill SAMM lookup tables - void fillSammCellShapeTable(); - void fillSammAddressingTable(); - - - //- Read the points file - void readPoints(const scalar scaleFactor); - - - //- Read the cells file - void readCells(); - - void addRegularCell - ( - const labelList& labels, - const label nCreatedCells - ); - - void addSAMMcell - ( - const label typeFlag, - const labelList& globalLabels, - const label nCreatedCells - ); - - - //- Read the boundary file - void readBoundary(); - - - //- Check and correct collapsed edges on faces - // Note. If a collapsed edge is found, the mesh is no longer shapeMesh - void fixCollapsedEdges(); - - //- Read couples - void readCouples(); - - //- Calculate pointCells - void calcPointCells() const; - - const labelListList& pointCells() const; - - //- Create boundary faces from the quads - void createBoundaryFaces(); - - //- Specialist version of face comparison to deal with - // PROSTAR boundary format idiosyncracies - bool sammEqualFace - ( - const face& boundaryFace, - const face& cellFace - ) const; - - //- Purge cell shapes - void purgeCellShapes(); - - //- Make polyhedral cells and global faces if the mesh is polyhedral - void createPolyCells(); - - //- Make polyhedral boundary from shape boundary - // (adds more faces to the face list) - void createPolyBoundary(); - - //- Make polyhedral mesh data (packing) - void createPolyMeshData(); - - //- Add polyhedral boundary - List polyBoundaryPatches(const polyMesh&); - - -public: - - // Constructors - - //- Construct from case name - sammMesh - ( - const fileName& prefix, - const Time& rt, - const scalar scaleFactor - ); - - - //- Destructor - ~sammMesh(); - - - // Member Functions - - //- Write mesh - void writeMesh(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C deleted file mode 100644 index 543b71cba3..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C +++ /dev/null @@ -1,79 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Application - sammToFoam - -Group - grpMeshConversionUtilities - -Description - Converts a Star-CD (v3) SAMM mesh to OpenFOAM format. - -\*---------------------------------------------------------------------------*/ - -#include "argList.H" -#include "Time.H" -#include "sammMesh.H" - -using namespace Foam; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - argList::noParallel(); - argList::validArgs.append("SAMM mesh file prefix"); - argList::addOption - ( - "scale", - "factor", - "geometry scaling factor - default is 1" - ); - - argList args(argc, argv); - - if (!args.check()) - { - FatalError.exit(); - } - - const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0); - - #include "createTime.H" - - sammMesh makeMesh(args[1], runTime, scaleFactor); - - // Set the precision of the points data to 10 - IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); - - Info<< "Writing mesh" << endl; - makeMesh.writeMesh(); - - Info<< "\nEnd\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/sammToFoam/starMesh.H b/applications/utilities/mesh/conversion/sammToFoam/starMesh.H deleted file mode 100644 index 75e1c61b51..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/starMesh.H +++ /dev/null @@ -1 +0,0 @@ -#include "sammMesh.H" diff --git a/applications/utilities/mesh/conversion/sammToFoam/writeMesh.C b/applications/utilities/mesh/conversion/sammToFoam/writeMesh.C deleted file mode 100644 index 0afee5e84a..0000000000 --- a/applications/utilities/mesh/conversion/sammToFoam/writeMesh.C +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from SAMM files - -\*---------------------------------------------------------------------------*/ - -#include "sammMesh.H" -#include "Time.H" -#include "polyMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::sammMesh::writeMesh() -{ - if (isShapeMesh_) - { - Info<< "This is a shapeMesh." << endl; - - polyMesh pShapeMesh - ( - IOobject - ( - polyMesh::defaultRegion, - runTime_.constant(), - runTime_ - ), - xferCopy(points_), // we could probably re-use the data - cellShapes_, - boundary_, - patchNames_, - patchTypes_, - defaultFacesName_, - defaultFacesType_, - patchPhysicalTypes_ - ); - - Info<< "Writing polyMesh" << endl; - pShapeMesh.write(); - } - else - { - // This is a polyMesh. - - createPolyMeshData(); - - Info<< "This is a polyMesh" << endl; - - polyMesh pMesh - ( - IOobject - ( - polyMesh::defaultRegion, - runTime_.constant(), - runTime_ - ), - xferCopy(points_), // we could probably re-use the data - xferCopy(meshFaces_), - xferCopy(cellPolys_) - ); - - pMesh.addPatches(polyBoundaryPatches(pMesh)); - - Info<< "Writing polyMesh" << endl; - pMesh.write(); - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/star3ToFoam/Make/files b/applications/utilities/mesh/conversion/star3ToFoam/Make/files deleted file mode 100644 index c50cf188d6..0000000000 --- a/applications/utilities/mesh/conversion/star3ToFoam/Make/files +++ /dev/null @@ -1,19 +0,0 @@ -coupledFacePair.C -starMesh.C -readPoints.C -/*readSeparatedPoints.C*/ -readCells.C -readBoundary.C -fixCollapsedEdges.C -readCouples.C -createCoupleMatches.C -mergeCoupleFacePoints.C -calcPointCells.C -createPolyCells.C -createBoundaryFaces.C -createPolyBoundary.C -purgeCellShapes.C -writeMesh.C -star3ToFoam.C - -EXE = $(FOAM_APPBIN)/star3ToFoam diff --git a/applications/utilities/mesh/conversion/star3ToFoam/Make/options b/applications/utilities/mesh/conversion/star3ToFoam/Make/options deleted file mode 100644 index 3dbc679a10..0000000000 --- a/applications/utilities/mesh/conversion/star3ToFoam/Make/options +++ /dev/null @@ -1,7 +0,0 @@ -EXE_INC = \ - /* -DDEBUG_MERGE */ \ - /* -DDEBUG_COUPLE */ \ - /* -DDEBUG_COUPLE_INTERSECTION */ \ - /* -DDEBUG_RIGHT_HAND_WALK */ \ - /* -DDEBUG_FACE_ORDERING */ \ - /* -DDEBUG_COUPLE_PROJECTION */ diff --git a/applications/utilities/mesh/conversion/star3ToFoam/calcPointCells.C b/applications/utilities/mesh/conversion/star3ToFoam/calcPointCells.C deleted file mode 100644 index af9c763916..0000000000 --- a/applications/utilities/mesh/conversion/star3ToFoam/calcPointCells.C +++ /dev/null @@ -1,139 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from PROSTAR files - -\*---------------------------------------------------------------------------*/ - -#include "starMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::starMesh::calcPointCells() const -{ - static const label UNIT_POINT_CELLS = 12; - - if (pointCellsPtr_) - { - FatalErrorInFunction - << "pointCells already calculated" - << abort(FatalError); - } - - - pointCellsPtr_ = new labelListList(points_.size()); - - labelListList& pc = *pointCellsPtr_; - - forAll(pc, i) - { - pc[i].setSize(UNIT_POINT_CELLS); - } - - // Initialise the list of labels which will hold the count the - // actual number of cells per point during the analysis - labelList cellCount(points_.size()); - - forAll(cellCount, i) - { - cellCount[i] = 0; - } - - // Note. Unlike the standard point-cell algorithm, which asks the cell for - // the supporting point labels, we need to work based on the cell faces. - // This is because some of the faces for meshes with arbitrary interfaces - // do not come from the cell shape, but from the slaves of the coupled - // match. It is also adventageous to remove the duplicates from the - // point-cell addressing, because this removes a lot of waste later. - // - - // For each cell - forAll(cellShapes_, celli) - { - const faceList& faces = cellFaces_[celli]; - - forAll(faces, i) - { - // For each vertex - const labelList& labels = faces[i]; - - forAll(labels, j) - { - // Set working point label - label curPoint = labels[j]; - labelList& curPointCells = pc[curPoint]; - label curCount = cellCount[curPoint]; - - // check if the cell has been added before - bool found = false; - - for (label f = 0; f < curCount; f++) - { - if (curPointCells[f] == celli) - { - found = true; - - break; - } - } - - if (!found) - { - - // If the list of pointCells is not big enough, double it - if (curPointCells.size() <= curCount) - { - curPointCells.setSize(curPointCells.size()*2); - } - - // Enter the cell label in the point's cell list - curPointCells[curCount] = celli; - - // Increment the cell count for the point addressed - cellCount[curPoint]++; - } - } - } - } - - // Finally, truncate the lists made to their active size - forAll(pc, i) - { - pc[i].setSize(cellCount[i]); - } -} - - -const Foam::labelListList& Foam::starMesh::pointCells() const -{ - if (!pointCellsPtr_) - { - calcPointCells(); - } - - return *pointCellsPtr_; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.C b/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.C deleted file mode 100644 index 73490bd38d..0000000000 --- a/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.C +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Data associated with a pair of coupled faces. - 1 represents integral match; all other number are arbitrary matches - -\*---------------------------------------------------------------------------*/ - -#include "coupledFacePair.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::coupledFacePair::coupledFacePair -( - const label coupleNo, - const label mC, const label mF, - const label sC, const label sF, - const label integral -) -: - coupleID_(coupleNo), - masterCellID_(mC), - masterFaceID_(mF), - slaveCellID_(sC), - slaveFaceID_(sF), - integralMatch_(integral == 1) -{} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const coupledFacePair& c) -{ - os << "Master cell: " << c.masterCellID_ - << " face: " << c.masterFaceID_ << endl - << "Slave cell: " << c.slaveCellID_ - << " face: " << c.slaveFaceID_ << endl - << "Integral: " << c.integralMatch_ << endl; - - return os; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.H b/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.H deleted file mode 100644 index 52597ff7db..0000000000 --- a/applications/utilities/mesh/conversion/star3ToFoam/coupledFacePair.H +++ /dev/null @@ -1,146 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::coupledFacePair - -Description - Data associated with a pair of coupled faces - -SourceFiles - coupledFacePair.C - -\*---------------------------------------------------------------------------*/ - -#ifndef coupledFacePair_H -#define coupledFacePair_H - -#include "label.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of friend functions and operators - -class coupledFacePair; - -Ostream& operator<<(Ostream&, const coupledFacePair&); - - -/*---------------------------------------------------------------------------*\ - Class coupledFacePair Declaration -\*---------------------------------------------------------------------------*/ - -class coupledFacePair -{ - // Private data - - //- STAR couple ID - label coupleID_; - - //- Master cell (lower cell label) - label masterCellID_; - - //- Master face (lower cell label) - label masterFaceID_; - - //- Slave cell (higher cell label) - label slaveCellID_; - - //- Slave face (higher cell label) - label slaveFaceID_; - - //- Integral or arbitrary flag - bool integralMatch_; - - -public: - - - // Constructors - - //- Construct from components - coupledFacePair - ( - const label coupleNo, // STAR couple ID - const label mC, const label mF, // master cell and face - const label sC, const label sF, // slave cell and face - const label integral - ); - - - // Member Functions - - //- Return STAR couple ID - label coupleID() const - { - return coupleID_; - } - - //- Return master cell - label masterCell() const - { - return masterCellID_; - } - - //- Return master face - label masterFace() const - { - return masterFaceID_; - } - - //- Return slave cell - label slaveCell() const - { - return slaveCellID_; - } - - //- Return slave face - label slaveFace() const - { - return slaveFaceID_; - } - - //- Is this an integral match? - bool integralMatch() const - { - return integralMatch_; - } - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const coupledFacePair&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/star3ToFoam/createBoundaryFaces.C b/applications/utilities/mesh/conversion/star3ToFoam/createBoundaryFaces.C deleted file mode 100644 index 0bff685546..0000000000 --- a/applications/utilities/mesh/conversion/star3ToFoam/createBoundaryFaces.C +++ /dev/null @@ -1,201 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create intermediate mesh files from PROSTAR files - -\*---------------------------------------------------------------------------*/ - -#include "starMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Specialist version of face comparison to deal with -// PROSTAR boundary format idiosyncracies -bool Foam::starMesh::starEqualFace -( - const face& boundaryFace, - const face& cellFace -) const -{ - // A PROSTAR boundary face is defined by 4 vertices irrespective - // of its topology. - // In order to deal with all possibilities, cell face is - // considered equal if three of the vertices are the same. - bool cellFaceHappy = false; - - label nEqual = 0; - - forAll(cellFace, cellFaceLabelI) - { - const label curCellFaceLabel = cellFace[cellFaceLabelI]; - - forAll(boundaryFace, bouFaceLabelI) - { - if (boundaryFace[bouFaceLabelI] == curCellFaceLabel) - { - nEqual++; - - break; - } - } - } - - if (nEqual >= 3) - { - cellFaceHappy = true; - } - - // Boundary face is happy if all of its vertices are recognised - bool boundaryFaceHappy = true; - - forAll(boundaryFace, bouFaceLabelI) - { - const label curBouFaceLabel = boundaryFace[bouFaceLabelI]; - - bool found = false; - - forAll(cellFace, cellFaceLabelI) - { - if (curBouFaceLabel == cellFace[cellFaceLabelI]) - { - found = true; - break; - } - } - - boundaryFaceHappy = boundaryFaceHappy && found; - } - - return (cellFaceHappy && boundaryFaceHappy); -} - - -void Foam::starMesh::markBoundaryFaces() -{ - // set size of mark lists for the boundary - boundaryCellIDs_.setSize(boundary_.size()); - boundaryCellFaceIDs_.setSize(boundary_.size()); - - forAll(boundary_, patchi) - { - const faceList& patchFaces = boundary_[patchi]; - - // set size of patch lists - labelList& curBoundaryCellIDs = boundaryCellIDs_[patchi]; - labelList& curBoundaryCellFaceIDs = boundaryCellFaceIDs_[patchi]; - - curBoundaryCellIDs.setSize(patchFaces.size()); - curBoundaryCellFaceIDs.setSize(patchFaces.size()); - - const labelListList& PointCells = pointCells(); - - forAll(patchFaces, facei) - { - bool found = false; - - const face& curFace = patchFaces[facei]; - const labelList& facePoints = curFace; - - forAll(facePoints, pointi) - { - const labelList& facePointCells = - PointCells[facePoints[pointi]]; - - forAll(facePointCells, celli) - { - const label curCellIndex = facePointCells[celli]; - - const faceList& curCellFaces = - cellFaces_[curCellIndex]; - - forAll(curCellFaces, cellFacei) - { - if (starEqualFace(curFace, curCellFaces[cellFacei])) - { - // Found the cell face corresponding to this face - found = true; - - // Set boundary face to the corresponding cell face - curBoundaryCellIDs[facei] = curCellIndex; - curBoundaryCellFaceIDs[facei] = cellFacei; - } - if (found) break; - } - if (found) break; - } - if (found) break; - } - if (!found) - { - FatalErrorInFunction - << "Face " << facei - << " does not have neighbour cell." - << " Face : " << endl << curFace << endl - << "PROSTAR Command: vset,news,vlis"; - - forAll(curFace, spI) - { - if (curFace[spI] > -1 && curFace[spI] < starPointID_.size()) - { - Info<< "," << starPointID_[curFace[spI]]; - } - else - { - Info<< ",???"; - } - } - - FatalError - << " $ bset,add,vset,all" - << abort(FatalError); - } - } - } -} - - -void Foam::starMesh::collectBoundaryFaces() -{ - Info<< "Collecting boundary faces" << endl; - forAll(boundary_, patchi) - { - faceList& patchFaces = boundary_[patchi]; - - // set size of patch lists - const labelList& curBoundaryCellIDs = boundaryCellIDs_[patchi]; - const labelList& curBoundaryCellFaceIDs = boundaryCellFaceIDs_[patchi]; - - forAll(curBoundaryCellIDs, facei) - { - patchFaces[facei] = - cellFaces_[curBoundaryCellIDs[facei]] - [curBoundaryCellFaceIDs[facei]]; - } - } - - Info<< "Finished collecting boundary faces" << endl; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C deleted file mode 100644 index cfb77ef050..0000000000 --- a/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C +++ /dev/null @@ -1,1508 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Description - Create coupled match faces and add them to the cells - -\*---------------------------------------------------------------------------*/ - -#include "starMesh.H" -#include "boolList.H" -#include "pointHit.H" -#include "IOmanip.H" -#include "boundBox.H" -#include "Map.H" -#include "unitConversion.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::starMesh::createCoupleMatches() -{ - // Loop through all couples and create intersection faces. Add all points - // of intersection faces to the couple points lists. The numbering of - // the list is set such that the list can be appended to the - // existing points list - - // Estimate the number of cells affected by couple matches - const label cellMapSize = min - ( - cellShapes_.size()/10, - couples_.size()*2 - ); - - // Store newly created faces for each cell - Map> cellAddedFaces(cellMapSize); - - Map> cellRemovedFaces(cellMapSize); - - // In order to remove often allocation, remember the number of live points. - // If you run out of space in point creation, increase it by the number of - // couples (good scale) and resize at the end; - label nLivePoints = points_.size(); - - const label infoJump = max(1000, couples_.size()/20); - - forAll(couples_, coupleI) - { - if (coupleI % infoJump == 0) - { - Info<< "Doing couple " << coupleI << ". STAR couple ID: " - << couples_[coupleI].coupleID() << endl; - } - - // Initialise cell edges for master and slave cells - const coupledFacePair& fp = couples_[coupleI]; - const face& masterFace = cellFaces_[fp.masterCell()][fp.masterFace()]; - const face& slaveFace = cellFaces_[fp.slaveCell()][fp.slaveFace()]; - - #ifdef DEBUG_COUPLE - Info<< "coupleI: " << coupleI << endl - << "masterFace: " << masterFace << endl - << "master points: " << masterFace.points(points_) << endl - << "slaveFace: " << slaveFace << endl - << "slave points: " << slaveFace.points(points_) - << endl << endl; - #endif - - // check the angle of face area vectors - scalar faceAreaAngle = - mag - ( - -(masterFace.normal(points_) & slaveFace.normal(points_))/ - (masterFace.mag(points_)*slaveFace.mag(points_) + VSMALL) - ); - - if (faceAreaAngle < 0.94) - { - Info<< "Couple direction mismatch in the couple match " - << coupleI << ". STAR couple ID: " - << couples_[coupleI].coupleID() << endl - << "The angle between face normals is " - << radToDeg(Foam::acos(faceAreaAngle)) - << " deg." << endl - << "master cell: " << fp.masterCell() - << " STAR number: " << starCellID_[fp.masterCell()] - << " type: " << cellShapes_[fp.masterCell()].model().name() - << " face: " << fp.masterFace() << endl - << "slave cell : " << fp.slaveCell() - << " STAR number: " << starCellID_[fp.slaveCell()] - << " type: " << cellShapes_[fp.slaveCell()].model().name() - << " face: " << fp.slaveFace() << endl; - } - - // Deal with integral patches - if (fp.integralMatch()) - { - // Master face is replaced by a set of slave faces - - Map>::iterator crfIter = - cellRemovedFaces.find(fp.masterCell()); - - if (crfIter == cellRemovedFaces.end()) - { - cellRemovedFaces.insert - ( - fp.masterCell(), - SLList