Commit 9ffa7df9 authored by mattijs's avatar mattijs
Browse files

ENH: badQuality: cell/faceSources for motionSmoother checks

parent 774db288
......@@ -87,6 +87,8 @@ fvMeshTools/fvMeshTools.C
motionSmoother/motionSmoother.C
motionSmoother/motionSmootherCheck.C
motionSmoother/polyMeshGeometry/polyMeshGeometry.C
motionSmoother/badQualityToCell/badQualityToCell.C
motionSmoother/badQualityToFace/badQualityToFace.C
motionSolver/motionSolver/motionSolver.C
motionSolver/displacement/displacementMotionSolver.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "badQualityToCell.H"
#include "polyMesh.H"
#include "motionSmoother.H"
#include "addToRunTimeSelectionTable.H"
#include "faceSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(badQualityToCell, 0);
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, word);
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, istream);
}
Foam::topoSetSource::addToUsageTable Foam::badQualityToCell::usage_
(
badQualityToCell::typeName,
"\n Usage: badQualityToCell mesh-quality-dictionary\n\n"
" Select all cells that do not satisfy the selection criterion\n\n"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::badQualityToCell::combine(topoSet& set, const bool add) const
{
faceSet faces(mesh_, "meshQualityFaces", mesh_.nFaces()/100+1);
motionSmoother::checkMesh(false, mesh_, dict_, faces);
faces.sync(mesh_);
forAllConstIter(faceSet, faces, iter)
{
label faceI = iter.key();
addOrDelete(set, mesh_.faceOwner()[faceI], add);
if (mesh_.isInternalFace(faceI))
{
addOrDelete(set, mesh_.faceNeighbour()[faceI], add);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::badQualityToCell::badQualityToCell
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
dict_(dict)
{}
// Construct from Istream
Foam::badQualityToCell::badQualityToCell
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
dict_(is)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::badQualityToCell::~badQualityToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::badQualityToCell::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding bad-quality cells" << endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing bad-quality cells" << endl;
combine(set, false);
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
Class
Foam::badQualityToCell
Description
Selects bad quality cells (using snappyHexMesh/cvMesh mesh quality selector)
SourceFiles
badQualityToCell.C
\*---------------------------------------------------------------------------*/
#ifndef badQualityToCell_H
#define badQualityToCell_H
#include "topoSetSource.H"
#include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class badQualityToCell Declaration
\*---------------------------------------------------------------------------*/
class badQualityToCell
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Mesh quality dictionary
const dictionary dict_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("badQualityToCell");
// Constructors
//- Construct from dictionary
badQualityToCell
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
badQualityToCell
(
const polyMesh& mesh,
Istream&
);
//- Destructor
virtual ~badQualityToCell();
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "badQualityToFace.H"
#include "polyMesh.H"
#include "motionSmoother.H"
#include "addToRunTimeSelectionTable.H"
#include "faceSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(badQualityToFace, 0);
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, word);
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, istream);
}
Foam::topoSetSource::addToUsageTable Foam::badQualityToFace::usage_
(
badQualityToFace::typeName,
"\n Usage: badQualityToFace mesh-quality-dictionary\n\n"
" Select all faces that do not satisfy the selection criterion\n\n"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::badQualityToFace::combine(topoSet& set, const bool add) const
{
faceSet faces(mesh_, "meshQualityFaces", mesh_.nFaces()/100+1);
motionSmoother::checkMesh(false, mesh_, dict_, faces);
faces.sync(mesh_);
forAllConstIter(faceSet, faces, iter)
{
label faceI = iter.key();
addOrDelete(set, faceI, add);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::badQualityToFace::badQualityToFace
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
dict_(dict)
{}
// Construct from Istream
Foam::badQualityToFace::badQualityToFace
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
dict_(is)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::badQualityToFace::~badQualityToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::badQualityToFace::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding bad-quality faces" << endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing bad-quality faces" << endl;
combine(set, false);
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
Class
Foam::badQualityToFace
Description
Selects bad quality faces (using snappyHexMesh/cvMesh mesh quality selector)
SourceFiles
badQualityToFace.C
\*---------------------------------------------------------------------------*/
#ifndef badQualityToFace_H
#define badQualityToFace_H
#include "topoSetSource.H"
#include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class badQualityToFace Declaration
\*---------------------------------------------------------------------------*/
class badQualityToFace
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Mesh quality dictionary
const dictionary dict_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("badQualityToFace");
// Constructors
//- Construct from dictionary
badQualityToFace
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
badQualityToFace
(
const polyMesh& mesh,
Istream&
);
//- Destructor
virtual ~badQualityToFace();
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment