Merge branch 'develop-pre-release' of develop.openfoam.com:Development/OpenFOAM-plus into develop-pre-release

This commit is contained in:
mattijs
2018-05-17 17:11:57 +01:00
108 changed files with 2503 additions and 992 deletions

View File

@ -5,7 +5,7 @@
| \\ / A nd | Web: www.OpenFOAM.com | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// Insitu processing of finiteVolume fields with ParaView Catalyst // Insitu processing with ParaView Catalyst
type catalyst; type catalyst;
libs ("libcatalystFoam.so"); libs ("libcatalystFoam.so");

View File

@ -0,0 +1,68 @@
from paraview.simple import *
from paraview import coprocessing
# The frequency to output everything
outputfrequency = 1
# Simply print out all channel names that our function object is producing
# ----------------------- CoProcessor definition -----------------------
def CreateCoProcessor():
def _CreatePipeline(coprocessor, datadescription):
class Pipeline:
for i in range(datadescription.GetNumberOfInputDescriptions()):
name = datadescription.GetInputDescriptionName(i)
input = coprocessor.CreateProducer(datadescription, name)
grid = input.GetClientSideObject().GetOutputDataObject(0)
print "Channel <" + name + "> is", grid.GetClassName()
return Pipeline()
class CoProcessor(coprocessing.CoProcessor):
def CreatePipeline(self, datadescription):
self.Pipeline = _CreatePipeline(self, datadescription)
return CoProcessor()
#--------------------------------------------------------------
# Global variables that will hold the pipeline for each timestep
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
# It will be automatically setup when coprocessor.UpdateProducers() is called the
# first time.
coprocessor = CreateCoProcessor()
#--------------------------------------------------------------
# Enable Live-Visualizaton with ParaView
coprocessor.EnableLiveVisualization(False)
# ---------------------- Data Selection method ----------------------
def RequestDataDescription(datadescription):
"Callback to populate the request for current timestep"
global coprocessor
if datadescription.GetForceOutput() == True or datadescription.GetTimeStep() % outputfrequency == 0:
# We are just going to request all fields and meshes from the simulation
# code/adaptor.
for i in range(datadescription.GetNumberOfInputDescriptions()):
datadescription.GetInputDescription(i).AllFieldsOn()
datadescription.GetInputDescription(i).GenerateMeshOn()
return
# setup requests for all inputs based on the requirements of the
# pipeline.
coprocessor.LoadRequestedData(datadescription)
# ------------------------ Processing method ------------------------
def DoCoProcessing(datadescription):
"Callback to do co-processing for current timestep"
global coprocessor
# Update the coprocessor by providing it the newly generated simulation data.
# If the pipeline hasn't been setup yet, this will setup the pipeline.
coprocessor.UpdateProducers(datadescription)
# Write output data, if appropriate.
coprocessor.WriteData(datadescription);

View File

@ -0,0 +1,77 @@
from paraview.simple import *
from paraview import coprocessing
# The frequency to output everything
outputfrequency = 5
# This is largely identical to the Catalyst allinputsgridwriter.py example
# but only handle vtkMultiBlockDataSet, since that is what we generate
# ----------------------- CoProcessor definition -----------------------
def CreateCoProcessor():
def _CreatePipeline(coprocessor, datadescription):
class Pipeline:
for i in range(datadescription.GetNumberOfInputDescriptions()):
name = datadescription.GetInputDescriptionName(i)
input = coprocessor.CreateProducer(datadescription, name)
grid = input.GetClientSideObject().GetOutputDataObject(0)
if grid.IsA('vtkMultiBlockDataSet'):
writer = servermanager.writers.XMLMultiBlockDataWriter(Input=input)
coprocessor.RegisterWriter(writer, filename=name+'_%t.vtm', freq=outputfrequency)
return Pipeline()
class CoProcessor(coprocessing.CoProcessor):
def CreatePipeline(self, datadescription):
self.Pipeline = _CreatePipeline(self, datadescription)
return CoProcessor()
#--------------------------------------------------------------
# Global variables that will hold the pipeline for each timestep
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
# It will be automatically setup when coprocessor.UpdateProducers() is called the
# first time.
coprocessor = CreateCoProcessor()
#--------------------------------------------------------------
# Enable Live-Visualizaton with ParaView
coprocessor.EnableLiveVisualization(False)
# ---------------------- Data Selection method ----------------------
def RequestDataDescription(datadescription):
"Callback to populate the request for current timestep"
global coprocessor
if datadescription.GetForceOutput() == True or datadescription.GetTimeStep() % outputfrequency == 0:
# We are just going to request all fields and meshes from the simulation
# code/adaptor.
for i in range(datadescription.GetNumberOfInputDescriptions()):
datadescription.GetInputDescription(i).AllFieldsOn()
datadescription.GetInputDescription(i).GenerateMeshOn()
return
# setup requests for all inputs based on the requirements of the
# pipeline.
coprocessor.LoadRequestedData(datadescription)
# ------------------------ Processing method ------------------------
def DoCoProcessing(datadescription):
"Callback to do co-processing for current timestep"
global coprocessor
# Update the coprocessor by providing it the newly generated simulation data.
# If the pipeline hasn't been setup yet, this will setup the pipeline.
coprocessor.UpdateProducers(datadescription)
# Write output data, if appropriate.
coprocessor.WriteData(datadescription);
# Write image capture (Last arg: rescale lookup table), if appropriate.
coprocessor.WriteImages(datadescription, rescale_lookuptable=False)
# Live Visualization, if enabled.
coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)

View File

@ -0,0 +1,78 @@
from paraview.simple import *
from paraview import coprocessing
# The frequency to output everything
outputfrequency = 5
# As per writeAll, but only for "/mesh" sub-channels.
# ----------------------- CoProcessor definition -----------------------
def CreateCoProcessor():
def _CreatePipeline(coprocessor, datadescription):
class Pipeline:
for i in range(datadescription.GetNumberOfInputDescriptions()):
name = datadescription.GetInputDescriptionName(i)
if not name.endswith('/mesh'):
continue
input = coprocessor.CreateProducer(datadescription, name)
grid = input.GetClientSideObject().GetOutputDataObject(0)
if grid.IsA('vtkMultiBlockDataSet'):
writer = servermanager.writers.XMLMultiBlockDataWriter(Input=input)
coprocessor.RegisterWriter(writer, filename=name+'_%t.vtm', freq=outputfrequency)
return Pipeline()
class CoProcessor(coprocessing.CoProcessor):
def CreatePipeline(self, datadescription):
self.Pipeline = _CreatePipeline(self, datadescription)
return CoProcessor()
#--------------------------------------------------------------
# Global variables that will hold the pipeline for each timestep
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
# It will be automatically setup when coprocessor.UpdateProducers() is called the
# first time.
coprocessor = CreateCoProcessor()
#--------------------------------------------------------------
# Enable Live-Visualizaton with ParaView
coprocessor.EnableLiveVisualization(False)
# ---------------------- Data Selection method ----------------------
def RequestDataDescription(datadescription):
"Callback to populate the request for current timestep"
global coprocessor
if datadescription.GetForceOutput() == True or datadescription.GetTimeStep() % outputfrequency == 0:
# We are just going to request all fields and meshes from the simulation
# code/adaptor.
for i in range(datadescription.GetNumberOfInputDescriptions()):
datadescription.GetInputDescription(i).AllFieldsOn()
datadescription.GetInputDescription(i).GenerateMeshOn()
return
# setup requests for all inputs based on the requirements of the
# pipeline.
coprocessor.LoadRequestedData(datadescription)
# ------------------------ Processing method ------------------------
def DoCoProcessing(datadescription):
"Callback to do co-processing for current timestep"
global coprocessor
# Update the coprocessor by providing it the newly generated simulation data.
# If the pipeline hasn't been setup yet, this will setup the pipeline.
coprocessor.UpdateProducers(datadescription)
# Write output data, if appropriate.
coprocessor.WriteData(datadescription);
# Write image capture (Last arg: rescale lookup table), if appropriate.
coprocessor.WriteImages(datadescription, rescale_lookuptable=False)
# Live Visualization, if enabled.
coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)

View File

@ -0,0 +1,78 @@
from paraview.simple import *
from paraview import coprocessing
# The frequency to output everything
outputfrequency = 5
# As per writeAll, but only for "/patches" sub-channels.
# ----------------------- CoProcessor definition -----------------------
def CreateCoProcessor():
def _CreatePipeline(coprocessor, datadescription):
class Pipeline:
for i in range(datadescription.GetNumberOfInputDescriptions()):
name = datadescription.GetInputDescriptionName(i)
if not name.endswith('/patches'):
continue
input = coprocessor.CreateProducer(datadescription, name)
grid = input.GetClientSideObject().GetOutputDataObject(0)
if grid.IsA('vtkMultiBlockDataSet'):
writer = servermanager.writers.XMLMultiBlockDataWriter(Input=input)
coprocessor.RegisterWriter(writer, filename=name+'_%t.vtm', freq=outputfrequency)
return Pipeline()
class CoProcessor(coprocessing.CoProcessor):
def CreatePipeline(self, datadescription):
self.Pipeline = _CreatePipeline(self, datadescription)
return CoProcessor()
#--------------------------------------------------------------
# Global variables that will hold the pipeline for each timestep
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
# It will be automatically setup when coprocessor.UpdateProducers() is called the
# first time.
coprocessor = CreateCoProcessor()
#--------------------------------------------------------------
# Enable Live-Visualizaton with ParaView
coprocessor.EnableLiveVisualization(False)
# ---------------------- Data Selection method ----------------------
def RequestDataDescription(datadescription):
"Callback to populate the request for current timestep"
global coprocessor
if datadescription.GetForceOutput() == True or datadescription.GetTimeStep() % outputfrequency == 0:
# We are just going to request all fields and meshes from the simulation
# code/adaptor.
for i in range(datadescription.GetNumberOfInputDescriptions()):
datadescription.GetInputDescription(i).AllFieldsOn()
datadescription.GetInputDescription(i).GenerateMeshOn()
return
# setup requests for all inputs based on the requirements of the
# pipeline.
coprocessor.LoadRequestedData(datadescription)
# ------------------------ Processing method ------------------------
def DoCoProcessing(datadescription):
"Callback to do co-processing for current timestep"
global coprocessor
# Update the coprocessor by providing it the newly generated simulation data.
# If the pipeline hasn't been setup yet, this will setup the pipeline.
coprocessor.UpdateProducers(datadescription)
# Write output data, if appropriate.
coprocessor.WriteData(datadescription);
# Write image capture (Last arg: rescale lookup table), if appropriate.
coprocessor.WriteImages(datadescription, rescale_lookuptable=False)
# Live Visualization, if enabled.
coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)

View File

@ -1,16 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// Insitu processing of finiteArea fields with ParaView Catalyst
type catalyst::area;
libs ("libcatalystFoam.so");
executeControl timeStep;
writeControl none;
// ************************************************************************* //

View File

@ -1,16 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// Insitu processing of lagrangian clouds with ParaView Catalyst
type catalyst::cloud;
libs ("libcatalystFoam.so");
executeControl timeStep;
writeControl none;
// ************************************************************************* //

View File

@ -13,8 +13,8 @@
# config.csh/example/paraview # config.csh/example/paraview
# #
# Description # Description
# Example of defining a different ParaView_VERSION but retaining # Example of defining a different ParaView_VERSION but retaining the
# the standard config.csh/paraview mechanism # standard config.csh/paraview mechanism
# #
# Note # Note
# This file could be copied to a user or site location, but should never # This file could be copied to a user or site location, but should never
@ -25,7 +25,8 @@
set pv=5.5.0 set pv=5.5.0
set pv=5.5.0-mpipy set pv=5.5.0-mpipy
set qt=qt-5.9.0
eval `foamEtcFile -csh -config -mode=o paraview -- ParaView_VERSION=$pv` eval `foamEtcFile -csh -config -mode=o paraview -- ParaView_VERSION=$pv ParaView_QT=$qt`
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -120,8 +120,16 @@ if ( $?ParaView_VERSION ) then
#OBSOLETE? endif #OBSOLETE? endif
# QT libraries as required # QT libraries as required
# Set Qt5_DIR to root directory.
# Another possibility: "qtpaths --qt-version"
set qtDir="$archDir/$ParaView_QT" set qtDir="$archDir/$ParaView_QT"
if ( -d "$qtDir" ) then if ( -d "$qtDir" ) then
switch ($ParaView_QT)
case *-qt*:
setenv Qt5_DIR $qtDir
breaksw
endsw
foreach qtLibDir ("$qtDir/lib$WM_COMPILER_LIB_ARCH" "$qtDir/lib") foreach qtLibDir ("$qtDir/lib$WM_COMPILER_LIB_ARCH" "$qtDir/lib")
if ( -d "$qtLibDir" ) then if ( -d "$qtLibDir" ) then
setenv LD_LIBRARY_PATH "${qtLibDir}:${LD_LIBRARY_PATH}" setenv LD_LIBRARY_PATH "${qtLibDir}:${LD_LIBRARY_PATH}"

View File

@ -111,6 +111,7 @@ unsetenv ParaView_INCLUDE_DIR
unsetenv ParaView_VERSION unsetenv ParaView_VERSION
unsetenv PV_PLUGIN_PATH unsetenv PV_PLUGIN_PATH
unsetenv VTK_DIR unsetenv VTK_DIR
unsetenv Qt5_DIR # Perhaps only unset if it is in WM_THIRD_PARTY_DIR?
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Unset other ThirdParty environment variables # Unset other ThirdParty environment variables

View File

@ -13,8 +13,8 @@
# config.sh/example/paraview # config.sh/example/paraview
# #
# Description # Description
# Example of defining a different ParaView_VERSION but retaining # Example of defining a different ParaView_VERSION but retaining the
# the standard config.sh/paraview mechanism # standard config.sh/paraview mechanism
# #
# Note # Note
# This file could be copied to a user or site location, but should never # This file could be copied to a user or site location, but should never
@ -25,7 +25,8 @@
pv=5.5.0 pv=5.5.0
pv=5.5.0-mpipy pv=5.5.0-mpipy
qt=qt-5.9.0
eval $(foamEtcFile -sh -config -mode=o paraview -- ParaView_VERSION=$pv) eval $(foamEtcFile -sh -config -mode=o paraview -- ParaView_VERSION=$pv ParaView_QT=$qt)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -127,10 +127,16 @@ then
#OBSOLETE? export PYTHONPATH=$PYTHONPATH:${PYTHONPATH:+:}$pvPython:$pvLibDir #OBSOLETE? export PYTHONPATH=$PYTHONPATH:${PYTHONPATH:+:}$pvPython:$pvLibDir
#OBSOLETE? fi #OBSOLETE? fi
# QT libraries as required # QT libraries as required, and Qt5_DIR for the root directory.
# Another possibility: "qtpaths --qt-version"
qtDir="$archDir/$ParaView_QT" qtDir="$archDir/$ParaView_QT"
if [ -d "$qtDir" ] if [ -d "$qtDir" ]
then then
case "$ParaView_QT" in
*-5*)
export Qt5_DIR=$qtDir
;;
esac
for qtLibDir in $qtDir/lib$WM_COMPILER_LIB_ARCH $qtDir/lib for qtLibDir in $qtDir/lib$WM_COMPILER_LIB_ARCH $qtDir/lib
do do
if [ -d "$qtLibDir" ] if [ -d "$qtLibDir" ]

View File

@ -97,7 +97,6 @@ then
unset OPAL_PREFIX unset OPAL_PREFIX
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Unset Ensight/ParaView-related environment variables # Unset Ensight/ParaView-related environment variables
@ -108,6 +107,12 @@ unset ParaView_VERSION
unset PV_PLUGIN_PATH unset PV_PLUGIN_PATH
unset VTK_DIR unset VTK_DIR
# Undefine Qt5_DIR if set to one of the paths on foamOldDirs
if [ -z "$($foamClean -env=Qt5_DIR "$foamOldDirs")" ]
then
unset Qt5_DIR
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Unset other ThirdParty environment variables # Unset other ThirdParty environment variables

View File

@ -39,8 +39,8 @@ InfoSwitches
writeDictionaries 0; writeDictionaries 0;
writeOptionalEntries 0; writeOptionalEntries 0;
// Write lagrangian "positions" file in v1706 format (at earlier) // Write lagrangian "positions" file in v1706 format (and earlier)
writeLagrangianPositions 0; writeLagrangianPositions 1;
// Report hosts used (parallel) // Report hosts used (parallel)
// - 0 = none // - 0 = none

View File

@ -236,7 +236,7 @@ void Foam::error::exit(const int errNo)
{ {
Perr<< endl << *this << endl Perr<< endl << *this << endl
<< "\nFOAM exiting\n" << endl; << "\nFOAM exiting\n" << endl;
::exit(1); ::exit(errNo);
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -86,6 +86,7 @@ void pow
gf.oriented() = pow(gf1.oriented(), r); gf.oriented() = pow(gf1.oriented(), r);
} }
template template
< <
class Type, class Type,
@ -181,6 +182,7 @@ void sqr
gf.oriented() = sqr(gf1.oriented()); gf.oriented() = sqr(gf1.oriented());
} }
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
tmp tmp
< <
@ -217,6 +219,7 @@ sqr(const GeometricField<Type, PatchField, GeoMesh>& gf)
return tSqr; return tSqr;
} }
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
tmp tmp
< <
@ -270,6 +273,7 @@ void magSqr
gsf.oriented() = magSqr(gf.oriented()); gsf.oriented() = magSqr(gf.oriented());
} }
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr
( (
@ -343,6 +347,7 @@ void mag
gsf.oriented() = mag(gf.oriented()); gsf.oriented() = mag(gf.oriented());
} }
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
tmp<GeometricField<scalar, PatchField, GeoMesh>> mag tmp<GeometricField<scalar, PatchField, GeoMesh>> mag
( (
@ -458,6 +463,7 @@ cmptAv(const GeometricField<Type, PatchField, GeoMesh>& gf)
return CmptAv; return CmptAv;
} }
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
tmp tmp
< <
@ -500,7 +506,7 @@ cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf)
} }
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc) \ #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, binaryOp) \
\ \
template<class Type, template<class> class PatchField, class GeoMesh> \ template<class Type, template<class> class PatchField, class GeoMesh> \
dimensioned<returnType> func \ dimensioned<returnType> func \
@ -512,7 +518,15 @@ dimensioned<returnType> func \
( \ ( \
#func "(" + gf.name() + ')', \ #func "(" + gf.name() + ')', \
gf.dimensions(), \ gf.dimensions(), \
Foam::func(gFunc(gf.primitiveField()), gFunc(gf.boundaryField())) \ returnReduce \
( \
Foam::func \
( \
Foam::func(gf.primitiveField()), \
Foam::func(gf.boundaryField()) \
), \
binaryOp<Type>() \
) \
); \ ); \
} \ } \
\ \
@ -527,8 +541,8 @@ dimensioned<returnType> func \
return res; \ return res; \
} }
UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, gMax) UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, maxOp)
UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, gMin) UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, minOp)
#undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -212,7 +212,7 @@ tmp
cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf); cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf);
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc) \ #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, binaryOp) \
\ \
template<class Type, template<class> class PatchField, class GeoMesh> \ template<class Type, template<class> class PatchField, class GeoMesh> \
dimensioned<returnType> func \ dimensioned<returnType> func \
@ -226,8 +226,8 @@ dimensioned<returnType> func \
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \ const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
); );
UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, gMax) UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, maxOp)
UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, gMin) UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, minOp)
#undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY

View File

@ -266,7 +266,7 @@ Foam::faceZone::faceZone
( (
const word& name, const word& name,
const labelUList& addr, const labelUList& addr,
const boolList& fm, const boolUList& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh& zm
) )
@ -328,7 +328,7 @@ Foam::faceZone::faceZone
( (
const faceZone& origZone, const faceZone& origZone,
const labelUList& addr, const labelUList& addr,
const boolList& fm, const boolUList& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh& zm
) )
@ -468,7 +468,7 @@ void Foam::faceZone::resetAddressing
void Foam::faceZone::resetAddressing void Foam::faceZone::resetAddressing
( (
const labelUList& addr, const labelUList& addr,
const boolList& flipMap const boolUList& flipMap
) )
{ {
clearAddressing(); clearAddressing();

View File

@ -177,7 +177,7 @@ public:
( (
const word& name, const word& name,
const labelUList& addr, const labelUList& addr,
const boolList& fm, const boolUList& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh& zm
); );
@ -208,7 +208,7 @@ public:
( (
const faceZone& origZone, const faceZone& origZone,
const labelUList& addr, const labelUList& addr,
const boolList& fm, const boolUList& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh& zm
); );
@ -236,7 +236,7 @@ public:
virtual autoPtr<faceZone> clone virtual autoPtr<faceZone> clone
( (
const labelUList& addr, const labelUList& addr,
const boolList& fm, const boolUList& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh& zm
) const ) const
@ -309,7 +309,7 @@ public:
virtual void resetAddressing virtual void resetAddressing
( (
const labelUList& addr, const labelUList& addr,
const boolList& flipMap const boolUList& flipMap
); );
//- Move reset addressing - use uniform flip map value //- Move reset addressing - use uniform flip map value

View File

@ -1,5 +1,5 @@
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(RULES)/mplib$(WM_MPLIB) sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
EXE_INC = $(PFLAGS) $(PINC) $(c++LESSWARN) EXE_INC = $(PFLAGS) $(PINC) $(c++LESSWARN)
LIB_LIBS = $(PLIBS) LIB_LIBS = $(PLIBS)

View File

@ -571,7 +571,8 @@ void Foam::vtk::vtuSizing::populateArrays
if (output == contentType::LEGACY) if (output == contentType::LEGACY)
{ {
// Update size for legacy face stream // Update size for legacy face stream
faceOutput[startLabel] = (faceIndexer - startLabel); // (subtract 1 to avoid counting the storage location)
faceOutput[startLabel] = (faceIndexer - 1 - startLabel);
} }
else else
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,6 +42,7 @@ License
#include "fvMeshTools.H" #include "fvMeshTools.H"
#include "labelPairHashes.H" #include "labelPairHashes.H"
#include "ListOps.H" #include "ListOps.H"
#include "globalIndex.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -688,25 +689,54 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch
// merge those points. // merge those points.
Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints
( (
const labelList& pointToGlobalMaster,
labelListList& constructPointMap labelListList& constructPointMap
) )
{ {
// Find out which sets of points get merged and create a map from // Find out which sets of points get merged and create a map from
// mesh point to unique point. // mesh point to unique point.
Map<label> pointToMaster
( label nShared = 0;
fvMeshAdder::findSharedPoints forAll(pointToGlobalMaster, pointi)
( {
mesh_, if (pointToGlobalMaster[pointi] != -1)
mergeTol_ {
) nShared++;
); }
}
Map<label> globalMasterToLocalMaster(2*nShared);
Map<label> pointToMaster(2*nShared);
forAll(pointToGlobalMaster, pointi)
{
label globali = pointToGlobalMaster[pointi];
if (globali != -1)
{
Map<label>::const_iterator iter = globalMasterToLocalMaster.find
(
globali
);
if (iter == globalMasterToLocalMaster.end())
{
// Found first point. Designate as master
globalMasterToLocalMaster.insert(globali, pointi);
pointToMaster.insert(pointi, pointi);
}
else
{
pointToMaster.insert(pointi, iter());
}
}
}
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0) if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
{ {
return nullptr; return nullptr;
} }
polyTopoChange meshMod(mesh_); polyTopoChange meshMod(mesh_);
fvMeshAdder::mergePoints(mesh_, pointToMaster, meshMod); fvMeshAdder::mergePoints(mesh_, pointToMaster, meshMod);
@ -750,16 +780,19 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints
} }
// Construct the local environment of all boundary faces. void Foam::fvMeshDistribute::getCouplingData
void Foam::fvMeshDistribute::getNeighbourData
( (
const labelList& distribution, const labelList& distribution,
labelList& sourceFace, labelList& sourceFace,
labelList& sourceProc, labelList& sourceProc,
labelList& sourcePatch, labelList& sourcePatch,
labelList& sourceNewNbrProc labelList& sourceNewNbrProc,
labelList& sourcePointMaster
) const ) const
{ {
// Construct the coupling information for all (boundary) faces and
// points
label nBnd = mesh_.nFaces() - mesh_.nInternalFaces(); label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
sourceFace.setSize(nBnd); sourceFace.setSize(nBnd);
sourceProc.setSize(nBnd); sourceProc.setSize(nBnd);
@ -890,13 +923,62 @@ void Foam::fvMeshDistribute::getNeighbourData
} }
} }
} }
// Collect coupled (collocated) points
sourcePointMaster.setSize(mesh_.nPoints());
sourcePointMaster = -1;
{
// Assign global master point
const globalIndex globalPoints(mesh_.nPoints());
const globalMeshData& gmd = mesh_.globalData();
const indirectPrimitivePatch& cpp = gmd.coupledPatch();
const labelList& meshPoints = cpp.meshPoints();
const mapDistribute& slavesMap = gmd.globalCoPointSlavesMap();
const labelListList& slaves = gmd.globalCoPointSlaves();
labelList elems(slavesMap.constructSize(), -1);
forAll(meshPoints, pointi)
{
const labelList& slots = slaves[pointi];
if (slots.size())
{
// pointi is a master. Assign a unique label.
label globalPointi = globalPoints.toGlobal(meshPoints[pointi]);
elems[pointi] = globalPointi;
forAll(slots, i)
{
label sloti = slots[i];
if (sloti >= meshPoints.size())
{
// Filter out local collocated points. We don't want
// to merge these
elems[slots[i]] = globalPointi;
}
}
}
}
// Push slave-slot data back to slaves
slavesMap.reverseDistribute(elems.size(), elems, false);
// Extract back onto mesh
forAll(meshPoints, pointi)
{
sourcePointMaster[meshPoints[pointi]] = elems[pointi];
}
}
} }
// Subset the neighbourCell/neighbourProc fields // Subset the neighbourCell/neighbourProc fields
void Foam::fvMeshDistribute::subsetBoundaryData void Foam::fvMeshDistribute::subsetCouplingData
( (
const fvMesh& mesh, const fvMesh& mesh,
const labelList& pointMap,
const labelList& faceMap, const labelList& faceMap,
const labelList& cellMap, const labelList& cellMap,
@ -909,11 +991,13 @@ void Foam::fvMeshDistribute::subsetBoundaryData
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourcePatch, const labelList& sourcePatch,
const labelList& sourceNewNbrProc, const labelList& sourceNewNbrProc,
const labelList& sourcePointMaster,
labelList& subFace, labelList& subFace,
labelList& subProc, labelList& subProc,
labelList& subPatch, labelList& subPatch,
labelList& subNewNbrProc labelList& subNewNbrProc,
labelList& subPointMaster
) )
{ {
subFace.setSize(mesh.nFaces() - mesh.nInternalFaces()); subFace.setSize(mesh.nFaces() - mesh.nInternalFaces());
@ -959,6 +1043,9 @@ void Foam::fvMeshDistribute::subsetBoundaryData
subNewNbrProc[newBFacei] = sourceNewNbrProc[oldBFacei]; subNewNbrProc[newBFacei] = sourceNewNbrProc[oldBFacei];
} }
} }
subPointMaster = UIndirectList<label>(sourcePointMaster, pointMap);
} }
@ -1042,9 +1129,9 @@ Foam::labelList Foam::fvMeshDistribute::mapBoundaryData
( (
const primitiveMesh& mesh, // mesh after adding const primitiveMesh& mesh, // mesh after adding
const mapAddedPolyMesh& map, const mapAddedPolyMesh& map,
const labelList& boundaryData0, // mesh before adding const labelList& boundaryData0, // on mesh before adding
const label nInternalFaces1, const label nInternalFaces1,
const labelList& boundaryData1 // added mesh const labelList& boundaryData1 // on added mesh
) )
{ {
labelList newBoundaryData(mesh.nFaces() - mesh.nInternalFaces()); labelList newBoundaryData(mesh.nFaces() - mesh.nInternalFaces());
@ -1076,6 +1163,41 @@ Foam::labelList Foam::fvMeshDistribute::mapBoundaryData
} }
Foam::labelList Foam::fvMeshDistribute::mapPointData
(
const primitiveMesh& mesh, // mesh after adding
const mapAddedPolyMesh& map,
const labelList& boundaryData0, // on mesh before adding
const labelList& boundaryData1 // on added mesh
)
{
labelList newBoundaryData(mesh.nPoints());
forAll(boundaryData0, oldPointi)
{
label newPointi = map.oldPointMap()[oldPointi];
// Point still exists (is necessary?)
if (newPointi >= 0)
{
newBoundaryData[newPointi] = boundaryData0[oldPointi];
}
}
forAll(boundaryData1, addedPointi)
{
label newPointi = map.addedPointMap()[addedPointi];
if (newPointi >= 0)
{
newBoundaryData[newPointi] = boundaryData1[addedPointi];
}
}
return newBoundaryData;
}
// Remove cells. Add all exposed faces to patch oldInternalPatchi // Remove cells. Add all exposed faces to patch oldInternalPatchi
Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::doRemoveCells Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::doRemoveCells
( (
@ -1297,6 +1419,7 @@ void Foam::fvMeshDistribute::sendMesh
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourcePatch, const labelList& sourcePatch,
const labelList& sourceNewNbrProc, const labelList& sourceNewNbrProc,
const labelList& sourcePointMaster,
Ostream& toDomain Ostream& toDomain
) )
{ {
@ -1433,7 +1556,8 @@ void Foam::fvMeshDistribute::sendMesh
<< sourceFace << sourceFace
<< sourceProc << sourceProc
<< sourcePatch << sourcePatch
<< sourceNewNbrProc; << sourceNewNbrProc
<< sourcePointMaster;
if (debug) if (debug)
@ -1456,6 +1580,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
labelList& domainSourceProc, labelList& domainSourceProc,
labelList& domainSourcePatch, labelList& domainSourcePatch,
labelList& domainSourceNewNbrProc, labelList& domainSourceNewNbrProc,
labelList& domainSourcePointMaster,
Istream& fromNbr Istream& fromNbr
) )
{ {
@ -1474,7 +1599,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
>> domainSourceFace >> domainSourceFace
>> domainSourceProc >> domainSourceProc
>> domainSourcePatch >> domainSourcePatch
>> domainSourceNewNbrProc; >> domainSourceNewNbrProc
>> domainSourcePointMaster;
// Construct fvMesh // Construct fvMesh
auto domainMeshPtr = autoPtr<fvMesh>::New auto domainMeshPtr = autoPtr<fvMesh>::New
@ -1709,13 +1835,15 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
labelList sourceFace; labelList sourceFace;
labelList sourceProc; labelList sourceProc;
labelList sourceNewNbrProc; labelList sourceNewNbrProc;
getNeighbourData labelList sourcePointMaster;
getCouplingData
( (
distribution, distribution,
sourceFace, sourceFace,
sourceProc, sourceProc,
sourcePatch, sourcePatch,
sourceNewNbrProc sourceNewNbrProc,
sourcePointMaster
); );
@ -1924,11 +2052,13 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
labelList procSourceProc; labelList procSourceProc;
labelList procSourcePatch; labelList procSourcePatch;
labelList procSourceNewNbrProc; labelList procSourceNewNbrProc;
labelList procSourcePointMaster;
subsetBoundaryData subsetCouplingData
( (
subsetter.subMesh(), subsetter.subMesh(),
subsetter.faceMap(), // from subMesh to mesh subsetter.pointMap(), // from subMesh to mesh
subsetter.faceMap(), // ,, ,,
subsetter.cellMap(), // ,, ,, subsetter.cellMap(), // ,, ,,
distribution, // old mesh distribution distribution, // old mesh distribution
@ -1940,15 +2070,16 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
sourceProc, sourceProc,
sourcePatch, sourcePatch,
sourceNewNbrProc, sourceNewNbrProc,
sourcePointMaster,
procSourceFace, procSourceFace,
procSourceProc, procSourceProc,
procSourcePatch, procSourcePatch,
procSourceNewNbrProc procSourceNewNbrProc,
procSourcePointMaster
); );
// Send to neighbour // Send to neighbour
sendMesh sendMesh
( (
@ -1963,6 +2094,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
procSourceProc, procSourceProc,
procSourcePatch, procSourcePatch,
procSourceNewNbrProc, procSourceNewNbrProc,
procSourcePointMaster,
str str
); );
@ -2121,10 +2254,12 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
labelList domainSourceProc; labelList domainSourceProc;
labelList domainSourcePatch; labelList domainSourcePatch;
labelList domainSourceNewNbrProc; labelList domainSourceNewNbrProc;
labelList domainSourcePointMaster;
subsetBoundaryData subsetCouplingData
( (
mesh_, // new mesh mesh_, // new mesh
subMap().pointMap(), // from new to original mesh
subMap().faceMap(), // from new to original mesh subMap().faceMap(), // from new to original mesh
subMap().cellMap(), subMap().cellMap(),
@ -2137,17 +2272,20 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
sourceProc, sourceProc,
sourcePatch, sourcePatch,
sourceNewNbrProc, sourceNewNbrProc,
sourcePointMaster,
domainSourceFace, domainSourceFace,
domainSourceProc, domainSourceProc,
domainSourcePatch, domainSourcePatch,
domainSourceNewNbrProc domainSourceNewNbrProc,
domainSourcePointMaster
); );
sourceFace.transfer(domainSourceFace); sourceFace.transfer(domainSourceFace);
sourceProc.transfer(domainSourceProc); sourceProc.transfer(domainSourceProc);
sourcePatch.transfer(domainSourcePatch); sourcePatch.transfer(domainSourcePatch);
sourceNewNbrProc.transfer(domainSourceNewNbrProc); sourceNewNbrProc.transfer(domainSourceNewNbrProc);
sourcePointMaster.transfer(domainSourcePointMaster);
} }
@ -2205,6 +2343,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
labelList domainSourceProc; labelList domainSourceProc;
labelList domainSourcePatch; labelList domainSourcePatch;
labelList domainSourceNewNbrProc; labelList domainSourceNewNbrProc;
labelList domainSourcePointMaster;
autoPtr<fvMesh> domainMeshPtr; autoPtr<fvMesh> domainMeshPtr;
@ -2241,6 +2380,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
domainSourceProc, domainSourceProc,
domainSourcePatch, domainSourcePatch,
domainSourceNewNbrProc, domainSourceNewNbrProc,
domainSourcePointMaster,
str str
); );
fvMesh& domainMesh = domainMeshPtr(); fvMesh& domainMesh = domainMeshPtr();
@ -2508,6 +2648,15 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
domainMesh.nInternalFaces(), domainMesh.nInternalFaces(),
domainSourceNewNbrProc domainSourceNewNbrProc
); );
// Update pointMaster data
sourcePointMaster = mapPointData
(
mesh_,
map(),
sourcePointMaster,
domainSourcePointMaster
);
// Update all addressing so xxProcAddressing points to correct // Update all addressing so xxProcAddressing points to correct
// item in masterMesh. // item in masterMesh.
@ -2621,6 +2770,10 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
} }
// See if any originally shared points need to be merged. Note: does
// parallel comms. After this points and edges should again be consistent.
mergeSharedPoints(sourcePointMaster, constructPointMap);
// Add processorPatches // Add processorPatches
// ~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~
@ -2650,16 +2803,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
// Change patches. Since this might change ordering of coupled faces // Change patches. Since this might change ordering of coupled faces
// we also need to adapt our constructMaps. // we also need to adapt our constructMaps.
// NOTE: there is one very particular problem with this structure.
// We first create the processor patches and use these to merge out
// shared points (see mergeSharedPoints below). So temporarily points
// and edges do not match!
repatch(newPatchID, constructFaceMap); repatch(newPatchID, constructFaceMap);
// See if any geometrically shared points need to be merged. Note: does
// parallel comms. After this points and edges should again be consistent.
mergeSharedPoints(constructPointMap);
// Bit of hack: processorFvPatchField does not get reset since created // Bit of hack: processorFvPatchField does not get reset since created
// from nothing so explicitly reset. // from nothing so explicitly reset.
initPatchFields<volScalarField, processorFvPatchField<scalar>> initPatchFields<volScalarField, processorFvPatchField<scalar>>

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -163,11 +163,11 @@ class fvMeshDistribute
labelListList& constructFaceMap labelListList& constructFaceMap
); );
//- Merge any shared points that are geometrically shared. Needs //- Merge any local points that were remotely coupled.
// parallel valid mesh - uses globalMeshData.
// constructPointMap is adapted for the new point labels. // constructPointMap is adapted for the new point labels.
autoPtr<mapPolyMesh> mergeSharedPoints autoPtr<mapPolyMesh> mergeSharedPoints
( (
const labelList& pointToGlobalMaster,
labelListList& constructPointMap labelListList& constructPointMap
); );
@ -175,19 +175,21 @@ class fvMeshDistribute
// Coupling information // Coupling information
//- Construct the local environment of all boundary faces. //- Construct the local environment of all boundary faces.
void getNeighbourData void getCouplingData
( (
const labelList& distribution, const labelList& distribution,
labelList& sourceFace, labelList& sourceFace,
labelList& sourceProc, labelList& sourceProc,
labelList& sourcePatch, labelList& sourcePatch,
labelList& sourceNewProc labelList& sourceNewProc,
labelList& sourcePointMaster
) const; ) const;
// Subset the neighbourCell/neighbourProc fields // Subset the neighbourCell/neighbourProc fields
static void subsetBoundaryData static void subsetCouplingData
( (
const fvMesh& mesh, const fvMesh& mesh,
const labelList& pointMap,
const labelList& faceMap, const labelList& faceMap,
const labelList& cellMap, const labelList& cellMap,
@ -200,11 +202,13 @@ class fvMeshDistribute
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourcePatch, const labelList& sourcePatch,
const labelList& sourceNewProc, const labelList& sourceNewProc,
const labelList& sourcePointMaster,
labelList& subFace, labelList& subFace,
labelList& subProc, labelList& subProc,
labelList& subPatch, labelList& subPatch,
labelList& subNewProc labelList& subNewProc,
labelList& subPointMaster
); );
//- Find cells on mesh whose faceID/procID match the neighbour //- Find cells on mesh whose faceID/procID match the neighbour
@ -237,6 +241,14 @@ class fvMeshDistribute
const labelList& boundaryData1 // added mesh const labelList& boundaryData1 // added mesh
); );
//- Map point data to new mesh (resulting from adding two meshes)
static labelList mapPointData
(
const primitiveMesh& mesh, // mesh after adding
const mapAddedPolyMesh& map,
const labelList& boundaryData0, // on mesh before adding
const labelList& boundaryData1 // on added mesh
);
// Other // Other
@ -276,6 +288,7 @@ class fvMeshDistribute
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourcePatch, const labelList& sourcePatch,
const labelList& sourceNewProc, const labelList& sourceNewProc,
const labelList& sourcePointMaster,
Ostream& toDomain Ostream& toDomain
); );
//- Send subset of fields //- Send subset of fields
@ -300,6 +313,7 @@ class fvMeshDistribute
labelList& domainSourceProc, labelList& domainSourceProc,
labelList& domainSourcePatch, labelList& domainSourcePatch,
labelList& domainSourceNewProc, labelList& domainSourceNewProc,
labelList& domainSourcePointMaster,
Istream& fromNbr Istream& fromNbr
); );

View File

@ -75,7 +75,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
dict.lookupOrDefault dict.lookupOrDefault
( (
"axis", "axis",
patch().size() returnReduce(patch().size(), maxOp<label>())
? -gSum(patch().Sf())/gSum(patch().magSf()) ? -gSum(patch().Sf())/gSum(patch().magSf())
: Zero : Zero
) )
@ -145,48 +145,53 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
{ {
return; return;
} }
const scalar t = this->db().time().timeOutputValue();
const scalar flowRate = flowRate_->value(t);
const scalar rpm = rpm_->value(t);
const scalar totArea = gSum(patch().magSf()); const scalar totArea = gSum(patch().magSf());
const scalar avgU = -flowRate/totArea;
const vector axisHat = axis_/mag(axis_); if (totArea > ROOTVSMALL && axis_ != vector(Zero))
// Update angular velocity - convert [rpm] to [rad/s]
tmp<vectorField> tangentialVelocity
(
axisHat ^ (rpm*constant::mathematical::pi/30.0)*(patch().Cf() - origin_)
);
tmp<vectorField> n = patch().nf();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
if (phi.dimensions() == dimVelocity*dimArea)
{ {
// volumetric flow-rate const scalar t = this->db().time().timeOutputValue();
operator==(tangentialVelocity + n*avgU); const scalar flowRate = flowRate_->value(t);
} const scalar rpm = rpm_->value(t);
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate const scalar avgU = -flowRate/totArea;
operator==(tangentialVelocity + n*avgU/rhop);
} const vector axisHat = axis_/mag(axis_);
else
{ // Update angular velocity - convert [rpm] to [rad/s]
FatalErrorInFunction tmp<vectorField> tangentialVelocity
<< "dimensions of " << phiName_ << " are incorrect" << nl (
<< " on patch " << this->patch().name() axisHat
<< " of field " << this->internalField().name() ^(rpm*constant::mathematical::pi/30.0)
<< " in file " << this->internalField().objectPath() *(patch().Cf() - origin_)
<< nl << exit(FatalError); );
tmp<vectorField> n = patch().nf();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
if (phi.dimensions() == dimVelocity*dimArea)
{
// volumetric flow-rate
operator==(tangentialVelocity + n*avgU);
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate
operator==(tangentialVelocity + n*avgU/rhop);
}
else
{
FatalErrorInFunction
<< "dimensions of " << phiName_ << " are incorrect" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< nl << exit(FatalError);
}
} }
fixedValueFvPatchField<vector>::updateCoeffs(); fixedValueFvPatchField<vector>::updateCoeffs();

View File

@ -261,7 +261,7 @@ EulerDdtScheme<Type>::fvcDdt
new GeometricField<Type, fvPatchField, volMesh> new GeometricField<Type, fvPatchField, volMesh>
( (
ddtIOobject, ddtIOobject,
rDeltaT.value()* rDeltaT*
( (
alpha() alpha()
*rho() *rho()

View File

@ -61,7 +61,8 @@ Foam::functionObjects::turbulenceFields::compressibleFieldNames_
{ compressibleField::cfAlphaEff, "alphaEff" }, { compressibleField::cfAlphaEff, "alphaEff" },
{ compressibleField::cfR, "R" }, { compressibleField::cfR, "R" },
{ compressibleField::cfDevRhoReff, "devRhoReff" }, { compressibleField::cfDevRhoReff, "devRhoReff" },
{ compressibleField::cfL, "L" } { compressibleField::cfL, "L" },
{ compressibleField::cfI, "I" }
}; };
@ -80,6 +81,7 @@ Foam::functionObjects::turbulenceFields::incompressibleFieldNames_
{ incompressibleField::ifR, "R" }, { incompressibleField::ifR, "R" },
{ incompressibleField::ifDevReff, "devReff" }, { incompressibleField::ifDevReff, "devReff" },
{ incompressibleField::ifL, "L" }, { incompressibleField::ifL, "L" },
{ incompressibleField::ifI, "I" }
}; };
@ -236,6 +238,11 @@ bool Foam::functionObjects::turbulenceFields::execute()
processField<scalar>(f, L(model)); processField<scalar>(f, L(model));
break; break;
} }
case cfI:
{
processField<scalar>(f, I(model));
break;
}
default: default:
{ {
FatalErrorInFunction FatalErrorInFunction
@ -298,6 +305,11 @@ bool Foam::functionObjects::turbulenceFields::execute()
processField<scalar>(f, L(model)); processField<scalar>(f, L(model));
break; break;
} }
case ifI:
{
processField<scalar>(f, I(model));
break;
}
default: default:
{ {
FatalErrorInFunction FatalErrorInFunction

View File

@ -76,6 +76,7 @@ Usage
devReff | Deviatoric part of the effective Reynolds stress devReff | Deviatoric part of the effective Reynolds stress
devRhoReff | Divergence of the Reynolds stress devRhoReff | Divergence of the Reynolds stress
L | turbulence length scale L | turbulence length scale
I | turbulence intensity
\endplaintable \endplaintable
See also See also
@ -125,7 +126,8 @@ public:
cfAlphaEff, cfAlphaEff,
cfR, cfR,
cfDevRhoReff, cfDevRhoReff,
cfL cfL,
cfI
}; };
static const Enum<compressibleField> compressibleFieldNames_; static const Enum<compressibleField> compressibleFieldNames_;
@ -139,7 +141,8 @@ public:
ifNuEff, ifNuEff,
ifR, ifR,
ifDevReff, ifDevReff,
ifL ifL,
ifI
}; };
static const Enum<incompressibleField> incompressibleFieldNames_; static const Enum<incompressibleField> incompressibleFieldNames_;
@ -179,6 +182,10 @@ protected:
template<class Model> template<class Model>
tmp<volScalarField> L(const Model& model) const; tmp<volScalarField> L(const Model& model) const;
//- Return I calculated from k and U
template<class Model>
tmp<volScalarField> I(const Model& model) const;
private: private:

View File

@ -85,19 +85,16 @@ Foam::functionObjects::turbulenceFields::omega
const volScalarField k(model.k()); const volScalarField k(model.k());
const volScalarField epsilon(model.epsilon()); const volScalarField epsilon(model.epsilon());
return tmp<volScalarField> return tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "omega.tmp",
( k.mesh().time().timeName(),
"omega.tmp", k.mesh()
k.mesh().time().timeName(), ),
k.mesh() epsilon/(Cmu*k),
), epsilon.boundaryField().types()
epsilon/(Cmu*k),
epsilon.boundaryField().types()
)
); );
} }
@ -109,9 +106,10 @@ Foam::functionObjects::turbulenceFields::nuTilda
const Model& model const Model& model
) const ) const
{ {
return tmp<volScalarField> return tmp<volScalarField>::New
( (
new volScalarField("nuTilda.tmp", model.k()/omega(model)) "nuTilda.tmp",
model.k()/omega(model)
); );
} }
@ -130,15 +128,30 @@ Foam::functionObjects::turbulenceFields::L
const volScalarField epsilon(model.epsilon()); const volScalarField epsilon(model.epsilon());
const dimensionedScalar eps0("eps0", epsilon.dimensions(), SMALL); const dimensionedScalar eps0("eps0", epsilon.dimensions(), SMALL);
return tmp<volScalarField> return tmp<volScalarField>::New
( (
new volScalarField "L.tmp",
( pow(Cmu, 0.75)*pow(k, 1.5)/(epsilon + eps0)
"L.tmp",
pow(Cmu, 0.75)*pow(k, 1.5)/(epsilon + eps0)
)
); );
} }
template<class Model>
Foam::tmp<Foam::volScalarField>
Foam::functionObjects::turbulenceFields::I
(
const Model& model
) const
{
// Assume k is available
const volScalarField uPrime(sqrt((2.0/3.0)*model.k()));
const dimensionedScalar U0("U0", dimVelocity, SMALL);
return tmp<volScalarField>::New
(
"I.tmp",
uPrime/max(max(uPrime, mag(model.U())), U0)
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -353,7 +353,7 @@ Foam::functionObjects::forces::devRhoReff() const
const dictionary& transportProperties = const dictionary& transportProperties =
lookupObject<dictionary>("transportProperties"); lookupObject<dictionary>("transportProperties");
dimensionedScalar nu(transportProperties.lookup("nu")); dimensionedScalar nu("nu", dimViscosity, transportProperties);
const volVectorField& U = lookupObject<volVectorField>(UName_); const volVectorField& U = lookupObject<volVectorField>(UName_);

View File

@ -108,6 +108,7 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
// //
dict.readIfPresent("directory", dirName_); dict.readIfPresent("directory", dirName_);
decompose_ = dict.lookupOrDefault("decompose", false);
writeIds_ = dict.lookupOrDefault("writeIds", false); writeIds_ = dict.lookupOrDefault("writeIds", false);
@ -185,7 +186,7 @@ bool Foam::functionObjects::vtkWrite::write()
( (
mesh_, mesh_,
writeOpts_, writeOpts_,
true // decompose decompose_
); );
// Write mesh // Write mesh

View File

@ -44,6 +44,7 @@ Description
writeInterval 1; writeInterval 1;
format binary; format binary;
legacy false; legacy false;
decompose false;
... ...
fields (U p); fields (U p);
} }
@ -51,14 +52,15 @@ Description
Usage Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default
type | Type name: vtkWrite | yes | type | Type name: vtkWrite | yes |
fields | Fields to output | yes | fields | Fields to output | yes |
writeControl | Output control | recommended | timeStep writeControl | Output control | recommended | timeStep
directory | The output directory name | no | "VTK" directory | The output directory name | no | "VTK"
format | ASCII or binary format | no | binary format | ASCII or binary format | no | binary
legacy | Legacy VTK output | no | false legacy | Legacy VTK output | no | false
writeIds | Write cell ids as field | no | true decompose | decompose polyhedra | no | false
writeIds | Write cell ids as field | no | true
\endtable \endtable
See also See also
@ -106,6 +108,9 @@ class vtkWrite
//- Output directory name //- Output directory name
fileName dirName_; fileName dirName_;
//- Decompose polyhedra
bool decompose_;
//- Write cell ids field //- Write cell ids field
bool writeIds_; bool writeIds_;
@ -119,7 +124,11 @@ class vtkWrite
//- Write selected fields for GeoField type. //- Write selected fields for GeoField type.
template<class GeoField> template<class GeoField>
label writeFields(vtk::internalWriter& writer, bool verbose=true) const; label writeFields
(
vtk::internalWriter& writer,
bool verbose=true
) const;
//- Write selected fields for GeoField type. //- Write selected fields for GeoField type.
@ -131,10 +140,10 @@ class vtkWrite
) const; ) const;
//- Disallow default bitwise copy construct //- No copy construct
vtkWrite(const vtkWrite&) = delete; vtkWrite(const vtkWrite&) = delete;
//- Disallow default bitwise assignment //- No copy assignment
void operator=(const vtkWrite&) = delete; void operator=(const vtkWrite&) = delete;
@ -150,7 +159,7 @@ public:
vtkWrite vtkWrite
( (
const word& name, const word& name,
const Time& t, const Time& runTime,
const dictionary& dict const dictionary& dict
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,6 +34,7 @@ License
#include "ParticleErosion.H" #include "ParticleErosion.H"
#include "ParticleTracks.H" #include "ParticleTracks.H"
#include "ParticleTrap.H" #include "ParticleTrap.H"
#include "PatchCollisionDensity.H"
#include "PatchPostProcessing.H" #include "PatchPostProcessing.H"
#include "VoidFraction.H" #include "VoidFraction.H"
@ -48,6 +49,7 @@ License
makeCloudFunctionObjectType(ParticleErosion, CloudType); \ makeCloudFunctionObjectType(ParticleErosion, CloudType); \
makeCloudFunctionObjectType(ParticleTracks, CloudType); \ makeCloudFunctionObjectType(ParticleTracks, CloudType); \
makeCloudFunctionObjectType(ParticleTrap, CloudType); \ makeCloudFunctionObjectType(ParticleTrap, CloudType); \
makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \
makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \
makeCloudFunctionObjectType(VoidFraction, CloudType); makeCloudFunctionObjectType(VoidFraction, CloudType);

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 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 "PatchCollisionDensity.H"
#include "Pstream.H"
#include "stringListOps.H"
#include "ListOps.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::PatchCollisionDensity<CloudType>::write()
{
const scalarField z(this->owner().mesh().nCells(), 0);
volScalarField
(
IOobject
(
this->owner().name() + ":collisionDensity",
this->owner().mesh().time().timeName(),
this->owner().mesh()
),
this->owner().mesh(),
dimless/dimArea,
z,
collisionDensity_
)
.write();
volScalarField
(
IOobject
(
this->owner().name() + ":collisionDensityRate",
this->owner().mesh().time().timeName(),
this->owner().mesh()
),
this->owner().mesh(),
dimless/dimArea/dimTime,
z,
(collisionDensity_ - collisionDensity0_)
/(this->owner().mesh().time().value() - time0_)
)
.write();
collisionDensity0_ == collisionDensity_;
time0_ = this->owner().mesh().time().value();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PatchCollisionDensity<CloudType>::PatchCollisionDensity
(
const dictionary& dict,
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
minSpeed_(dict.lookupOrDefault<scalar>("minSpeed", -1)),
collisionDensity_
(
this->owner().mesh().boundary(),
volScalarField::Internal::null(),
calculatedFvPatchField<scalar>::typeName
),
collisionDensity0_
(
this->owner().mesh().boundary(),
volScalarField::Internal::null(),
calculatedFvPatchField<scalar>::typeName
),
time0_(this->owner().mesh().time().value())
{
collisionDensity_ == 0;
collisionDensity0_ == 0;
IOobject io
(
this->owner().name() + ":collisionDensity",
this->owner().mesh().time().timeName(),
this->owner().mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.typeHeaderOk<volScalarField>())
{
const volScalarField collisionDensity(io, this->owner().mesh());
collisionDensity_ == collisionDensity.boundaryField();
collisionDensity0_ == collisionDensity.boundaryField();
}
}
template<class CloudType>
Foam::PatchCollisionDensity<CloudType>::PatchCollisionDensity
(
const PatchCollisionDensity<CloudType>& ppm
)
:
CloudFunctionObject<CloudType>(ppm),
minSpeed_(ppm.minSpeed_),
collisionDensity_(ppm.collisionDensity_),
collisionDensity0_(ppm.collisionDensity0_),
time0_(ppm.time0_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PatchCollisionDensity<CloudType>::~PatchCollisionDensity()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::PatchCollisionDensity<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp,
bool&
)
{
const label patchi = pp.index();
const label patchFacei = p.face() - pp.start();
vector nw, Up;
this->owner().patchData(p, pp, nw, Up);
const scalar speed = (p.U() - Up) & nw;
if (speed > minSpeed_)
{
collisionDensity_[patchi][patchFacei] +=
1/this->owner().mesh().magSf().boundaryField()[patchi][patchFacei];
}
}
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 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::PatchCollisionDensity
Description
Function object which generates fields of the number and rate of collisions
per unit area on all patches. Can optionally take a minimum speed below
which a collision is not counted.
Example usage:
\verbatim
patchCollisionDensity1
{
type patchCollisionDensity;
minSpeed 1e-3;
}
\endverbatim
SourceFiles
PatchCollisionDensity.C
\*---------------------------------------------------------------------------*/
#ifndef PatchCollisionDensity_H
#define PatchCollisionDensity_H
#include "CloudFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class PatchCollisionDensity Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class PatchCollisionDensity
:
public CloudFunctionObject<CloudType>
{
// Private data
typedef typename CloudType::particleType parcelType;
//- The threshold for a collision
const scalar minSpeed_;
//- The field of the number of collisions per unit area
volScalarField::Boundary collisionDensity_;
//- The field of the number of collisions per unit area at the last
// output
volScalarField::Boundary collisionDensity0_;
//- The time at the last output
scalar time0_;
protected:
// Protected Member Functions
//- Write post-processing info
void write();
public:
//- Runtime type information
TypeName("patchCollisionDensity");
// Constructors
//- Construct from dictionary
PatchCollisionDensity
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
PatchCollisionDensity(const PatchCollisionDensity<CloudType>& ppm);
//- Construct and return a clone
virtual autoPtr<CloudFunctionObject<CloudType>> clone() const
{
return autoPtr<CloudFunctionObject<CloudType>>
(
new PatchCollisionDensity<CloudType>(*this)
);
}
//- Destructor
virtual ~PatchCollisionDensity();
// Member Functions
// Evaluation
//- Post-patch hook
virtual void postPatch
(
const parcelType& p,
const polyPatch& pp,
bool& keepParticle
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "PatchCollisionDensity.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -250,7 +250,7 @@ void Foam::lumpedPointDisplacementPointPatchVectorField::updateCoeffs()
if (Pstream::master()) if (Pstream::master())
{ {
movement().writeData(forces, moments); movement().writeData(forces, moments, &(db().time()));
// Signal external source to execute // Signal external source to execute
movement().coupler().useSlave(); movement().coupler().useSlave();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,29 +48,65 @@ Foam::lumpedPointMovement::formatNames
}; };
const Foam::Enum
<
Foam::lumpedPointMovement::scalingType
>
Foam::lumpedPointMovement::scalingNames
{
{ scalingType::LENGTH, "plain" },
{ scalingType::FORCE, "force" },
{ scalingType::MOMENT, "moment" }
};
const Foam::word const Foam::word
Foam::lumpedPointMovement::dictionaryName("lumpedPointMovement"); Foam::lumpedPointMovement::dictionaryName("lumpedPointMovement");
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
//! \cond fileScope
//- Space-separated vector value (ASCII)
static inline Ostream& putPlain(Ostream& os, const vector& val)
{
os << val.x() << ' ' << val.y() << ' ' << val.z();
return os;
}
//! \cond fileScope
//- Space-separated vector value (ASCII)
static inline Ostream& putTime(Ostream& os, const Time& t)
{
os <<"Time index=" << t.timeIndex()
<< " value=" << t.timeOutputValue();
return os;
}
//! \cond fileScope //! \cond fileScope
//- Write list content with size, bracket, content, bracket one-per-line. //- Write list content with size, bracket, content, bracket one-per-line.
// This makes for consistent for parsing, regardless of the list length. // This makes for consistent for parsing, regardless of the list length.
template <class T> template <class T>
static void writeList(Ostream& os, const string& header, const UList<T>& lst) static void writeList(Ostream& os, const string& header, const UList<T>& list)
{ {
const label len = list.size();
// Header string // Header string
os << header.c_str() << nl; os << header.c_str() << nl;
// Write size and start delimiter // Write size and start delimiter
os << lst.size() << nl os << len << nl << token::BEGIN_LIST << nl;
<< token::BEGIN_LIST << nl;
// Write contents // Write contents
forAll(lst, i) for (label i=0; i < len; ++i)
{ {
os << lst[i] << nl; os << list[i] << nl;
} }
// Write end delimiter // Write end delimiter
@ -165,8 +201,11 @@ Foam::lumpedPointMovement::lumpedPointMovement()
coupler_(), coupler_(),
inputName_("positions.in"), inputName_("positions.in"),
outputName_("forces.out"), outputName_("forces.out"),
logName_("movement.log"),
inputFormat_(lumpedPointState::inputFormatType::DICTIONARY), inputFormat_(lumpedPointState::inputFormatType::DICTIONARY),
outputFormat_(outputFormatType::DICTIONARY), outputFormat_(outputFormatType::DICTIONARY),
scaleInput_(-1.0),
scaleOutput_(-1.0),
state0_(), state0_(),
state_(), state_(),
thresholdPtr_(0), thresholdPtr_(0),
@ -198,6 +237,11 @@ Foam::lumpedPointMovement::lumpedPointMovement
autoCentre_(true), autoCentre_(true),
forcesDict_(), forcesDict_(),
coupler_(), coupler_(),
inputName_("positions.in"),
outputName_("forces.out"),
logName_("movement.log"),
scaleInput_(-1.0),
scaleOutput_(-1.0),
state0_(), state0_(),
state_(), state_(),
thresholdPtr_(0), thresholdPtr_(0),
@ -262,6 +306,7 @@ void Foam::lumpedPointMovement::readDict(const dictionary& dict)
commDict.lookup("inputName") >> inputName_; commDict.lookup("inputName") >> inputName_;
commDict.lookup("outputName") >> outputName_; commDict.lookup("outputName") >> outputName_;
commDict.readIfPresent("logName", logName_);
inputFormat_ = lumpedPointState::formatNames.lookup inputFormat_ = lumpedPointState::formatNames.lookup
( (
@ -274,6 +319,47 @@ void Foam::lumpedPointMovement::readDict(const dictionary& dict)
"outputFormat", "outputFormat",
commDict commDict
); );
scaleInput_ = -1;
scaleOutput_ = -1;
const dictionary* scaleDict = nullptr;
if ((scaleDict = commDict.subDictPtr("scaleInput")))
{
for (int i=0; i < scaleInput_.size(); ++i)
{
const word& key = scalingNames[scalingType(i)];
if
(
scaleDict->readIfPresent(key, scaleInput_[i])
&& scaleInput_[i] > 0
)
{
Info<<"Using input " << key << " multiplier: "
<< scaleInput_[i] << nl;
}
}
}
if ((scaleDict = commDict.subDictPtr("scaleOutput")))
{
for (int i=0; i < scaleOutput_.size(); ++i)
{
const word& key = scalingNames[scalingType(i)];
if
(
scaleDict->readIfPresent(key, scaleOutput_[i])
&& scaleOutput_[i] > 0
)
{
Info<<"Using output " << key << " multiplier: "
<< scaleOutput_[i] << nl;
}
}
}
} }
@ -638,6 +724,8 @@ bool Foam::lumpedPointMovement::readState()
coupler().resolveFile(inputName_) coupler().resolveFile(inputName_)
); );
state_.scalePoints(scaleInput_[scalingType::LENGTH]);
state_.relax(relax_, prev); state_.relax(relax_, prev);
return status; return status;
@ -646,45 +734,114 @@ bool Foam::lumpedPointMovement::readState()
bool Foam::lumpedPointMovement::writeData bool Foam::lumpedPointMovement::writeData
( (
const UList<vector>& forces Ostream& os,
const UList<vector>& forces,
const UList<vector>& moments,
const outputFormatType fmt,
const Time* timeinfo
) const ) const
{ {
if (!Pstream::master()) const bool writeMoments = (moments.size() == forces.size());
if (fmt == outputFormatType::PLAIN)
{ {
return false; os <<"########" << nl;
} if (timeinfo)
const fileName output(coupler().resolveFile(outputName_));
OFstream os(output); // ASCII
if (outputFormat_ == outputFormatType::PLAIN)
{
os <<"# output from OpenFOAM" << nl
<<"# N, points, forces" << nl
<< this->size() << nl;
const char* zeroVector = "0 0 0";
forAll(locations_, i)
{ {
const vector pos = locations_[i] * axis_; os <<"# ";
putTime(os, *timeinfo) << nl;
}
os <<"# size=" << this->size() << nl
<<"# columns (points) (forces)";
os << pos.x() << ' ' if (writeMoments)
<< pos.y() << ' ' {
<< pos.z() << ' '; os << " (moments)";
}
if (i < forces.size()) os << nl;
bool report = false;
scalar scaleLength = scaleOutput_[scalingType::LENGTH];
scalar scaleForce = scaleOutput_[scalingType::FORCE];
scalar scaleMoment = scaleOutput_[scalingType::MOMENT];
if (scaleLength > 0)
{
report = true;
}
else
{
scaleLength = 1.0;
}
if (scaleForce > 0)
{
report = true;
}
else
{
scaleForce = 1.0;
}
if (writeMoments)
{
if (scaleMoment > 0)
{ {
os << forces[i].x() << ' ' report = true;
<< forces[i].y() << ' '
<< forces[i].z();
} }
else else
{ {
os << zeroVector; scaleMoment = 1.0;
}
}
if (report)
{
os <<"# scaling points=" << scaleLength
<<" forces=" << scaleForce;
if (writeMoments)
{
os <<" moments=" << scaleMoment;
} }
os << nl; os << nl;
}
os <<"########" << nl;
forAll(locations_, i)
{
const vector pos = scaleLength * (locations_[i] * axis_);
putPlain(os, pos) << ' ';
if (i < forces.size())
{
const vector val(scaleForce * forces[i]);
putPlain(os, val);
}
else
{
putPlain(os, vector::zero);
}
if (writeMoments)
{
os << ' ';
if (i < moments.size())
{
const vector val(scaleMoment * moments[i]);
putPlain(os, val);
}
else
{
putPlain(os, vector::zero);
}
}
os << nl;
} }
} }
else else
@ -693,10 +850,21 @@ bool Foam::lumpedPointMovement::writeData
// - exclude the usual OpenFOAM 'FoamFile' header // - exclude the usual OpenFOAM 'FoamFile' header
// - ensure lists have consistent format // - ensure lists have consistent format
os <<"// output from OpenFOAM" << nl << nl; os <<"////////" << nl;
if (timeinfo)
{
os <<"// ";
putTime(os, *timeinfo) << nl;
}
os << nl;
writeList(os, "points", (locations_*axis_)()); writeList(os, "points", (locations_*axis_)());
writeList(os, "forces", forces); writeList(os, "forces", forces);
if (writeMoments)
{
writeList(os, "moments", moments);
}
} }
return true; return true;
@ -706,7 +874,8 @@ bool Foam::lumpedPointMovement::writeData
bool Foam::lumpedPointMovement::writeData bool Foam::lumpedPointMovement::writeData
( (
const UList<vector>& forces, const UList<vector>& forces,
const UList<vector>& moments const UList<vector>& moments,
const Time* timeinfo
) const ) const
{ {
if (!Pstream::master()) if (!Pstream::master())
@ -714,60 +883,28 @@ bool Foam::lumpedPointMovement::writeData
return false; return false;
} }
const fileName output(coupler().resolveFile(outputName_)); // Regular output
OFstream os(output); // ASCII
if (outputFormat_ == outputFormatType::PLAIN)
{ {
os <<"# output from OpenFOAM" << nl const fileName output(coupler().resolveFile(outputName_));
<<"# N, points, forces, moments" << nl OFstream os(output, IOstream::ASCII);
<< this->size() << nl;
const char* zeroVector = "0 0 0"; writeData(os, forces, moments, outputFormat_, timeinfo);
forAll(locations_, i)
{
const vector pos = locations_[i] * axis_;
os << pos.x() << ' '
<< pos.y() << ' '
<< pos.z() << ' ';
if (i < forces.size())
{
os << forces[i].x() << ' '
<< forces[i].y() << ' '
<< forces[i].z() << ' ';
}
else
{
os << zeroVector << ' ';
}
if (i < moments.size())
{
os << moments[i].x() << ' '
<< moments[i].y() << ' '
<< moments[i].z();
}
else
{
os << zeroVector;
}
os << nl;
}
} }
else
// Log output
{ {
// Make it easier for external programs to parse const fileName output(coupler().resolveFile(logName_));
// - exclude the usual OpenFOAM 'FoamFile' header
// - ensure lists have consistent format
os <<"// output from OpenFOAM" << nl << nl; OFstream os
(
output,
IOstream::ASCII,
IOstream::currentVersion,
IOstream::UNCOMPRESSED,
true // append mode
);
writeList(os, "points", (locations_*axis_)()); writeData(os, forces, moments, outputFormatType::PLAIN, timeinfo);
writeList(os, "forces", forces);
writeList(os, "moments", moments);
} }
return true; return true;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,8 +60,10 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class polyMesh; class polyMesh;
class Time;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class lumpedPointMovement Declaration Class lumpedPointMovement Declaration
@ -78,11 +80,22 @@ public:
DICTIONARY DICTIONARY
}; };
//- Output format types
enum scalingType
{
LENGTH = 0,
FORCE,
MOMENT
};
// Static data // Static data
//- Names for the output format types //- Names for the output format types
static const Enum<outputFormatType> formatNames; static const Enum<outputFormatType> formatNames;
//- Names for the scaling types
static const Enum<scalingType> scalingNames;
private: private:
@ -125,9 +138,15 @@ private:
//- File io //- File io
word inputName_; word inputName_;
word outputName_; word outputName_;
word logName_;
lumpedPointState::inputFormatType inputFormat_; lumpedPointState::inputFormatType inputFormat_;
outputFormatType outputFormat_; outputFormatType outputFormat_;
//- Optional scale factors for input/output files
FixedList<scalar, 1> scaleInput_;
FixedList<scalar, 3> scaleOutput_;
// Demand-driven private data // Demand-driven private data
@ -246,6 +265,9 @@ public:
//- The output (forces) file name //- The output (forces) file name
inline const word& outputName() const; inline const word& outputName() const;
//- The log file name
inline const word& logName() const;
//- The input (state) file format //- The input (state) file format
inline lumpedPointState::inputFormatType inputFormat() const; inline lumpedPointState::inputFormatType inputFormat() const;
@ -324,21 +346,24 @@ public:
//- Write axis, locations, division as a dictionary //- Write axis, locations, division as a dictionary
void writeDict(Ostream& os) const; void writeDict(Ostream& os) const;
//- Write points, forces, moments. Only call from the master process
//- Write points, forces
bool writeData bool writeData
( (
const UList<vector>& forces Ostream& os,
const UList<vector>& forces,
const UList<vector>& moments,
const outputFormatType fmt = outputFormatType::PLAIN,
const Time* timeinfo = nullptr
) const; ) const;
//- Write points, forces, moments //- Write points, forces, moments
bool writeData bool writeData
( (
const UList<vector>& forces, const UList<vector>& forces,
const UList<vector>& moments const UList<vector>& moments = List<vector>(),
const Time* timeinfo = nullptr
) const; ) const;
//- Read state from file, applying relaxation as requested //- Read state from file, applying relaxation as requested
bool readState(); bool readState();

View File

@ -0,0 +1,100 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object lumpedPointMovement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Reference axis for the locations
axis (0 0 1);
// Locations of the lumped points
locations 11(0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5);
// Division for pressure forces (0-1)
division 0.5;
//- If present, the offset of patch points compared to the locations
// Otherwise determined from the bounding box
// centre (0 0 0);
//- The interpolation scheme
interpolationScheme linear;
//- Relaxation/scaling factor when updating positions
relax 1.0;
forces
{
//- The pressure name (default: p)
p p;
//- Reference pressure [Pa] (default: 0)
pRef 0;
//- Reference density for incompressible calculations (default: 1)
rhoRef 1;
}
communication
{
commsDir "comms";
log on;
waitInterval 1;
timeOut 100;
initByExternal false;
// Input file of positions/rotation, written by external application
inputName positions.in;
// Output file of forces, written by OpenFOAM
outputName forces.out;
// Log of points/forces/moments during the simulation
logName movement.log;
inputFormat dictionary;
outputFormat dictionary;
debugTable "$FOAM_CASE/output.txt";
// Scaling applied to values read from 'inputName'
scaleInput
{
//- Length multiplier (to metres). Eg 0.001 for [mm] -> [m]
length 1;
}
// Scaling applied to values written to 'outputName'
scaleOutput
{
//- Length multiplier (from metres). Eg 1000 for [m] -> [mm]
length 1;
//- Force units multiplier (from Pa)
force 1;
//- Moment units multiplier (from N.m)
moment 1;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -133,6 +133,12 @@ inline const Foam::word& Foam::lumpedPointMovement::outputName() const
} }
inline const Foam::word& Foam::lumpedPointMovement::logName() const
{
return logName_;
}
inline Foam::lumpedPointState::inputFormatType inline Foam::lumpedPointState::inputFormatType
Foam::lumpedPointMovement::inputFormat() const Foam::lumpedPointMovement::inputFormat() const
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -94,8 +94,8 @@ void Foam::lumpedPointState::readDict(const dictionary& dict)
Foam::lumpedPointState::lumpedPointState() Foam::lumpedPointState::lumpedPointState()
: :
points_(0), points_(),
angles_(0), angles_(),
degrees_(false), degrees_(false),
rotationPtr_(nullptr) rotationPtr_(nullptr)
{} {}
@ -110,10 +110,7 @@ Foam::lumpedPointState::lumpedPointState(const lumpedPointState& rhs)
{} {}
Foam::lumpedPointState::lumpedPointState Foam::lumpedPointState::lumpedPointState(const pointField& pts)
(
const pointField& pts
)
: :
points_(pts), points_(pts),
angles_(points_.size(), Zero), angles_(points_.size(), Zero),
@ -122,10 +119,7 @@ Foam::lumpedPointState::lumpedPointState
{} {}
Foam::lumpedPointState::lumpedPointState Foam::lumpedPointState::lumpedPointState(tmp<pointField>& pts)
(
tmp<pointField>& pts
)
: :
points_(pts), points_(pts),
angles_(points_.size(), Zero), angles_(points_.size(), Zero),
@ -134,13 +128,10 @@ Foam::lumpedPointState::lumpedPointState
{} {}
Foam::lumpedPointState::lumpedPointState Foam::lumpedPointState::lumpedPointState(const dictionary& dict)
(
const dictionary& dict
)
: :
points_(0), points_(),
angles_(0), angles_(),
degrees_(false), degrees_(false),
rotationPtr_(nullptr) rotationPtr_(nullptr)
{ {
@ -168,6 +159,15 @@ void Foam::lumpedPointState::operator=(const lumpedPointState& rhs)
} }
void Foam::lumpedPointState::scalePoints(const scalar scaleFactor)
{
if (scaleFactor > 0)
{
points_ *= scaleFactor;
}
}
void Foam::lumpedPointState::relax void Foam::lumpedPointState::relax
( (
const scalar alpha, const scalar alpha,
@ -273,19 +273,17 @@ void Foam::lumpedPointState::writePlain(Ostream& os) const
{ {
const vector& pt = points_[i]; const vector& pt = points_[i];
os << pt.x() << ' ' os << pt.x() << ' ' << pt.y() << ' ' << pt.z();
<< pt.y() << ' '
<< pt.z() << ' ';
if (i < angles_.size()) if (i < angles_.size())
{ {
os << angles_[i].x() << ' ' os << ' ' << angles_[i].x()
<< angles_[i].y() << ' ' << ' ' << angles_[i].y()
<< angles_[i].z() << '\n'; << ' ' << angles_[i].z() << '\n';
} }
else else
{ {
os << "0 0 0\n"; os << " 0 0 0\n";
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -143,13 +143,16 @@ public:
//- The local-to-global transformation for each point //- The local-to-global transformation for each point
inline const tensorField& rotations() const; inline const tensorField& rotations() const;
//- Scale points by given factor.
// Zero and negative values are ignored.
void scalePoints(const scalar scaleFactor);
//- Relax the state //- Relax the state
// alpha = 1 : no relaxation // alpha = 1 : no relaxation
// alpha < 1 : relaxation // alpha < 1 : relaxation
// alpha = 0 : do nothing // alpha = 0 : do nothing
void relax(const scalar alpha, const lumpedPointState& prev); void relax(const scalar alpha, const lumpedPointState& prev);
//- Read input as dictionary content //- Read input as dictionary content
bool readData(Istream& is); bool readData(Istream& is);

View File

@ -170,6 +170,8 @@ $(faceSources)/boundaryToFace/boundaryToFace.C
$(faceSources)/zoneToFace/zoneToFace.C $(faceSources)/zoneToFace/zoneToFace.C
$(faceSources)/boxToFace/boxToFace.C $(faceSources)/boxToFace/boxToFace.C
$(faceSources)/regionToFace/regionToFace.C $(faceSources)/regionToFace/regionToFace.C
$(faceSources)/cylinderToFace/cylinderToFace.C
$(faceSources)/cylinderAnnulusToFace/cylinderAnnulusToFace.C
pointSources = sets/pointSources pointSources = sets/pointSources
$(pointSources)/labelToPoint/labelToPoint.C $(pointSources)/labelToPoint/labelToPoint.C

View File

@ -54,7 +54,7 @@ namespace Foam
void Foam::cylindrical::init void Foam::cylindrical::init
( (
const objectRegistry& obr, const objectRegistry& obr,
const List<label>& cells const labelUList& cells
) )
{ {
const polyMesh& mesh = refCast<const polyMesh>(obr); const polyMesh& mesh = refCast<const polyMesh>(obr);
@ -196,7 +196,7 @@ void Foam::cylindrical::updateCells
forAll(cells, i) forAll(cells, i)
{ {
label celli = cells[i]; const label celli = cells[i];
vector dir = cc[celli] - origin_; vector dir = cc[celli] - origin_;
dir /= mag(dir) + VSMALL; dir /= mag(dir) + VSMALL;

View File

@ -52,6 +52,7 @@ SourceFiles
#include "point.H" #include "point.H"
#include "vector.H" #include "vector.H"
#include "ListOps.H"
#include "coordinateRotation.H" #include "coordinateRotation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,7 +86,7 @@ class cylindrical
void init void init
( (
const objectRegistry& obr, const objectRegistry& obr,
const List<label>& cells = List<label>() const labelUList& cells = Foam::emptyLabelList
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "boxToCell.H" #include "boxToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(boxToCell, 0);
defineTypeNameAndDebug(boxToCell, 0); addToRunTimeSelectionTable(topoSetSource, boxToCell, word);
addToRunTimeSelectionTable(topoSetSource, boxToCell, istream);
addToRunTimeSelectionTable(topoSetSource, boxToCell, word);
addToRunTimeSelectionTable(topoSetSource, boxToCell, istream);
} }
@ -72,7 +67,6 @@ void Foam::boxToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::boxToCell::boxToCell Foam::boxToCell::boxToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -84,7 +78,6 @@ Foam::boxToCell::boxToCell
{} {}
// Construct from dictionary
Foam::boxToCell::boxToCell Foam::boxToCell::boxToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -101,7 +94,6 @@ Foam::boxToCell::boxToCell
{} {}
// Construct from Istream
Foam::boxToCell::boxToCell Foam::boxToCell::boxToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -112,6 +104,7 @@ Foam::boxToCell::boxToCell
bbs_(1, treeBoundBox(checkIs(is))) bbs_(1, treeBoundBox(checkIs(is)))
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::boxToCell::~boxToCell() Foam::boxToCell::~boxToCell()

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,13 +51,11 @@ class boxToCell
: :
public topoSetSource public topoSetSource
{ {
// Private data // Private data
//- Add usage string //- Add usage string
static addToUsageTable usage_; static addToUsageTable usage_;
//- Bounding box. //- Bounding box.
treeBoundBoxList bbs_; treeBoundBoxList bbs_;
@ -112,7 +110,6 @@ public:
const topoSetSource::setAction action, const topoSetSource::setAction action,
topoSet& topoSet&
) const; ) const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "cellToCell.H" #include "cellToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "cellSet.H" #include "cellSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(cellToCell, 0);
defineTypeNameAndDebug(cellToCell, 0); addToRunTimeSelectionTable(topoSetSource, cellToCell, word);
addToRunTimeSelectionTable(topoSetSource, cellToCell, istream);
addToRunTimeSelectionTable(topoSetSource, cellToCell, word);
addToRunTimeSelectionTable(topoSetSource, cellToCell, istream);
} }
@ -53,7 +48,6 @@ Foam::topoSetSource::addToUsageTable Foam::cellToCell::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::cellToCell::cellToCell Foam::cellToCell::cellToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -65,7 +59,6 @@ Foam::cellToCell::cellToCell
{} {}
// Construct from dictionary
Foam::cellToCell::cellToCell Foam::cellToCell::cellToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -77,7 +70,6 @@ Foam::cellToCell::cellToCell
{} {}
// Construct from Istream
Foam::cellToCell::cellToCell Foam::cellToCell::cellToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -107,7 +107,6 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
{} {}
// Construct from Istream
Foam::cylinderAnnulusToCell::cylinderAnnulusToCell Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -102,7 +102,6 @@ Foam::cylinderToCell::cylinderToCell
{} {}
// Construct from Istream
Foam::cylinderToCell::cylinderToCell Foam::cylinderToCell::cylinderToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,7 +26,6 @@ License
#include "faceToCell.H" #include "faceToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "faceSet.H" #include "faceSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -148,7 +147,6 @@ void Foam::faceToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::faceToCell::faceToCell Foam::faceToCell::faceToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -162,7 +160,6 @@ Foam::faceToCell::faceToCell
{} {}
// Construct from dictionary
Foam::faceToCell::faceToCell Foam::faceToCell::faceToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -175,7 +172,6 @@ Foam::faceToCell::faceToCell
{} {}
// Construct from Istream
Foam::faceToCell::faceToCell Foam::faceToCell::faceToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -25,7 +25,6 @@ License
#include "faceZoneToCell.H" #include "faceZoneToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -105,7 +104,6 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::faceZoneToCell::faceZoneToCell Foam::faceZoneToCell::faceZoneToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -119,7 +117,6 @@ Foam::faceZoneToCell::faceZoneToCell
{} {}
// Construct from dictionary
Foam::faceZoneToCell::faceZoneToCell Foam::faceZoneToCell::faceZoneToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -132,7 +129,6 @@ Foam::faceZoneToCell::faceZoneToCell
{} {}
// Construct from Istream
Foam::faceZoneToCell::faceZoneToCell Foam::faceZoneToCell::faceZoneToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -93,7 +93,6 @@ void Foam::fieldToCell::applyToSet
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::fieldToCell::fieldToCell Foam::fieldToCell::fieldToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -109,7 +108,6 @@ Foam::fieldToCell::fieldToCell
{} {}
// Construct from dictionary
Foam::fieldToCell::fieldToCell Foam::fieldToCell::fieldToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -123,7 +121,6 @@ Foam::fieldToCell::fieldToCell
{} {}
// Construct from Istream
Foam::fieldToCell::fieldToCell Foam::fieldToCell::fieldToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -151,34 +148,6 @@ void Foam::fieldToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
// // Construct temporary fvMesh from polyMesh
// fvMesh fMesh
// (
// mesh(), // IOobject
// mesh().points(),
// mesh().faces(),
// mesh().cells()
// );
//
// const polyBoundaryMesh& patches = mesh().boundaryMesh();
//
// List<polyPatch*> newPatches(patches.size());
// forAll(patches, patchi)
// {
// const polyPatch& pp = patches[patchi];
//
// newPatches[patchi] =
// patches[patchi].clone
// (
// fMesh.boundaryMesh(),
// patchi,
// pp.size(),
// pp.start()
// ).ptr();
// }
// fMesh.addFvPatches(newPatches);
// Try to load field // Try to load field
IOobject fieldObject IOobject fieldObject
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "labelToCell.H" #include "labelToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(labelToCell, 0);
defineTypeNameAndDebug(labelToCell, 0); addToRunTimeSelectionTable(topoSetSource, labelToCell, word);
addToRunTimeSelectionTable(topoSetSource, labelToCell, istream);
addToRunTimeSelectionTable(topoSetSource, labelToCell, word);
addToRunTimeSelectionTable(topoSetSource, labelToCell, istream);
} }
@ -63,7 +58,6 @@ void Foam::labelToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::labelToCell::labelToCell Foam::labelToCell::labelToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -75,7 +69,6 @@ Foam::labelToCell::labelToCell
{} {}
// Construct from dictionary
Foam::labelToCell::labelToCell Foam::labelToCell::labelToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -87,7 +80,6 @@ Foam::labelToCell::labelToCell
{} {}
// Construct from Istream
Foam::labelToCell::labelToCell Foam::labelToCell::labelToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "nbrToCell.H" #include "nbrToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(nbrToCell, 0);
defineTypeNameAndDebug(nbrToCell, 0); addToRunTimeSelectionTable(topoSetSource, nbrToCell, word);
addToRunTimeSelectionTable(topoSetSource, nbrToCell, istream);
addToRunTimeSelectionTable(topoSetSource, nbrToCell, word);
addToRunTimeSelectionTable(topoSetSource, nbrToCell, istream);
} }
@ -104,7 +99,6 @@ void Foam::nbrToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::nbrToCell::nbrToCell Foam::nbrToCell::nbrToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -116,7 +110,6 @@ Foam::nbrToCell::nbrToCell
{} {}
// Construct from dictionary
Foam::nbrToCell::nbrToCell Foam::nbrToCell::nbrToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -128,7 +121,6 @@ Foam::nbrToCell::nbrToCell
{} {}
// Construct from Istream
Foam::nbrToCell::nbrToCell Foam::nbrToCell::nbrToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -32,13 +32,9 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(nearestToCell, 0);
defineTypeNameAndDebug(nearestToCell, 0); addToRunTimeSelectionTable(topoSetSource, nearestToCell, word);
addToRunTimeSelectionTable(topoSetSource, nearestToCell, istream);
addToRunTimeSelectionTable(topoSetSource, nearestToCell, word);
addToRunTimeSelectionTable(topoSetSource, nearestToCell, istream);
} }
@ -84,7 +80,6 @@ void Foam::nearestToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::nearestToCell::nearestToCell Foam::nearestToCell::nearestToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -96,7 +91,6 @@ Foam::nearestToCell::nearestToCell
{} {}
// Construct from dictionary
Foam::nearestToCell::nearestToCell Foam::nearestToCell::nearestToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -108,7 +102,6 @@ Foam::nearestToCell::nearestToCell
{} {}
// Construct from Istream
Foam::nearestToCell::nearestToCell Foam::nearestToCell::nearestToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,7 +26,6 @@ License
#include "pointToCell.H" #include "pointToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "pointSet.H" #include "pointSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -105,7 +104,6 @@ void Foam::pointToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::pointToCell::pointToCell Foam::pointToCell::pointToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -119,7 +117,6 @@ Foam::pointToCell::pointToCell
{} {}
// Construct from dictionary
Foam::pointToCell::pointToCell Foam::pointToCell::pointToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -132,7 +129,6 @@ Foam::pointToCell::pointToCell
{} {}
// Construct from Istream
Foam::pointToCell::pointToCell Foam::pointToCell::pointToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,13 +34,9 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(regionToCell, 0);
defineTypeNameAndDebug(regionToCell, 0); addToRunTimeSelectionTable(topoSetSource, regionToCell, word);
addToRunTimeSelectionTable(topoSetSource, regionToCell, istream);
addToRunTimeSelectionTable(topoSetSource, regionToCell, word);
addToRunTimeSelectionTable(topoSetSource, regionToCell, istream);
} }
@ -90,11 +86,7 @@ void Foam::regionToCell::markRegionFaces
{ {
label facei = pp.start()+i; label facei = pp.start()+i;
label bFacei = facei-mesh_.nInternalFaces(); label bFacei = facei-mesh_.nInternalFaces();
if if (selectedCell[faceCells[i]] != nbrSelected[bFacei])
(
selectedCell[faceCells[i]]
!= selectedCell[nbrSelected[bFacei]]
)
{ {
regionFace[facei] = true; regionFace[facei] = true;
} }
@ -385,7 +377,6 @@ void Foam::regionToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::regionToCell::regionToCell Foam::regionToCell::regionToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -401,7 +392,6 @@ Foam::regionToCell::regionToCell
{} {}
// Construct from dictionary
Foam::regionToCell::regionToCell Foam::regionToCell::regionToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -420,7 +410,6 @@ Foam::regionToCell::regionToCell
{} {}
// Construct from Istream
Foam::regionToCell::regionToCell Foam::regionToCell::regionToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "rotatedBoxToCell.H" #include "rotatedBoxToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "cellModel.H" #include "cellModel.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(rotatedBoxToCell, 0);
defineTypeNameAndDebug(rotatedBoxToCell, 0); addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, word);
addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, istream);
addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, word);
addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, istream);
} }
@ -117,7 +112,6 @@ void Foam::rotatedBoxToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::rotatedBoxToCell::rotatedBoxToCell Foam::rotatedBoxToCell::rotatedBoxToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -135,7 +129,6 @@ Foam::rotatedBoxToCell::rotatedBoxToCell
{} {}
// Construct from dictionary
Foam::rotatedBoxToCell::rotatedBoxToCell Foam::rotatedBoxToCell::rotatedBoxToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -150,7 +143,6 @@ Foam::rotatedBoxToCell::rotatedBoxToCell
{} {}
// Construct from Istream
Foam::rotatedBoxToCell::rotatedBoxToCell(const polyMesh& mesh, Istream& is) Foam::rotatedBoxToCell::rotatedBoxToCell(const polyMesh& mesh, Istream& is)
: :
topoSetSource(mesh), topoSetSource(mesh),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,20 +28,15 @@ License
#include "unitConversion.H" #include "unitConversion.H"
#include "hexMatcher.H" #include "hexMatcher.H"
#include "cellFeatures.H" #include "cellFeatures.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(shapeToCell, 0);
defineTypeNameAndDebug(shapeToCell, 0); addToRunTimeSelectionTable(topoSetSource, shapeToCell, word);
addToRunTimeSelectionTable(topoSetSource, shapeToCell, istream);
addToRunTimeSelectionTable(topoSetSource, shapeToCell, word);
addToRunTimeSelectionTable(topoSetSource, shapeToCell, istream);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -91,7 +91,6 @@ Foam::sphereToCell::sphereToCell
{} {}
// Construct from Istream
Foam::sphereToCell::sphereToCell Foam::sphereToCell::sphereToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,20 +28,15 @@ License
#include "globalMeshData.H" #include "globalMeshData.H"
#include "plane.H" #include "plane.H"
#include "cellSet.H" #include "cellSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(targetVolumeToCell, 0);
defineTypeNameAndDebug(targetVolumeToCell, 0); addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, word);
addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, istream);
addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, word);
addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, istream);
} }
@ -269,7 +264,6 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::targetVolumeToCell::targetVolumeToCell Foam::targetVolumeToCell::targetVolumeToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -283,7 +277,6 @@ Foam::targetVolumeToCell::targetVolumeToCell
{} {}
// Construct from dictionary
Foam::targetVolumeToCell::targetVolumeToCell Foam::targetVolumeToCell::targetVolumeToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -297,7 +290,6 @@ Foam::targetVolumeToCell::targetVolumeToCell
{} {}
// Construct from Istream
Foam::targetVolumeToCell::targetVolumeToCell Foam::targetVolumeToCell::targetVolumeToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "zoneToCell.H" #include "zoneToCell.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(zoneToCell, 0);
defineTypeNameAndDebug(zoneToCell, 0); addToRunTimeSelectionTable(topoSetSource, zoneToCell, word);
addToRunTimeSelectionTable(topoSetSource, zoneToCell, istream);
addToRunTimeSelectionTable(topoSetSource, zoneToCell, word);
addToRunTimeSelectionTable(topoSetSource, zoneToCell, istream);
} }
@ -92,7 +87,6 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::zoneToCell::zoneToCell Foam::zoneToCell::zoneToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -104,7 +98,6 @@ Foam::zoneToCell::zoneToCell
{} {}
// Construct from dictionary
Foam::zoneToCell::zoneToCell Foam::zoneToCell::zoneToCell
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -116,7 +109,6 @@ Foam::zoneToCell::zoneToCell
{} {}
// Construct from Istream
Foam::zoneToCell::zoneToCell Foam::zoneToCell::zoneToCell
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "setToCellZone.H" #include "setToCellZone.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "cellZoneSet.H" #include "cellZoneSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(setToCellZone, 0);
defineTypeNameAndDebug(setToCellZone, 0); addToRunTimeSelectionTable(topoSetSource, setToCellZone, word);
addToRunTimeSelectionTable(topoSetSource, setToCellZone, istream);
addToRunTimeSelectionTable(topoSetSource, setToCellZone, word);
addToRunTimeSelectionTable(topoSetSource, setToCellZone, istream);
} }
@ -53,7 +48,6 @@ Foam::topoSetSource::addToUsageTable Foam::setToCellZone::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setToCellZone::setToCellZone Foam::setToCellZone::setToCellZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -65,7 +59,6 @@ Foam::setToCellZone::setToCellZone
{} {}
// Construct from dictionary
Foam::setToCellZone::setToCellZone Foam::setToCellZone::setToCellZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -77,7 +70,6 @@ Foam::setToCellZone::setToCellZone
{} {}
// Construct from Istream
Foam::setToCellZone::setToCellZone Foam::setToCellZone::setToCellZone
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "boundaryToFace.H" #include "boundaryToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(boundaryToFace, 0);
defineTypeNameAndDebug(boundaryToFace, 0); addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
} }
@ -68,21 +63,18 @@ void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh) Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh)
: :
topoSetSource(mesh) topoSetSource(mesh)
{} {}
// Construct from dictionary
Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh, const dictionary&) Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh, const dictionary&)
: :
topoSetSource(mesh) topoSetSource(mesh)
{} {}
// Construct from Istream
Foam::boundaryToFace::boundaryToFace Foam::boundaryToFace::boundaryToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "boxToFace.H" #include "boxToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(boxToFace, 0);
defineTypeNameAndDebug(boxToFace, 0); addToRunTimeSelectionTable(topoSetSource, boxToFace, word);
addToRunTimeSelectionTable(topoSetSource, boxToFace, istream);
addToRunTimeSelectionTable(topoSetSource, boxToFace, word);
addToRunTimeSelectionTable(topoSetSource, boxToFace, istream);
} }
@ -72,7 +67,6 @@ void Foam::boxToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::boxToFace::boxToFace Foam::boxToFace::boxToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -84,7 +78,6 @@ Foam::boxToFace::boxToFace
{} {}
// Construct from dictionary
Foam::boxToFace::boxToFace Foam::boxToFace::boxToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -101,7 +94,6 @@ Foam::boxToFace::boxToFace
{} {}
// Construct from Istream
Foam::boxToFace::boxToFace Foam::boxToFace::boxToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,6 @@ class boxToFace
: :
public topoSetSource public topoSetSource
{ {
// Private data // Private data
//- Add usage string //- Add usage string
@ -111,7 +110,6 @@ public:
const topoSetSource::setAction action, const topoSetSource::setAction action,
topoSet& topoSet&
) const; ) const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "cylinderAnnulusToFace.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cylinderAnnulusToFace, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, word);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, istream);
}
Foam::topoSetSource::addToUsageTable Foam::cylinderAnnulusToFace::usage_
(
cylinderAnnulusToFace::typeName,
"\n Usage: cylinderAnnulusToFace (p1X p1Y p1Z) (p2X p2Y p2Z)"
" outerRadius innerRadius\n\n"
" Select all faces with face centre within bounding cylinder annulus\n\n"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::cylinderAnnulusToFace::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const scalar orad2 = sqr(outerRadius_);
const scalar irad2 = sqr(innerRadius_);
const scalar magAxis2 = magSqr(axis);
const pointField& ctrs = mesh_.faceCentres();
forAll(ctrs, facei)
{
vector d = ctrs[facei] - p1_;
scalar magD = d & axis;
if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
if ((d2 < orad2) && (d2 > irad2))
{
addOrDelete(set, facei, add);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar outerRadius,
const scalar innerRadius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
outerRadius_(outerRadius),
innerRadius_(innerRadius)
{}
Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
outerRadius_(readScalar(dict.lookup("outerRadius"))),
innerRadius_(readScalar(dict.lookup("innerRadius")))
{}
Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
outerRadius_(readScalar(checkIs(is))),
innerRadius_(readScalar(checkIs(is)))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cylinderAnnulusToFace::~cylinderAnnulusToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylinderAnnulusToFace::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding faces with centre within cylinder annulus,"
<< " with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius = " << innerRadius_
<< endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing faces with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius " << innerRadius_
<< endl;
combine(set, false);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::cylinderAnnulusToFace
Description
A topoSetSource to select faces based on face centres inside a
cylinder annulus.
SourceFiles
cylinderAnnulusToFace.C
\*---------------------------------------------------------------------------*/
#ifndef cylinderAnnulusToFace_H
#define cylinderAnnulusToFace_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cylinderAnnulusToFace Declaration
\*---------------------------------------------------------------------------*/
class cylinderAnnulusToFace
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- First point on cylinder axis
vector p1_;
//- Second point on cylinder axis
vector p2_;
//- Outer Radius
scalar outerRadius_;
//- Inner Radius
scalar innerRadius_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("cylinderAnnulusToFace");
// Constructors
//- Construct from components
cylinderAnnulusToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar outerRadius,
const scalar innerRadius
);
//- Construct from dictionary
cylinderAnnulusToFace
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
cylinderAnnulusToFace
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~cylinderAnnulusToFace();
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "cylinderToFace.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cylinderToFace, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderToFace, word);
addToRunTimeSelectionTable(topoSetSource, cylinderToFace, istream);
}
Foam::topoSetSource::addToUsageTable Foam::cylinderToFace::usage_
(
cylinderToFace::typeName,
"\n Usage: cylinderToFace (p1X p1Y p1Z) (p2X p2Y p2Z) radius\n\n"
" Select all faces with face centre within bounding cylinder\n\n"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::cylinderToFace::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const scalar rad2 = sqr(radius_);
const scalar magAxis2 = magSqr(axis);
const pointField& ctrs = mesh_.faceCentres();
forAll(ctrs, facei)
{
vector d = ctrs[facei] - p1_;
scalar magD = d & axis;
if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
if (d2 < rad2)
{
addOrDelete(set, facei, add);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cylinderToFace::cylinderToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar radius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
radius_(radius)
{}
Foam::cylinderToFace::cylinderToFace
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
radius_(readScalar(dict.lookup("radius")))
{}
Foam::cylinderToFace::cylinderToFace
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
radius_(readScalar(checkIs(is)))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cylinderToFace::~cylinderToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylinderToFace::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding faces with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing faces with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
combine(set, false);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::cylinderToFace
Description
A topoSetSource to select faces based on face centres inside a cylinder.
SourceFiles
cylinderToFace.C
\*---------------------------------------------------------------------------*/
#ifndef cylinderToFace_H
#define cylinderToFace_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cylinderToFace Declaration
\*---------------------------------------------------------------------------*/
class cylinderToFace
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- First point on cylinder axis
vector p1_;
//- Second point on cylinder axis
vector p2_;
//- Radius
scalar radius_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("cylinderToFace");
// Constructors
//- Construct from components
cylinderToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar radius
);
//- Construct from dictionary
cylinderToFace
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
cylinderToFace
(
const polyMesh& mesh,
Istream&
);
//- Destructor
virtual ~cylinderToFace();
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "faceToFace.H" #include "faceToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "faceSet.H" #include "faceSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(faceToFace, 0);
defineTypeNameAndDebug(faceToFace, 0); addToRunTimeSelectionTable(topoSetSource, faceToFace, word);
addToRunTimeSelectionTable(topoSetSource, faceToFace, istream);
addToRunTimeSelectionTable(topoSetSource, faceToFace, word);
addToRunTimeSelectionTable(topoSetSource, faceToFace, istream);
} }
@ -53,7 +48,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceToFace::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::faceToFace::faceToFace Foam::faceToFace::faceToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -65,7 +59,6 @@ Foam::faceToFace::faceToFace
{} {}
// Construct from dictionary
Foam::faceToFace::faceToFace Foam::faceToFace::faceToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -77,7 +70,6 @@ Foam::faceToFace::faceToFace
{} {}
// Construct from Istream
Foam::faceToFace::faceToFace Foam::faceToFace::faceToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "labelToFace.H" #include "labelToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(labelToFace, 0);
defineTypeNameAndDebug(labelToFace, 0); addToRunTimeSelectionTable(topoSetSource, labelToFace, word);
addToRunTimeSelectionTable(topoSetSource, labelToFace, istream);
addToRunTimeSelectionTable(topoSetSource, labelToFace, word);
addToRunTimeSelectionTable(topoSetSource, labelToFace, istream);
} }
@ -63,7 +58,6 @@ void Foam::labelToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::labelToFace::labelToFace Foam::labelToFace::labelToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -75,7 +69,6 @@ Foam::labelToFace::labelToFace
{} {}
// Construct from dictionary
Foam::labelToFace::labelToFace Foam::labelToFace::labelToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -87,7 +80,6 @@ Foam::labelToFace::labelToFace
{} {}
// Construct from Istream
Foam::labelToFace::labelToFace Foam::labelToFace::labelToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "normalToFace.H" #include "normalToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "faceSet.H" #include "faceSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(normalToFace, 0);
defineTypeNameAndDebug(normalToFace, 0); addToRunTimeSelectionTable(topoSetSource, normalToFace, word);
addToRunTimeSelectionTable(topoSetSource, normalToFace, istream);
addToRunTimeSelectionTable(topoSetSource, normalToFace, word);
addToRunTimeSelectionTable(topoSetSource, normalToFace, istream);
} }
@ -71,7 +66,6 @@ void Foam::normalToFace::setNormal()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::normalToFace::normalToFace Foam::normalToFace::normalToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -87,7 +81,6 @@ Foam::normalToFace::normalToFace
} }
// Construct from dictionary
Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict) Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
: :
topoSetSource(mesh), topoSetSource(mesh),
@ -98,7 +91,6 @@ Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
} }
// Construct from Istream
Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is) Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is)
: :
topoSetSource(mesh), topoSetSource(mesh),

View File

@ -25,20 +25,15 @@ License
#include "patchToFace.H" #include "patchToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(patchToFace, 0);
defineTypeNameAndDebug(patchToFace, 0); addToRunTimeSelectionTable(topoSetSource, patchToFace, word);
addToRunTimeSelectionTable(topoSetSource, patchToFace, istream);
addToRunTimeSelectionTable(topoSetSource, patchToFace, word);
addToRunTimeSelectionTable(topoSetSource, patchToFace, istream);
} }
@ -90,7 +85,6 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::patchToFace::patchToFace Foam::patchToFace::patchToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -102,7 +96,6 @@ Foam::patchToFace::patchToFace
{} {}
// Construct from dictionary
Foam::patchToFace::patchToFace Foam::patchToFace::patchToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -114,7 +107,6 @@ Foam::patchToFace::patchToFace
{} {}
// Construct from Istream
Foam::patchToFace::patchToFace Foam::patchToFace::patchToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,7 +26,6 @@ License
#include "pointToFace.H" #include "pointToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "pointSet.H" #include "pointSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -146,7 +145,6 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::pointToFace::pointToFace Foam::pointToFace::pointToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -160,7 +158,6 @@ Foam::pointToFace::pointToFace
{} {}
// Construct from dictionary
Foam::pointToFace::pointToFace Foam::pointToFace::pointToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -173,7 +170,6 @@ Foam::pointToFace::pointToFace
{} {}
// Construct from Istream
Foam::pointToFace::pointToFace Foam::pointToFace::pointToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,13 +37,9 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(regionToFace, 0);
defineTypeNameAndDebug(regionToFace, 0); addToRunTimeSelectionTable(topoSetSource, regionToFace, word);
addToRunTimeSelectionTable(topoSetSource, regionToFace, istream);
addToRunTimeSelectionTable(topoSetSource, regionToFace, word);
addToRunTimeSelectionTable(topoSetSource, regionToFace, istream);
} }
@ -176,7 +172,6 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::regionToFace::regionToFace Foam::regionToFace::regionToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -190,7 +185,6 @@ Foam::regionToFace::regionToFace
{} {}
// Construct from dictionary
Foam::regionToFace::regionToFace Foam::regionToFace::regionToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -203,7 +197,6 @@ Foam::regionToFace::regionToFace
{} {}
// Construct from Istream
Foam::regionToFace::regionToFace Foam::regionToFace::regionToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "zoneToFace.H" #include "zoneToFace.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(zoneToFace, 0);
defineTypeNameAndDebug(zoneToFace, 0); addToRunTimeSelectionTable(topoSetSource, zoneToFace, word);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, istream);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, word);
addToRunTimeSelectionTable(topoSetSource, zoneToFace, istream);
} }
@ -92,7 +87,6 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::zoneToFace::zoneToFace Foam::zoneToFace::zoneToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -104,7 +98,6 @@ Foam::zoneToFace::zoneToFace
{} {}
// Construct from dictionary
Foam::zoneToFace::zoneToFace Foam::zoneToFace::zoneToFace
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -116,7 +109,6 @@ Foam::zoneToFace::zoneToFace
{} {}
// Construct from Istream
Foam::zoneToFace::zoneToFace Foam::zoneToFace::zoneToFace
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "faceZoneToFaceZone.H" #include "faceZoneToFaceZone.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "faceZoneSet.H" #include "faceZoneSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(faceZoneToFaceZone, 0);
defineTypeNameAndDebug(faceZoneToFaceZone, 0); addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, istream);
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, istream);
} }
@ -53,7 +48,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceZoneToFaceZone::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::faceZoneToFaceZone::faceZoneToFaceZone Foam::faceZoneToFaceZone::faceZoneToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -65,7 +59,6 @@ Foam::faceZoneToFaceZone::faceZoneToFaceZone
{} {}
// Construct from dictionary
Foam::faceZoneToFaceZone::faceZoneToFaceZone Foam::faceZoneToFaceZone::faceZoneToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -77,7 +70,6 @@ Foam::faceZoneToFaceZone::faceZoneToFaceZone
{} {}
// Construct from Istream
Foam::faceZoneToFaceZone::faceZoneToFaceZone Foam::faceZoneToFaceZone::faceZoneToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,7 +57,6 @@ Foam::topoSetSource::addToUsageTable Foam::searchableSurfaceToFaceZone::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "setToFaceZone.H" #include "setToFaceZone.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "faceZoneSet.H" #include "faceZoneSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(setToFaceZone, 0);
defineTypeNameAndDebug(setToFaceZone, 0); addToRunTimeSelectionTable(topoSetSource, setToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, istream);
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, istream);
} }
@ -54,7 +49,6 @@ Foam::topoSetSource::addToUsageTable Foam::setToFaceZone::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setToFaceZone::setToFaceZone Foam::setToFaceZone::setToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -66,7 +60,6 @@ Foam::setToFaceZone::setToFaceZone
{} {}
// Construct from dictionary
Foam::setToFaceZone::setToFaceZone Foam::setToFaceZone::setToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -78,7 +71,6 @@ Foam::setToFaceZone::setToFaceZone
{} {}
// Construct from Istream
Foam::setToFaceZone::setToFaceZone Foam::setToFaceZone::setToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,6 @@ Foam::topoSetSource::addToUsageTable Foam::setsToFaceZone::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setsToFaceZone::setsToFaceZone Foam::setsToFaceZone::setsToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -67,7 +66,6 @@ Foam::setsToFaceZone::setsToFaceZone
{} {}
// Construct from dictionary
Foam::setsToFaceZone::setsToFaceZone Foam::setsToFaceZone::setsToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -81,7 +79,6 @@ Foam::setsToFaceZone::setsToFaceZone
{} {}
// Construct from Istream
Foam::setsToFaceZone::setsToFaceZone Foam::setsToFaceZone::setsToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "boxToPoint.H" #include "boxToPoint.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(boxToPoint, 0);
defineTypeNameAndDebug(boxToPoint, 0); addToRunTimeSelectionTable(topoSetSource, boxToPoint, word);
addToRunTimeSelectionTable(topoSetSource, boxToPoint, istream);
addToRunTimeSelectionTable(topoSetSource, boxToPoint, word);
addToRunTimeSelectionTable(topoSetSource, boxToPoint, istream);
} }
@ -71,7 +66,6 @@ void Foam::boxToPoint::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::boxToPoint::boxToPoint Foam::boxToPoint::boxToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -83,7 +77,6 @@ Foam::boxToPoint::boxToPoint
{} {}
// Construct from dictionary
Foam::boxToPoint::boxToPoint Foam::boxToPoint::boxToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -100,7 +93,6 @@ Foam::boxToPoint::boxToPoint
{} {}
// Construct from Istream
Foam::boxToPoint::boxToPoint Foam::boxToPoint::boxToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,7 +26,6 @@ License
#include "cellToPoint.H" #include "cellToPoint.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "cellSet.H" #include "cellSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -84,7 +83,6 @@ void Foam::cellToPoint::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::cellToPoint::cellToPoint Foam::cellToPoint::cellToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -98,7 +96,6 @@ Foam::cellToPoint::cellToPoint
{} {}
// Construct from dictionary
Foam::cellToPoint::cellToPoint Foam::cellToPoint::cellToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -111,7 +108,6 @@ Foam::cellToPoint::cellToPoint
{} {}
// Construct from Istream
Foam::cellToPoint::cellToPoint Foam::cellToPoint::cellToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,7 +26,6 @@ License
#include "faceToPoint.H" #include "faceToPoint.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "faceSet.H" #include "faceSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -77,7 +76,6 @@ void Foam::faceToPoint::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::faceToPoint::faceToPoint Foam::faceToPoint::faceToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -91,7 +89,6 @@ Foam::faceToPoint::faceToPoint
{} {}
// Construct from dictionary
Foam::faceToPoint::faceToPoint Foam::faceToPoint::faceToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -104,7 +101,6 @@ Foam::faceToPoint::faceToPoint
{} {}
// Construct from Istream
Foam::faceToPoint::faceToPoint Foam::faceToPoint::faceToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,20 +25,15 @@ License
#include "labelToPoint.H" #include "labelToPoint.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(labelToPoint, 0);
defineTypeNameAndDebug(labelToPoint, 0); addToRunTimeSelectionTable(topoSetSource, labelToPoint, word);
addToRunTimeSelectionTable(topoSetSource, labelToPoint, istream);
addToRunTimeSelectionTable(topoSetSource, labelToPoint, word);
addToRunTimeSelectionTable(topoSetSource, labelToPoint, istream);
} }
@ -63,7 +58,6 @@ void Foam::labelToPoint::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::labelToPoint::labelToPoint Foam::labelToPoint::labelToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -75,7 +69,6 @@ Foam::labelToPoint::labelToPoint
{} {}
// Construct from dictionary
Foam::labelToPoint::labelToPoint Foam::labelToPoint::labelToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -87,7 +80,6 @@ Foam::labelToPoint::labelToPoint
{} {}
// Construct from Istream
Foam::labelToPoint::labelToPoint Foam::labelToPoint::labelToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -32,13 +32,9 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(nearestToPoint, 0);
defineTypeNameAndDebug(nearestToPoint, 0); addToRunTimeSelectionTable(topoSetSource, nearestToPoint, word);
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, istream);
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, word);
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, istream);
} }
@ -104,7 +100,6 @@ void Foam::nearestToPoint::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::nearestToPoint::nearestToPoint Foam::nearestToPoint::nearestToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -116,7 +111,6 @@ Foam::nearestToPoint::nearestToPoint
{} {}
// Construct from dictionary
Foam::nearestToPoint::nearestToPoint Foam::nearestToPoint::nearestToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -128,7 +122,6 @@ Foam::nearestToPoint::nearestToPoint
{} {}
// Construct from Istream
Foam::nearestToPoint::nearestToPoint Foam::nearestToPoint::nearestToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "pointToPoint.H" #include "pointToPoint.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "pointSet.H" #include "pointSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(pointToPoint, 0);
defineTypeNameAndDebug(pointToPoint, 0); addToRunTimeSelectionTable(topoSetSource, pointToPoint, word);
addToRunTimeSelectionTable(topoSetSource, pointToPoint, istream);
addToRunTimeSelectionTable(topoSetSource, pointToPoint, word);
addToRunTimeSelectionTable(topoSetSource, pointToPoint, istream);
} }
@ -53,7 +48,6 @@ Foam::topoSetSource::addToUsageTable Foam::pointToPoint::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::pointToPoint::pointToPoint Foam::pointToPoint::pointToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -65,7 +59,6 @@ Foam::pointToPoint::pointToPoint
{} {}
// Construct from dictionary
Foam::pointToPoint::pointToPoint Foam::pointToPoint::pointToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -77,7 +70,6 @@ Foam::pointToPoint::pointToPoint
{} {}
// Construct from Istream
Foam::pointToPoint::pointToPoint Foam::pointToPoint::pointToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,13 +32,9 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(zoneToPoint, 0);
defineTypeNameAndDebug(zoneToPoint, 0); addToRunTimeSelectionTable(topoSetSource, zoneToPoint, word);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, istream);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, word);
addToRunTimeSelectionTable(topoSetSource, zoneToPoint, istream);
} }
@ -92,7 +88,6 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::zoneToPoint::zoneToPoint Foam::zoneToPoint::zoneToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -104,7 +99,6 @@ Foam::zoneToPoint::zoneToPoint
{} {}
// Construct from dictionary
Foam::zoneToPoint::zoneToPoint Foam::zoneToPoint::zoneToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -116,7 +110,6 @@ Foam::zoneToPoint::zoneToPoint
{} {}
// Construct from Istream
Foam::zoneToPoint::zoneToPoint Foam::zoneToPoint::zoneToPoint
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,20 +26,15 @@ License
#include "setToPointZone.H" #include "setToPointZone.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "pointZoneSet.H" #include "pointZoneSet.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(setToPointZone, 0);
defineTypeNameAndDebug(setToPointZone, 0); addToRunTimeSelectionTable(topoSetSource, setToPointZone, word);
addToRunTimeSelectionTable(topoSetSource, setToPointZone, istream);
addToRunTimeSelectionTable(topoSetSource, setToPointZone, word);
addToRunTimeSelectionTable(topoSetSource, setToPointZone, istream);
} }
@ -53,7 +48,6 @@ Foam::topoSetSource::addToUsageTable Foam::setToPointZone::usage_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setToPointZone::setToPointZone Foam::setToPointZone::setToPointZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -65,7 +59,6 @@ Foam::setToPointZone::setToPointZone
{} {}
// Construct from dictionary
Foam::setToPointZone::setToPointZone Foam::setToPointZone::setToPointZone
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -77,7 +70,6 @@ Foam::setToPointZone::setToPointZone
{} {}
// Construct from Istream
Foam::setToPointZone::setToPointZone Foam::setToPointZone::setToPointZone
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -1,5 +1,5 @@
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(RULES)/mplib$(WM_MPLIB) sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
EXE_INC = \ EXE_INC = \
$(PFLAGS) $(PINC) \ $(PFLAGS) $(PINC) \

View File

@ -3,7 +3,7 @@
* This is purely to avoid scotch.h including mpicxx.h, which causes problems. * This is purely to avoid scotch.h including mpicxx.h, which causes problems.
*/ */
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(RULES)/mplib$(WM_MPLIB) sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
EXE_INC = \ EXE_INC = \
$(PFLAGS) $(PINC) \ $(PFLAGS) $(PINC) \

View File

@ -1,5 +1,5 @@
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(RULES)/mplib$(WM_MPLIB) sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
EXE_INC = \ EXE_INC = \
$(PFLAGS) $(PINC) \ $(PFLAGS) $(PINC) \

View File

@ -29,7 +29,6 @@ License
#include "volPointInterpolation.H" #include "volPointInterpolation.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -134,8 +133,6 @@ void Foam::distanceSurface::createGeometry()
const fvMesh& fvm = static_cast<const fvMesh&>(mesh_); const fvMesh& fvm = static_cast<const fvMesh&>(mesh_);
const labelList& own = fvm.faceOwner();
// Distance to cell centres // Distance to cell centres
// ~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~
@ -173,35 +170,14 @@ void Foam::distanceSurface::createGeometry()
if (signed_) if (signed_)
{ {
List<volumeType> volType; vectorField norms;
surfPtr_().getNormal(nearest, norms);
surfPtr_().getVolumeType(cc, volType); forAll(norms, i)
forAll(volType, i)
{ {
volumeType vT = volType[i]; const point diff(cc[i] - nearest[i].hitPoint());
if (vT == volumeType::OUTSIDE) fld[i] = sign(diff & norms[i]) * Foam::mag(diff);
{
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
}
else if (vT == volumeType::INSIDE)
{
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
}
else if (vT == volumeType::UNKNOWN)
{
// Treat as very far outside
fld[i] = GREAT;
}
else
{
FatalErrorInFunction
<< "getVolumeType failure:"
<< " neither INSIDE or OUTSIDE but "
<< volumeType::names[vT]
<< exit(FatalError);
}
} }
} }
else else
@ -223,9 +199,6 @@ void Foam::distanceSurface::createGeometry()
const pointField& cc = fvm.C().boundaryField()[patchi]; const pointField& cc = fvm.C().boundaryField()[patchi];
fvPatchScalarField& fld = cellDistanceBf[patchi]; fvPatchScalarField& fld = cellDistanceBf[patchi];
const label patchStarti = fvm.boundaryMesh()[patchi].start();
List<pointIndexHit> nearest; List<pointIndexHit> nearest;
surfPtr_().findNearest surfPtr_().findNearest
( (
@ -236,41 +209,14 @@ void Foam::distanceSurface::createGeometry()
if (signed_) if (signed_)
{ {
List<volumeType> volType; vectorField norms;
surfPtr_().getNormal(nearest, norms);
surfPtr_().getVolumeType(cc, volType); forAll(norms, i)
forAll(volType, i)
{ {
volumeType vT = volType[i]; const point diff(cc[i] - nearest[i].hitPoint());
if (vT == volumeType::OUTSIDE) fld[i] = sign(diff & norms[i]) * Foam::mag(diff);
{
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
}
else if (vT == volumeType::INSIDE)
{
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
}
else if (vT == volumeType::UNKNOWN)
{
// Nothing known, so use the cell value.
// - this avoids spurious changes on the boundary
// The cell value
const label meshFacei = i+patchStarti;
const scalar& cellVal = cellDistance[own[meshFacei]];
fld[i] = cellVal;
}
else
{
FatalErrorInFunction
<< "getVolumeType failure:"
<< " neither INSIDE or OUTSIDE but "
<< volumeType::names[vT]
<< exit(FatalError);
}
} }
} }
else else
@ -303,44 +249,21 @@ void Foam::distanceSurface::createGeometry()
if (signed_) if (signed_)
{ {
List<volumeType> volType; vectorField norms;
surfPtr_().getNormal(nearest, norms);
surfPtr_().getVolumeType(pts, volType); forAll(norms, i)
forAll(volType, i)
{ {
volumeType vT = volType[i]; const point diff(pts[i] - nearest[i].hitPoint());
if (vT == volumeType::OUTSIDE) pointDistance_[i] = sign(diff & norms[i]) * Foam::mag(diff);
{
pointDistance_[i] =
Foam::mag(pts[i] - nearest[i].hitPoint());
}
else if (vT == volumeType::INSIDE)
{
pointDistance_[i] =
-Foam::mag(pts[i] - nearest[i].hitPoint());
}
else if (vT == volumeType::UNKNOWN)
{
// Treat as very far outside
pointDistance_[i] = GREAT;
}
else
{
FatalErrorInFunction
<< "getVolumeType failure:"
<< " neither INSIDE or OUTSIDE but "
<< volumeType::names[vT]
<< exit(FatalError);
}
} }
} }
else else
{ {
forAll(nearest, i) forAll(nearest, i)
{ {
pointDistance_[i] = Foam::mag(pts[i]-nearest[i].hitPoint()); pointDistance_[i] = Foam::mag(pts[i] - nearest[i].hitPoint());
} }
} }
} }

View File

@ -60,14 +60,6 @@ namespace Foam
} }
}; };
// Avoid detecting change if the cells have been marked as GREAT
// (ie, ignore them)
static inline constexpr bool ignoreValue(const scalar val)
{
return (val >= 0.5*Foam::GREAT);
}
} // End namespace Foam } // End namespace Foam
@ -165,7 +157,7 @@ void Foam::isoSurface::syncUnseparatedPoints
forAll(nbrPts, pointi) forAll(nbrPts, pointi)
{ {
label nbrPointi = nbrPts[pointi]; const label nbrPointi = nbrPts[pointi];
patchInfo[nbrPointi] = pointValues[meshPts[pointi]]; patchInfo[nbrPointi] = pointValues[meshPts[pointi]];
} }
@ -314,39 +306,19 @@ bool Foam::isoSurface::isEdgeOfFaceCut
const bool neiLower const bool neiLower
) const ) const
{ {
// Could also count number of edges cut and return when they are > 1
// but doesn't appear to improve anything
forAll(f, fp) forAll(f, fp)
{ {
const scalar& pt0Value = pVals[f[fp]]; const bool fpLower = (pVals[f[fp]] < iso_);
if (ignoreValue(pt0Value)) if
(
fpLower != ownLower
|| fpLower != neiLower
|| fpLower != (pVals[f[f.fcIndex(fp)]] < iso_)
)
{ {
continue;
}
const bool fpLower = (pt0Value < iso_);
if (fpLower != ownLower || fpLower != neiLower)
{
// ++ncut;
return true; return true;
} }
else
{
const scalar& pt1Value = pVals[f[f.fcIndex(fp)]];
if (!ignoreValue(pt1Value) && (fpLower != (pt1Value < iso_)))
{
// ++ncut;
return true;
}
}
// if (ncut > 1)
// {
// return true;
// }
} }
return false; return false;
@ -401,17 +373,9 @@ void Foam::isoSurface::calcCutTypes
faceCutType_.setSize(mesh_.nFaces()); faceCutType_.setSize(mesh_.nFaces());
faceCutType_ = NOTCUT; faceCutType_ = NOTCUT;
// Avoid detecting change if the cells have been marked as GREAT
// (ie, ignore them)
for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei) for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
{ {
const scalar& ownValue = cVals[own[facei]]; const scalar& ownValue = cVals[own[facei]];
if (ignoreValue(ownValue))
{
continue;
}
const bool ownLower = (ownValue < iso_); const bool ownLower = (ownValue < iso_);
scalar nbrValue; scalar nbrValue;
@ -427,11 +391,6 @@ void Foam::isoSurface::calcCutTypes
nbrPoint nbrPoint
); );
if (ignoreValue(nbrValue))
{
continue;
}
const bool neiLower = (nbrValue < iso_); const bool neiLower = (nbrValue < iso_);
if (ownLower != neiLower) if (ownLower != neiLower)
@ -503,7 +462,6 @@ void Foam::isoSurface::calcCutTypes
// Propagate internal face cuts into the cells. // Propagate internal face cuts into the cells.
// For cells marked as ignore (eg, GREAT) - skip this.
for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei) for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
{ {
@ -512,20 +470,12 @@ void Foam::isoSurface::calcCutTypes
continue; continue;
} }
if if (cellCutType_[own[facei]] == NOTCUT)
(
cellCutType_[own[facei]] == NOTCUT
&& !ignoreValue(cVals[own[facei]])
)
{ {
cellCutType_[own[facei]] = CUT; cellCutType_[own[facei]] = CUT;
++nCutCells_; ++nCutCells_;
} }
if if (cellCutType_[nei[facei]] == NOTCUT)
(
cellCutType_[nei[facei]] == NOTCUT
&& !ignoreValue(cVals[nei[facei]])
)
{ {
cellCutType_[nei[facei]] = CUT; cellCutType_[nei[facei]] = CUT;
++nCutCells_; ++nCutCells_;
@ -534,8 +484,6 @@ void Foam::isoSurface::calcCutTypes
// Propagate boundary face cuts into the cells. // Propagate boundary face cuts into the cells.
// For cells marked as ignore (eg, GREAT) - skip this and
// also suppress the boundary face cut to prevent dangling face cuts.
for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); ++facei) for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); ++facei)
{ {
@ -544,12 +492,7 @@ void Foam::isoSurface::calcCutTypes
continue; continue;
} }
if (ignoreValue(cVals[own[facei]])) if (cellCutType_[own[facei]] == NOTCUT)
{
// Suppress dangling boundary face cut
faceCutType_[facei] = NOTCUT;
}
else if (cellCutType_[own[facei]] == NOTCUT)
{ {
cellCutType_[own[facei]] = CUT; cellCutType_[own[facei]] = CUT;
++nCutCells_; ++nCutCells_;
@ -774,10 +717,8 @@ void Foam::isoSurface::calcSnappedPoint
bool anyCut = false; bool anyCut = false;
forAll(pFaces, i) for (const label facei : pFaces)
{ {
label facei = pFaces[i];
if (faceCutType_[facei] == CUT) if (faceCutType_[facei] == CUT)
{ {
anyCut = true; anyCut = true;
@ -795,12 +736,10 @@ void Foam::isoSurface::calcSnappedPoint
label nOther = 0; label nOther = 0;
point otherPointSum = Zero; point otherPointSum = Zero;
forAll(pFaces, pFacei) for (const label facei : pFaces)
{ {
// Create points for all intersections close to point // Create points for all intersections close to point
// (i.e. from pyramid edges) // (i.e. from pyramid edges)
label facei = pFaces[pFacei];
const face& f = mesh_.faces()[facei]; const face& f = mesh_.faces()[facei];
label own = mesh_.faceOwner()[facei]; label own = mesh_.faceOwner()[facei];

View File

@ -44,20 +44,6 @@ namespace Foam
} }
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam
{
// Avoid detecting change if the cells have been marked as GREAT
// (ie, ignore them)
static inline constexpr bool ignoreValue(const scalar val)
{
return (val >= 0.5*Foam::GREAT);
}
} // End namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::scalar Foam::isoSurfaceCell::isoFraction Foam::scalar Foam::isoSurfaceCell::isoFraction
@ -99,11 +85,6 @@ Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType
const label celli const label celli
) const ) const
{ {
if (ignoreValue(cellValues[celli]))
{
return NOTCUT;
}
const cell& cFaces = mesh_.cells()[celli]; const cell& cFaces = mesh_.cells()[celli];
if (isTet.test(celli)) if (isTet.test(celli))
@ -137,11 +118,7 @@ Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType
// Check pyramids cut // Check pyramids cut
for (const label labi : f) for (const label labi : f)
{ {
if if (cellLower != (pointValues[labi] < iso_))
(
!ignoreValue(pointValues[labi])
&& cellLower != (pointValues[labi] < iso_)
)
{ {
edgeCut = true; edgeCut = true;
break; break;
@ -187,11 +164,7 @@ Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType
for (const label pointi : cPoints) for (const label pointi : cPoints)
{ {
if if (cellLower != (pointValues[pointi] < iso_))
(
!ignoreValue(pointValues[pointi])
&& cellLower != (pointValues[pointi] < iso_)
)
{ {
++nCuts; ++nCuts;
} }
@ -201,7 +174,7 @@ Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType
{ {
return SPHERE; return SPHERE;
} }
else if (nCuts > 1) else
{ {
return CUT; return CUT;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,6 +40,7 @@ SourceFiles
#include "pointField.H" #include "pointField.H"
#include "labelledTri.H" #include "labelledTri.H"
#include "HashSet.H" #include "HashSet.H"
#include "ListOps.H"
#include "surfZoneList.H" #include "surfZoneList.H"
#include "surfaceFormatsCore.H" #include "surfaceFormatsCore.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
@ -101,7 +102,7 @@ public:
const pointField& pointLst, const pointField& pointLst,
const UList<Face>& faceLst, const UList<Face>& faceLst,
const UList<surfZone>& zoneLst = List<surfZone>(), const UList<surfZone>& zoneLst = List<surfZone>(),
const labelUList& faceMap = List<label>() const labelUList& faceMap = Foam::emptyLabelList
); );

Some files were not shown because too many files have changed in this diff Show More