diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 3c9570c27da751dcf7eb7f88bf7f85a4899d53a4..12872d614325912e05f547bd2f8c710d6fc4cab5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -210,7 +210,7 @@ int vtkPV3FoamReader::RequestData if ( (UpdateGUIOld == GetUpdateGUI()) - || (output->GetNumberOfDataSets(0) == 0) + || (output->GetNumberOfBlocks() == 0) ) { foamData_->Update(output); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h index 318016f6733b62e888d6d1a663b9382d014cfffc..c9875f9673167ea45383e9059c728b11170f634b 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h @@ -41,7 +41,9 @@ class vtkDataArraySelection; class vtkCallbackCommand; -class VTK_IO_EXPORT vtkPV3FoamReader : public vtkMultiBlockDataSetAlgorithm +class VTK_IO_EXPORT vtkPV3FoamReader +: + public vtkMultiBlockDataSetAlgorithm { public: diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/options.save b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/options.save deleted file mode 100755 index 650b286a7dabb2ea448773d3de2e5ff6f2fca5c4..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/options.save +++ /dev/null @@ -1,16 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/lagrangian/basic/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(ParaView_DIR) \ - -I$(ParaView_DIR)/VTK \ - -I$(ParaView_DIR)/VTK/Common \ - -I$(ParaView_DIR)/VTK/Filtering \ - -I$(ParaView_DIR)/VTK/Rendering \ - -I../PV3FoamReader - -LIB_LIBS = \ - -lfiniteVolume \ - -llagrangian \ - -lmeshTools \ - $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 3e3d2af10c7c59be647083370d466ac0e117421d..61e33a5d7707c52b9d4fc6030330bf741438d316 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -37,6 +37,7 @@ License // VTK includes #include "vtkCharArray.h" #include "vtkDataArraySelection.h" +#include "vtkDataSet.h" #include "vtkFieldData.h" #include "vtkMultiBlockDataSet.h" #include "vtkRenderer.h" @@ -55,6 +56,69 @@ defineTypeNameAndDebug(Foam::vtkPV3Foam, 0); #include "vtkPV3FoamUpdateInformationFields.H" +void Foam::vtkPV3Foam::AddToBlock +( + vtkMultiBlockDataSet* output, + unsigned int blockNo, + unsigned int datasetNo, + vtkDataSet* dataset +) +{ + vtkDataObject* blockDO = output->GetBlock(blockNo); + vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO); + if (blockDO && !block) + { + FatalErrorIn("Foam::vtkPV3Foam::AddToBlock") + << "Block already has a vtkDataSet assigned to it" << nl << endl; + return; + } + + if (!block) + { + block = vtkMultiBlockDataSet::New(); + output->SetBlock(blockNo, block); + block->Delete(); + } + + block->SetBlock(datasetNo, dataset); +} + + +vtkDataSet* Foam::vtkPV3Foam::GetDataSetFromBlock +( + vtkMultiBlockDataSet* output, + unsigned int blockNo, + unsigned int datasetNo +) +{ + vtkDataObject* blockDO = output->GetBlock(blockNo); + vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO); + if (block) + { + return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo)); + } + + return 0; +} + + +Foam::label Foam::vtkPV3Foam::GetNumberOfDataSets +( + vtkMultiBlockDataSet* output, + unsigned int blockNo +) +{ + vtkDataObject* blockDO = output->GetBlock(blockNo); + vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO); + if (block) + { + return block->GetNumberOfBlocks(); + } + + return 0; +} + + void Foam::vtkPV3Foam::resetCounters() { // Reset data size counts @@ -481,11 +545,11 @@ void Foam::vtkPV3Foam::Update if (debug) { Info<< "Number of data sets after update" << nl - << " VOLUME = " << output->GetNumberOfDataSets(VOLUME) << nl - << " LAGRANGIAN = " << output->GetNumberOfDataSets(LAGRANGIAN) - << nl << " CELLSET = " << output->GetNumberOfDataSets(CELLSET) - << nl << " FACESET = " << output->GetNumberOfDataSets(FACESET) - << nl << " POINTSET = " << output->GetNumberOfDataSets(POINTSET) + << " VOLUME = " << GetNumberOfDataSets(output, VOLUME) << nl + << " LAGRANGIAN = " << GetNumberOfDataSets(output, LAGRANGIAN) + << nl << " CELLSET = " << GetNumberOfDataSets(output, CELLSET) + << nl << " FACESET = " << GetNumberOfDataSets(output, FACESET) + << nl << " POINTSET = " << GetNumberOfDataSets(output, POINTSET) << endl; } } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 21d02e4a9a0658bf7d1b15b6c2399ac00449adf6..8657a9b3e29bffcd88cb1856c46b05cf2bab6937 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::vtkPV3Foam + vtkPV3Foam Description @@ -65,6 +65,7 @@ SourceFiles // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // class vtkDataArraySelection; +class vtkDataSet; class vtkMultiBlockDataSet; class vtkPoints; class vtkPV3FoamReader; @@ -188,6 +189,33 @@ class vtkPV3Foam // Private Member Functions + // Convenience method use to convert the readers from VTK 5 + // multiblock API to the current composite data infrastructure + void AddToBlock + ( + vtkMultiBlockDataSet* output, + unsigned int blockNo, + unsigned int datasetNo, + vtkDataSet* dataset + ); + + // Convenience method use to convert the readers from VTK 5 + // multiblock API to the current composite data infrastructure + vtkDataSet* GetDataSetFromBlock + ( + vtkMultiBlockDataSet* output, + unsigned int blockNo, + unsigned int datasetNo + ); + + // Convenience method use to convert the readers from VTK 5 + // multiblock API to the current composite data infrastructure + label GetNumberOfDataSets + ( + vtkMultiBlockDataSet* output, + unsigned int blockNo + ); + //- Reset data counters void resetCounters(); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFields.H index 357e260b1f97b0c1d3c9ff808abefe980236948f..4cf48293e77451969eabf36e96e108717550d178 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFields.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H index c52e3d69bd59b94b8f89bc9d43cb968200af5a05..9de17ee5611c189a3fe62ba76d594330bc6b4729 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ @@ -102,7 +102,7 @@ void Foam::vtkPV3Foam::convertLagrangianField { vtkUnstructuredGrid* lagrangianMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(LAGRANGIAN, 0) + GetDataSetFromBlock(output, LAGRANGIAN, 0) ); vtkFloatArray *pointTypes = vtkFloatArray::New(); @@ -144,7 +144,7 @@ void Foam::vtkPV3Foam::convertLagrangianField { vtkUnstructuredGrid* lagrangianMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(LAGRANGIAN, 0) + GetDataSetFromBlock(output, LAGRANGIAN, 0) ); vtkFloatArray *pointScalars = vtkFloatArray::New(); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C index 95a07970810bbc8b0af6fb4f1c9ef8ebc8b20c9a..2edace96dcf5fcd903fcd4e69f7fe1417a8e16e6 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C @@ -65,7 +65,8 @@ void Foam::vtkPV3Foam::convertMeshVolume vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New(); SetName(ugrid, "internalMesh"); addVolumeMesh(mesh, ugrid, superCells_); - output->SetDataSet(VOLUME, 0, ugrid); + AddToBlock(output, VOLUME, 0, ugrid); +// reader_->SetBlock(output->GetNumberOfBlocks(), ugrid); selectedRegionDatasetIds_[VOLUME] = 0; ugrid->Delete(); } @@ -96,7 +97,7 @@ void Foam::vtkPV3Foam::convertMeshLagrangian vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New(); addLagrangianMesh(mesh, ugrid); - output->SetDataSet(LAGRANGIAN, 0, ugrid); + AddToBlock(output, LAGRANGIAN, 0, ugrid); selectedRegionDatasetIds_[LAGRANGIAN] = 0; ugrid->Delete(); } @@ -141,8 +142,8 @@ void Foam::vtkPV3Foam::convertMeshPatches const label patchId = mesh.boundaryMesh() .findPatchID(regionName); addPatchMesh(patches[patchId], ugrid); - const label nextId = output->GetNumberOfDataSets(VOLUME); - output->SetDataSet(VOLUME, nextId, ugrid); + const label nextId = GetNumberOfDataSets(output, VOLUME); + AddToBlock(output, VOLUME, nextId, ugrid); selectedRegionDatasetIds_[i] = nextId; ugrid->Delete(); } @@ -188,14 +189,14 @@ void Foam::vtkPV3Foam::convertMeshCellSet vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New(); SetName(ugrid, cSetName.c_str()); - const label nextId = output->GetNumberOfDataSets(CELLSET); + const label nextId = GetNumberOfDataSets(output, CELLSET); addVolumeMesh ( subsetter.subMesh(), ugrid, superCellSetCells_[nextId] ); - output->SetDataSet(CELLSET, nextId, ugrid); + AddToBlock(output, CELLSET, nextId, ugrid); selectedRegionDatasetIds_[i] = nextId; ugrid->Delete(); } @@ -245,8 +246,8 @@ void Foam::vtkPV3Foam::convertMeshFaceSet fSet, ugrid ); - const label nextId = output->GetNumberOfDataSets(FACESET); - output->SetDataSet(FACESET, nextId, ugrid); + const label nextId = GetNumberOfDataSets(output, FACESET); + AddToBlock(output, FACESET, nextId, ugrid); selectedRegionDatasetIds_[i] = nextId; ugrid->Delete(); } @@ -296,8 +297,8 @@ void Foam::vtkPV3Foam::convertMeshPointSet pSet, ugrid ); - const label nextId = output->GetNumberOfDataSets(POINTSET); - output->SetDataSet(POINTSET, nextId, ugrid); + label nextId = GetNumberOfDataSets(output, POINTSET); + AddToBlock(output, POINTSET, nextId, ugrid); selectedRegionDatasetIds_[i] = nextId; ugrid->Delete(); } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H index 938455ed7345e2f96ba541f14fd3a4864c494cc3..db24e175788e7283507154f5b0dfa4f1a6cf6d71 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ @@ -49,7 +49,7 @@ void Foam::vtkPV3Foam::convertPatchFaceField { vtkUnstructuredGrid* vtkMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, regioni) + GetDataSetFromBlock(output, VOLUME, regioni) ); vtkFloatArray *cellTypes = vtkFloatArray::New(); @@ -87,7 +87,7 @@ void Foam::vtkPV3Foam::convertPatchFaceField { vtkUnstructuredGrid* vtkMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, regioni) + GetDataSetFromBlock(output, VOLUME, regioni) ); vtkFloatArray *cellScalars = vtkFloatArray::New(); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H index 50c258d1b0b04ec5c28bfcc77808dd9a65e00950..2ec93dffdc381fbc8495f088104218997683aa9e 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ @@ -46,7 +46,7 @@ void Foam::vtkPV3Foam::convertPatchPointField { vtkUnstructuredGrid* vtkMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, regioni) + GetDataSetFromBlock(output, VOLUME, regioni) ); vtkFloatArray *pointTypes = vtkFloatArray::New(); @@ -83,7 +83,7 @@ void Foam::vtkPV3Foam::convertPatchPointField { vtkUnstructuredGrid* vtkMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, regioni) + GetDataSetFromBlock(output, VOLUME, regioni) ); vtkFloatArray *pointScalars = vtkFloatArray::New(); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H index 19777cc10973f3c9eaa663d62c5ef8168d7ed95c..4e6fe750650a55e6c8941cab24aa5c411a9f5220 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ @@ -130,7 +130,7 @@ void Foam::vtkPV3Foam::convertPointField { vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, 0) + GetDataSetFromBlock(output, VOLUME, 0) ); vtkFloatArray *pointTypes = vtkFloatArray::New(); @@ -197,7 +197,7 @@ void Foam::vtkPV3Foam::convertPointField { vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, 0) + GetDataSetFromBlock(output, VOLUME, 0) ); vtkFloatArray *pointScalars = vtkFloatArray::New(); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H index f4520f0d7423163d5be522063069f24cac95a7dd..e27af752bb03198361da4705d4ce4c739531309f 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ @@ -177,10 +177,10 @@ void Foam::vtkPV3Foam::convertVolField { vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, 0) + GetDataSetFromBlock(output, VOLUME, 0) ); - vtkFloatArray *cellTypes = vtkFloatArray::New(); + vtkFloatArray* cellTypes = vtkFloatArray::New(); cellTypes->SetNumberOfTuples(superCells_.size()); cellTypes->SetNumberOfComponents(Type::nComponents); cellTypes->Allocate(Type::nComponents*superCells_.size()); @@ -220,7 +220,7 @@ void Foam::vtkPV3Foam::convertVolField { vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast ( - output->GetDataSet(VOLUME, 0) + GetDataSetFromBlock(output, VOLUME, 0) ); vtkFloatArray *cellScalars = vtkFloatArray::New(); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamInsertNextPoint.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamInsertNextPoint.H index 307fc811ccdb00f7a021287c43d2097c0c498434..107296e5fd57e55295ab05b8df82b63f1040e924 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamInsertNextPoint.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamInsertNextPoint.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H index fc32fc260fabfa415c421ea1bf92e1c2fa4896cf..da6f766bcf4cd2548507090fe484a6b737cbf90e 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H @@ -22,8 +22,8 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::vtkPV3Foam +Class + vtkPV3Foam \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/axis.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/axis.cfg deleted file mode 100644 index 8657f923a9af4977d69d63518e9c16fb90829985..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/axis.cfg +++ /dev/null @@ -1,24 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -axis -{ - type word; - description "Form of distance data"; - default distance; - valueList - ( - distance - x - y - z - xyz - ); -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/cloud.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/cloud.cfg deleted file mode 100644 index 89c304e331ad5bf836f0792291b4869cb920cdeb..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/cloud.cfg +++ /dev/null @@ -1,21 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -cloud -{ - type dictionary; - description "Samples a set of specified points"; - entries - { - include "name.cfg"; - include "axis.cfg"; - include "points.cfg"; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/curve.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/curve.cfg deleted file mode 100644 index 4f707496636c6eea1963d0f2409bf024a708f8d3..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/curve.cfg +++ /dev/null @@ -1,21 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -curve -{ - type dictionary; - description "Samples a set of specified points that are tracked along a curve"; - entries - { - include "name.cfg"; - include "axis.cfg"; - include "points.cfg"; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/end.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/end.cfg deleted file mode 100644 index 5d2c5b6d052308a3913d288bf067afb0525259f7..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/end.cfg +++ /dev/null @@ -1,15 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -end -{ - type vector; - description "End point on sampling line"; -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/face.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/face.cfg deleted file mode 100644 index d00a4a76c4518843a47797a66e9bc098283e4526..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/face.cfg +++ /dev/null @@ -1,22 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -face -{ - type dictionary; - description "One sampling point per face intersection"; - entries - { - include "name.cfg"; - include "axis.cfg"; - include "start.cfg"; - include "end.cfg"; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/midPoint.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/midPoint.cfg deleted file mode 100644 index 5930161b49e4dd99d9d5bf15096735a9be499456..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/midPoint.cfg +++ /dev/null @@ -1,22 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -midPoint -{ - type dictionary; - description "One sampling point per cell, between two face intersections"; - entries - { - include "name.cfg"; - include "axis.cfg"; - include "start.cfg"; - include "end.cfg"; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/midPointAndFace.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/midPointAndFace.cfg deleted file mode 100644 index bb492b5c1829bd2ac9d710c84707d31ac54f3157..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/midPointAndFace.cfg +++ /dev/null @@ -1,22 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -midPointAndFace -{ - type dictionary; - description "One sampling point per intersected face and one per cell, between two face intersections"; - entries - { - include "name.cfg"; - include "axis.cfg"; - include "start.cfg"; - include "end.cfg"; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/nPoints.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/nPoints.cfg deleted file mode 100644 index aba1b8a86858ba140b66b03618c6b1fe3986dee7..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/nPoints.cfg +++ /dev/null @@ -1,15 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -nPoints -{ - type label; - description "Number of points on sampling line"; -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/name.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/name.cfg deleted file mode 100644 index 4ab16bf9d8cc62ac9cf0a66f6d5f1d348edb8498..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/name.cfg +++ /dev/null @@ -1,15 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -name -{ - type word; - description "Name of sampling set"; -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/points.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/points.cfg deleted file mode 100644 index 3b4f47ebbee998811decde1524905733f93801d7..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/points.cfg +++ /dev/null @@ -1,16 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -points -{ - type list; - description "List of points to be sampled"; - elementType vector; -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/sample.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/sample.cfg deleted file mode 100644 index 9cf95d9ae51bd1d554ef6921f1dc4041b9d7dd28..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/sample.cfg +++ /dev/null @@ -1,71 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -// sample tool definition - -description "Line sampling"; - -sampleDict -{ - type dictionary; - description "sample control dictionary"; - dictionaryPath "system"; - - entries - { - arguments - { - type rootCaseTimeArguments; - } - - interpolationScheme - { - type word; - description "Sampling interpolation scheme"; - default cellPoint; - valueList - ( - cell - cellPoint - cellPointFace - ); - } - - writeFormat - { - type word; - description "Output format of data"; - default raw; - valueList - ( - raw - gnuplot - xmgr - jplot - ); - } - - sampleSets - { - type list; - description "List of sampling sets"; - elementType - { - include "sampleSet.cfg"; - } - } - - fields - { - type list; - description "List of fields to be sampled"; - elementType word; - } - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/sampleSet.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/sampleSet.cfg deleted file mode 100644 index 9248dc4aecdcb54a9493f9bccd9450cbfe8dc628..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/sampleSet.cfg +++ /dev/null @@ -1,23 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -sampleSet -{ - type selection; - entries - { - include "uniform.cfg"; - include "face.cfg"; - include "midPoint.cfg"; - include "midPointAndFace.cfg"; - include "curve.cfg"; - include "cloud.cfg"; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/start.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/start.cfg deleted file mode 100644 index 5382f60eb8c01acc2c1d365798c568a18b32b838..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/start.cfg +++ /dev/null @@ -1,15 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -start -{ - type vector; - description "Start point on sampling line"; -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/tensorFieldSample.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/tensorFieldSample.cfg deleted file mode 100644 index 1aee8b66cee611a905b0ab00a655c50975ccfdc9..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/tensorFieldSample.cfg +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -tensorFieldSample -{ - type compound; - description "Tensor field to be sampled"; - entries - { - name - { - type word; - description "Field name"; - } - - component - { - type word; - description "Tensor component(s)"; - valueList - ( - xx - xy - xz - yx - yy - yz - zx - zy - zz - mag - full - ); - } - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/uniform.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/uniform.cfg deleted file mode 100644 index e382ed1e44e3c706f9c9f3827f468b0db62dc149..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/uniform.cfg +++ /dev/null @@ -1,23 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -uniform -{ - type dictionary; - description "Uniform distribution of points on a line"; - entries - { - include "name.cfg"; - include "axis.cfg"; - include "start.cfg"; - include "end.cfg"; - include "nPoints.cfg"; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/FoamX/vectorFieldSample.cfg b/applications/utilities/postProcessing/sampling/sample/FoamX/vectorFieldSample.cfg deleted file mode 100644 index 89d901d97580be3f90179bdc4c1627534ce75045..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/FoamX/vectorFieldSample.cfg +++ /dev/null @@ -1,37 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -vectorFieldSample -{ - type compound; - description "Vector field to be sampled"; - entries - { - name - { - type word; - description "Field name"; - } - - component - { - type word; - description "Vector component(s)"; - valueList - ( - x - y - z - mag - full - ); - } - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/Make/files b/applications/utilities/postProcessing/sampling/sample/Make/files deleted file mode 100644 index d8193c0500361978db5b350a5898c9c9b84f8ea3..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/Make/files +++ /dev/null @@ -1,19 +0,0 @@ -combineSampleSets.C -sample.C - -writers/writer/writers.C -writers/xmgr/xmgrWriters.C -writers/gnuplot/gnuplotWriters.C -writers/jplot/jplotWriters.C -writers/raw/rawWriters.C - -sampleSets/coordSet/coordSet.C -sampleSets/sampleSet/sampleSet.C -sampleSets/cloud/cloudSet.C -sampleSets/face/faceOnlySet.C -sampleSets/curve/curveSet.C -sampleSets/uniform/uniformSet.C -sampleSets/midPoint/midPointSet.C -sampleSets/midPointAndFace/midPointAndFaceSet.C - -EXE = $(FOAM_APPBIN)/sample diff --git a/applications/utilities/postProcessing/sampling/sample/combineSampleSets.C b/applications/utilities/postProcessing/sampling/sample/combineSampleSets.C deleted file mode 100644 index 276eb1021a5e461bd816f76921bde42336a7bc13..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/combineSampleSets.C +++ /dev/null @@ -1,120 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - - -#include "Pstream.H" -#include "ListListOps.H" -#include "combineSampleSets.H" -#include "SortableList.H" -#include "IndirectList.H" - -using namespace Foam; - -// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // - -// Combine points from all processors. Sort by curveDist and produce -// index list. Valid result only on master processor. -void combineSampleSets -( - const PtrList<sampleSet>& sampleSets, - PtrList<coordSet>& masterSampleSets, - labelListList& indexSets -) -{ - forAll(sampleSets, setI) - { - const sampleSet& samplePts = sampleSets[setI]; - - // Collect data from all processors - List<List<point> > gatheredPts(Pstream::nProcs()); - gatheredPts[Pstream::myProcNo()] = samplePts; - Pstream::gatherList(gatheredPts); - - List<labelList> gatheredSegments(Pstream::nProcs()); - gatheredSegments[Pstream::myProcNo()] = samplePts.segments(); - Pstream::gatherList(gatheredSegments); - - List<scalarList> gatheredDist(Pstream::nProcs()); - gatheredDist[Pstream::myProcNo()] = samplePts.curveDist(); - Pstream::gatherList(gatheredDist); - - - // Combine processor lists into one big list. - List<point> allPts - ( - ListListOps::combine<List<point> > - ( - gatheredPts, accessOp<List<point> >() - ) - ); - labelList allSegments - ( - ListListOps::combine<labelList> - ( - gatheredSegments, accessOp<labelList>() - ) - ); - scalarList allCurveDist - ( - ListListOps::combine<scalarList> - ( - gatheredDist, accessOp<scalarList>() - ) - ); - - // Sort curveDist and use to fill masterSamplePts - SortableList<scalar> sortedDist(allCurveDist); - indexSets[setI] = sortedDist.indices(); - - // Get reference point (note: only master has all points) - point refPt; - - if (allPts.size() > 0) - { - refPt = samplePts.getRefPoint(allPts); - } - else - { - refPt = vector::zero; - } - - - masterSampleSets.set - ( - setI, - new coordSet - ( - samplePts.name(), - samplePts.axis(), - IndirectList<point>(allPts, indexSets[setI]), - refPt - ) - ); - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/combineSampleSets.H b/applications/utilities/postProcessing/sampling/sample/combineSampleSets.H deleted file mode 100644 index 3dc889ed495bd53afdaa11a3c754c2e95f7e307e..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/combineSampleSets.H +++ /dev/null @@ -1,60 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -InClass - Foam::combineSampleSets - -Description - Various utility functions for collection of samples on processors. - -SourceFiles - combineSampleSets.C - -\*---------------------------------------------------------------------------*/ - -#ifndef combineSampleSets_H -#define combineSampleSets_H - -#include "labelList.H" -#include "PtrList.H" -#include "coordSet.H" -#include "sampleSet.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Combine points from all processors. Sort by curveDist and produce -// index list. Valid result only on master processor. -void combineSampleSets -( - const Foam::PtrList<Foam::sampleSet>& sampleSets, - Foam::PtrList<Foam::coordSet>& masterSampleSets, - Foam::labelListList& indexSets -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/combineSampleValues.C b/applications/utilities/postProcessing/sampling/sample/combineSampleValues.C deleted file mode 100644 index adbf92f1ba0ba38dca2b54c7a3228340b5ae3214..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/combineSampleValues.C +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - - -#include "combineSampleValues.H" -#include "Pstream.H" -#include "ListListOps.H" -#include "IndirectList.H" - -using namespace Foam; - -// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // - -// Combine values from all processors. Valid result only on master processor. -template<class T> -void combineSampleValues -( - const PtrList<volFieldSampler<T> >& sampledFields, - const labelListList& indexSets, - PtrList<volFieldSampler<T> >& masterFields -) -{ - forAll(sampledFields, fieldI) - { - List<Field<T> > masterValues(indexSets.size()); - - forAll(indexSets, setI) - { - // Collect data from all processors - List<Field<T> > gatheredData(Pstream::nProcs()); - gatheredData[Pstream::myProcNo()] = sampledFields[fieldI][setI]; - Pstream::gatherList(gatheredData); - - if (Pstream::master()) - { - Field<T> allData - ( - ListListOps::combine<Field<T> > - ( - gatheredData, - Foam::accessOp<Field<T> >() - ) - ); - - masterValues[setI] = - IndirectList<T>(allData, indexSets[setI])(); - } - } - masterFields.set - ( - fieldI, - new volFieldSampler<T> - ( - masterValues, - sampledFields[fieldI].name() - ) - ); - } -} - - -// ************************************************************************* // - diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C deleted file mode 100644 index 18cd64e869d6812ebfd98bb24b91ac31770080a6..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/sample.C +++ /dev/null @@ -1,887 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - Sample field data with a choice of interpolation schemes, sampling options - and write formats. - - interpolationScheme : choice of - cell : use cell-centre value only; constant over cells - cellPoint : use cell-centre and vertex values - cellPointFace : use cell-centre, vertex and face values. - - sample: choice of - uniform evenly distributed points on line - face one point per face intersection - midPoint one point per cell, inbetween two face intersections - midPointAndFace combination of face and midPoint - - curve specified points, not nessecary on line, uses - tracking - cloud specified points, uses findCell - - writeFormat : choice of - xmgr - jplot - gnuplot - raw - -\*---------------------------------------------------------------------------*/ - -#include "Pstream.H" -#include "argList.H" -#include "OSspecific.H" - -#include "Cloud.H" -#include "passiveParticle.H" -#include "meshSearch.H" -#include "interpolation.H" -#include "volPointInterpolation.H" - -#include "writer.H" -#include "sampleSet.H" -#include "volFieldSampler.H" -#include "dictionaryEntry.H" - -#include "combineSampleSets.H" -#include "combineSampleValues.H" - -using namespace Foam; - - -template<class Type> -void writeSampleFile -( - const coordSet& masterSampleSet, - const PtrList<volFieldSampler<Type> >& masterFields, - const label setI, - const fileName& timeDir, - const word& writeFormat -) -{ - if (masterFields.size() > 0) - { - wordList valueSetNames(masterFields.size()); - List<const Field<Type>*> valueSets(masterFields.size()); - - forAll(masterFields, fieldI) - { - valueSetNames[fieldI] = masterFields[fieldI].name(); - valueSets[fieldI] = &masterFields[fieldI][setI]; - } - - autoPtr<writer<Type> > formatter - ( - writer<Type>::New(writeFormat) - ); - - fileName fName - ( - timeDir/formatter().getFileName(masterSampleSet, valueSetNames) - ); - - Info<< "Writing fields to " << fName << endl; - - formatter().write - ( - masterSampleSet, - valueSetNames, - valueSets, - OFstream(fName)() - ); - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: - -int main(int argc, char *argv[]) -{ -# include "addTimeOptions.H" -# include "setRootCase.H" - -# include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - - // set startTime and endTime depending on -time and -latestTime options -# include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); - -# include "createMesh.H" - - // - // Hack: initialize Cloud to initialize the processor table so from - // now on we can use cloud on single processors only. - // - Cloud<passiveParticle> dummyCloud(mesh, IDLList<passiveParticle>()); - - // Read control dictionary - IOdictionary sampleDict - ( - IOobject - ( - "sampleDict", - runTime.system(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - const word interpolationScheme(sampleDict.lookup("interpolationScheme")); - const wordList fieldNames = sampleDict.lookup("fields"); - - // - // Construct writers - // - - word writeFormat(sampleDict.lookup("writeFormat")); - - // - // Construct interpolation dictionary (same interpolation for all fields) - // - - dictionary interpolationSchemes; - - forAll(fieldNames, fieldI) - { - interpolationSchemes.add - ( - fieldNames[fieldI], - interpolationScheme - ); - } - - // Set up interpolation - autoPtr<pointMesh> pMeshPtr(new pointMesh(mesh)); - autoPtr<volPointInterpolation> pInterpPtr - ( - new volPointInterpolation(mesh, pMeshPtr()) - ); - - // Set up mesh searching - meshSearch searchEngine(mesh, true); - - - fileName samplePath; - - if (Pstream::master()) - { - if (Pstream::parRun()) - { - samplePath = runTime.path()/".."/"samples"; - } - else - { - samplePath = runTime.path()/"samples"; - } - - if (exists(samplePath)) - { - Info<< "Deleting samples/ directory" << endl << endl; - rmDir(samplePath); - } - } - - fileName oldPointsDir("constant"); - - for (label i=startTime; i<endTime; i++) - { - runTime.setTime(Times[i], i); - - Info<< "Time = " << runTime.timeName() << endl; - - // - // Handle geometry/topology changes - // - polyMesh::readUpdateState state = mesh.readUpdate(); - - if - ( - state == polyMesh::POINTS_MOVED - || state == polyMesh::TOPO_CHANGE - ) - { - // Geometry and topology changes - searchEngine.correct(); - - pMeshPtr.reset(new pointMesh(mesh)); - - pInterpPtr.reset(new volPointInterpolation(mesh, pMeshPtr())); - } - - - // - // Construct sampling point generators - // - - PtrList<sampleSet> sampleSets - ( - sampleDict.lookup("sampleSets"), - sampleSet::iNew(mesh, searchEngine) - ); - if (sampleSets.size() < 1) - { - FatalErrorIn(args.executable()) - << "No sampleSets provided in sampleDict" - << exit(FatalError); - } - - // Storage for interpolated values - PtrList<volFieldSampler<scalar> > sampledScalarFields - ( - fieldNames.size() - ); - PtrList<volFieldSampler<vector> > sampledVectorFields - ( - fieldNames.size() - ); - PtrList<volFieldSampler<sphericalTensor> > sampledSphericalTensorFields - ( - fieldNames.size() - ); - PtrList<volFieldSampler<symmTensor> > sampledSymmTensorFields - ( - fieldNames.size() - ); - PtrList<volFieldSampler<tensor> > sampledTensorFields - ( - fieldNames.size() - ); - - // - // Do actual interpolation - // - - label nScalarFields = 0; - label nVectorFields = 0; - label nSphericalTensorFields = 0; - label nSymmTensorFields = 0; - label nTensorFields = 0; - - forAll(fieldNames, fieldI) - { - const word& fieldName = fieldNames[fieldI]; - - IOobject fieldHeader - ( - fieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ - ); - - // Determine number of processor actually having this field - label fieldFound = (fieldHeader.headerOk() ? 1 : 0); - reduce(fieldFound, sumOp<label>()); - - if (fieldFound == Pstream::nProcs()) - { - if - ( - fieldHeader.headerClassName() == volScalarField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volScalarField sField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - sField, - sampleSets - ) - ); - - nScalarFields++; - } - else if - ( - fieldHeader.headerClassName() == volVectorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volVectorField vField(fieldHeader, mesh); - - sampledVectorFields.set - ( - nVectorFields, - new volFieldSampler<vector> - ( - pInterpPtr(), - interpolationSchemes, - vField, - sampleSets - ) - ); - - nVectorFields++; - } - else if - ( - fieldHeader.headerClassName() - == volSphericalTensorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volSphericalTensorField tField(fieldHeader, mesh); - - sampledSphericalTensorFields.set - ( - nSphericalTensorFields, - new volFieldSampler<sphericalTensor> - ( - pInterpPtr(), - interpolationSchemes, - tField, - sampleSets - ) - ); - - nSphericalTensorFields++; - } - else if - ( - fieldHeader.headerClassName() - == volSymmTensorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volSymmTensorField tField(fieldHeader, mesh); - - sampledSymmTensorFields.set - ( - nSymmTensorFields, - new volFieldSampler<symmTensor> - ( - pInterpPtr(), - interpolationSchemes, - tField, - sampleSets - ) - ); - - nSymmTensorFields++; - } - else if - ( - fieldHeader.headerClassName() == volTensorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volTensorField tField(fieldHeader, mesh); - - sampledTensorFields.set - ( - nTensorFields, - new volFieldSampler<tensor> - ( - pInterpPtr(), - interpolationSchemes, - tField, - sampleSets - ) - ); - - nTensorFields++; - } - } - else if (fieldFound != 0) - { - FatalErrorIn(args.executable()) - << "Did not find field " << fieldName - << " on all processors" << exit(FatalError); - } - else if (fieldName.find('(') != string::npos) - { - if (fieldName.find("component") != string::npos) - { - string baseFieldName(fieldName(0, fieldName.find('.'))); - - IOobject fieldHeader - ( - baseFieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ - ); - - // Determine number of processor actually having this field - label fieldFound = (fieldHeader.headerOk() ? 1 : 0); - reduce(fieldFound, sumOp<label>()); - - if (fieldFound == Pstream::nProcs()) - { - if - ( - fieldHeader.headerClassName() - == volVectorField::typeName - ) - { - size_t cmptPos(fieldName.find_last_of("012")); - - if (cmptPos == string::npos) - { - FatalErrorIn(args.executable()) - << "cannot find component index for " - << fieldName << exit(FatalError); - } - - direction cmpt = - atoi(string(fieldName[cmptPos]).c_str()); - - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volVectorField vField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - vField.component(cmpt)(), - sampleSets - ) - ); - - nScalarFields++; - } - else if - ( - fieldHeader.headerClassName() - == volSymmTensorField::typeName - ) - { - size_t cmptPos(fieldName.find_last_of("0123456")); - - if (cmptPos == string::npos) - { - FatalErrorIn(args.executable()) - << "cannot find component index for " - << fieldName - << exit(FatalError); - } - - direction cmpt = - atoi(string(fieldName[cmptPos]).c_str()); - - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volSymmTensorField tField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - tField.component(cmpt)(), - sampleSets - ) - ); - - nScalarFields++; - } - else if - ( - fieldHeader.headerClassName() - == volTensorField::typeName - ) - { - size_t cmptPos(fieldName.find_last_of("012345678")); - - if (cmptPos == string::npos) - { - FatalErrorIn(args.executable()) - << "cannot find component index for " - << fieldName - << exit(FatalError); - } - - direction cmpt = - atoi(string(fieldName[cmptPos]).c_str()); - - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volTensorField tField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - tField.component(cmpt)(), - sampleSets - ) - ); - - nScalarFields++; - } - else - { - FatalErrorIn(args.executable()) - << "component function not supported for field " - << fieldName << " of type " - << fieldHeader.headerClassName() - << exit(FatalError); - } - } - else if (fieldFound != 0) - { - FatalErrorIn(args.executable()) - << "Did not find field " << baseFieldName - << " on all processors" << exit(FatalError); - } - - } - else if (fieldName.find("mag") != string::npos) - { - string baseFieldName - ( - fieldName(fieldName.find('(') + 1, - fieldName.find(')') - fieldName.find('(') - 1) - ); - - IOobject fieldHeader - ( - baseFieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ - ); - - // Determine number of processor actually having this field - label fieldFound = (fieldHeader.headerOk() ? 1 : 0); - reduce(fieldFound, sumOp<label>()); - - - if (fieldFound == Pstream::nProcs()) - { - if - ( - fieldHeader.headerClassName() - == volScalarField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volScalarField sField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - mag(sField), - sampleSets - ) - ); - - nScalarFields++; - } - else if - ( - fieldHeader.headerClassName() - == volVectorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volVectorField vField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - mag(vField), - sampleSets - ) - ); - - nScalarFields++; - } - else if - ( - fieldHeader.headerClassName() - == volSphericalTensorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volSphericalTensorField tField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - mag(tField), - sampleSets - ) - ); - - nScalarFields++; - } - else if - ( - fieldHeader.headerClassName() - == volSymmTensorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volSymmTensorField tField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - mag(tField), - sampleSets - ) - ); - - nScalarFields++; - } - else if - ( - fieldHeader.headerClassName() - == volTensorField::typeName - ) - { - Info<< "Sampling " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volTensorField tField(fieldHeader, mesh); - - sampledScalarFields.set - ( - nScalarFields, - new volFieldSampler<scalar> - ( - pInterpPtr(), - interpolationSchemes, - mag(tField), - sampleSets - ) - ); - - nScalarFields++; - } - else - { - FatalErrorIn(args.executable()) - << "mag function not supported for field " - << fieldName << " of type " - << fieldHeader.headerClassName() - << exit(FatalError); - } - } - else if (fieldFound != 0) - { - FatalErrorIn(args.executable()) - << "Did not find field " << baseFieldName - << " on all processors" << exit(FatalError); - } - } - } - } - - // Set the sampledFields to the correct size - sampledScalarFields.setSize(nScalarFields); - sampledVectorFields.setSize(nVectorFields); - sampledSphericalTensorFields.setSize(nSphericalTensorFields); - sampledSymmTensorFields.setSize(nSymmTensorFields); - sampledTensorFields.setSize(nTensorFields); - - // - // Now we have all results - // - sampleSets : list of all sampling sets - // - sampledXXXFields : list of all sampled fields - // - - // Combine sampleSets from processors. Sort by curveDist. Return - // ordering in indexSets. - // Note: only master results are valid - - PtrList<coordSet> masterSampleSets(sampleSets.size()); - labelListList indexSets(sampleSets.size()); - combineSampleSets(sampleSets, masterSampleSets, indexSets); - - - // Combine sampled fields from processors. - // Note: only master results are valid - - PtrList<volFieldSampler<scalar> > masterScalarFields - ( - sampledScalarFields.size() - ); - combineSampleValues(sampledScalarFields, indexSets, masterScalarFields); - - PtrList<volFieldSampler<vector> > masterVectorFields - ( - sampledVectorFields.size() - ); - combineSampleValues(sampledVectorFields, indexSets, masterVectorFields); - - PtrList<volFieldSampler<sphericalTensor> > masterSphericalTensorFields - ( - sampledSphericalTensorFields.size() - ); - combineSampleValues - ( - sampledSphericalTensorFields, - indexSets, - masterSphericalTensorFields - ); - - PtrList<volFieldSampler<symmTensor> > masterSymmTensorFields - ( - sampledSymmTensorFields.size() - ); - combineSampleValues - ( - sampledSymmTensorFields, - indexSets, - masterSymmTensorFields - ); - - PtrList<volFieldSampler<tensor> > masterTensorFields - ( - sampledTensorFields.size() - ); - combineSampleValues(sampledTensorFields, indexSets, masterTensorFields); - - - // - // Write each set, each Field type (scalar/vector/tensor) to separate - // file. - // - - if (Pstream::master()) - { - fileName timeDir(samplePath/runTime.timeName()); - - // Mirror the time structure under "samples" - mkDir(timeDir); - - forAll(masterSampleSets, setI) - { - writeSampleFile - ( - masterSampleSets[setI], - masterScalarFields, - setI, - timeDir, - writeFormat - ); - - writeSampleFile - ( - masterSampleSets[setI], - masterVectorFields, - setI, - timeDir, - writeFormat - ); - - writeSampleFile - ( - masterSampleSets[setI], - masterSphericalTensorFields, - setI, - timeDir, - writeFormat - ); - - writeSampleFile - ( - masterSampleSets[setI], - masterSymmTensorFields, - setI, - timeDir, - writeFormat - ); - - writeSampleFile - ( - masterSampleSets[setI], - masterTensorFields, - setI, - timeDir, - writeFormat - ); - } - - Info<< endl; - } - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict deleted file mode 100644 index de61f90f8314603960c53a0630b6687b5ad0cb28..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root "/home/penfold/mattijs/foam/mattijs2.1/run/icoFoam"; - case "cavity"; - instance "system"; - local ""; - - class dictionary; - object sampleDict; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// interpolationScheme : choice of -// cell : use cell-centre value only; constant over cells -// cellPoint : use cell-centre and vertex values -// cellPointFace : use cell-centre, vertex and face values. -// 1] vertex values determined from neighbouring cell-centre values -// 2] face values determined using the current face interpolation scheme -// for the field (linear, gamma, etc.) -interpolationScheme cellPoint; - - -// writeFormat : choice of -// xmgr -// jplot -// gnuplot -// raw -writeFormat raw; - - -// sampling definition: -// -// Dictionary with fields -// type : type of sampling method -// name : name of samples. Used e.g. as filename -// axis : how to write point coordinate -// ... : depending on method -// -// -// sample: choice of -// uniform evenly distributed points on line -// face one point per face intersection -// midPoint one point per cell, inbetween two face intersections -// midPointAndFace combination of face and midPoint -// -// curve specified points, not nessecary on line, uses -// tracking -// cloud specified points, uses findCell -// -// -// axis: how to write point coordinate. Choice of -// - x/y/z: x/y/z coordinate only -// - xyz: three columns -// (probably does not make sense for anything but raw) -// - distance: distance from start of sampling line (if uses line) or -// distance from first specified sampling point -// -// type specific: -// uniform, face, midPoint, midPointAndFace : start and end coordinate -// uniform: extra number of sampling points -// curve, cloud: list of coordinates -sampleSets -( - uniform - { - name lineX1; - axis distance; - - //- cavity - start (0.02 0.051 0.005); - end (0.06 0.051 0.005); - nPoints 10; - } - - face - { - name lineX2; - axis x; - - //- flangeHex - //start (0 20 -20); - //end (0 20 10); - - //- nablaCavity - //start (-1 0.05 0.005); - //end ( 1 0.05 0.005); - - //- cavity - start (0.0 0.51 0.005); - end (2 0.51 0.005); - nPoints 10; - } -); - - -// Fields to sample. -fields -( - p - mag(U) - U.component(1) - R.component(0) -); - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/test/testSample.C b/applications/utilities/postProcessing/sampling/sample/test/testSample.C deleted file mode 100644 index 0b4435abeb1d31c5f96991e7a052fa63caf2351f..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/test/testSample.C +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "meshSearch.H" -#include "interpolation.H" -#include "volPointInterpolation.H" -#include "PtrList.H" - -#include "writer.H" -#include "sampleSet.H" -#include "volFieldSampler.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: - -int main(int argc, char *argv[]) -{ - -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" - - - // - // 1. Sampling and writing. - // - - // Set up mesh searching - meshSearch searchEngine(mesh, true); - - // Construct sample points generator - dictionary sampleDict; - sampleDict.add("name", "lineX1"); - sampleDict.add("axis", "distance"); - sampleDict.add("start", point(0.02, 0.051, 0.005)); - sampleDict.add("end", point(0.06, 0.051, 0.005)); - sampleDict.add("nPoints", 10); - - PtrList<sampleSet> sampleSets(1); - sampleSets.set - ( - 0, - sampleSet::New - ( - "uniform", - mesh, - searchEngine, - sampleDict - ).ptr() - ); - - // Load field - volScalarField sField - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ - ), - mesh - ); - - // Set up interpolation - pointMesh pMesh(mesh); - volPointInterpolation pInterp(mesh, pMesh); - - - // Do actual sampling - dictionary interpolationSchemes; - interpolationSchemes.add("p", "cell"); - - volFieldSampler<scalar> sampleVals - ( - pInterp, - interpolationSchemes, - sField, - sampleSets - ); - - // Construct writer and write - autoPtr<writer<scalar> > scalarFormatter(writer<scalar>::New("xmgr")); - - scalarFormatter().write - ( - ".", - sampleSets[0], - sampleVals.name(), - sampleVals[0] - ); - - - - // - // 2. No sampling, just using writing - // - List<point> points(5); - points[0] = point(0, 0, 0); - points[1] = point(1, 1, 1); - points[2] = point(2, 2, 2); - points[3] = point(3, 3, 3); - points[4] = point(4, 4, 4); - - scalarList vals(5); - vals[0] = 0.0; - vals[1] = 0.1; - vals[2] = 0.2; - vals[3] = 0.3; - vals[4] = 0.4; - - - scalarFormatter().write - ( - ".", - coordSet - ( - "someLine", - "distance", - points, - points[0] - ), - "U.component(0)", - vals - ); - - - Info << "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/volFieldSampler.C b/applications/utilities/postProcessing/sampling/sample/volFieldSampler.C deleted file mode 100644 index 27938d24c1bd852644e7eb4bf6bdd90fed2871e4..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/volFieldSampler.C +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - -\*---------------------------------------------------------------------------*/ - -#include "volFieldSampler.H" -#include "volPointInterpolation.H" -#include "dictionary.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components -template <class Type> -Foam::volFieldSampler<Type>::volFieldSampler -( - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes, - const GeometricField<Type, fvPatchField, volMesh>& field, - const PtrList<sampleSet>& samplers -) -: - List<Field<Type> >(samplers.size()), - name_(field.name()) -{ - autoPtr<interpolation<Type> > interpolator - ( - interpolation<Type>::New(interpolationSchemes, pInterp, field) - ); - - forAll(samplers, setI) - { - Field<Type>& values = this->operator[](setI); - - const sampleSet& samples = samplers[setI]; - - values.setSize(samples.size()); - forAll(samples, sampleI) - { - const point& samplePt = samples[sampleI]; - label cellI = samples.cells()[sampleI]; - label faceI = samples.faces()[sampleI]; - - values[sampleI] = - interpolator().interpolate - ( - samplePt, - cellI, - faceI - ); - } - } -} - - -// Construct from components -template <class Type> -Foam::volFieldSampler<Type>::volFieldSampler -( - const List<Field<Type> >& values, - const word& name -) -: - List<Field<Type> >(values), - name_(name) -{} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/volFieldSampler.H b/applications/utilities/postProcessing/sampling/sample/volFieldSampler.H deleted file mode 100644 index 29222903ece962566f9d57b8d43abeef8ae325f5..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sample/volFieldSampler.H +++ /dev/null @@ -1,109 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::volFieldSampler - -Description - Samples a volField given a list of sampleSets (i.e. points). - -SourceFiles - volFieldSampler.C - -\*---------------------------------------------------------------------------*/ - -#ifndef volFieldSampler_H -#define volFieldSampler_H - -#include "sampleSet.H" -#include "List.H" -#include "PtrList.H" -#include "volFields.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class volPointInterpolation; -class dictionary; - -/*---------------------------------------------------------------------------*\ - Class volFieldSampler Declaration -\*---------------------------------------------------------------------------*/ - -template <class Type> -class volFieldSampler -: - public List<Field<Type> > -{ - //- Name of this collection of values - const word name_; - -public: - - // Constructors - - //- Construct from sampleSet, interpolator, Field - volFieldSampler - ( - const volPointInterpolation&, - const dictionary& interpolationSchemes, - const GeometricField<Type, fvPatchField, volMesh>& field, - const PtrList<sampleSet>& - ); - - //- Construct from components - volFieldSampler - ( - const List<Field<Type> >& values, - const word& name - ); - - // Member functions - - const word& name() const - { - return name_; - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "volFieldSampler.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/Make/files b/applications/utilities/postProcessing/sampling/sampleSurface/Make/files deleted file mode 100644 index 1016f8e914fecacd3d93cb132d366965050e7f58..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/Make/files +++ /dev/null @@ -1,18 +0,0 @@ -sampleSurface.C - -surfaces/surface/surface.C -surfaces/constantIsoSurface/constantIsoSurface.C -surfaces/interpolatedIsoSurface/interpolatedIsoSurface.C -surfaces/constantPatch/constantPatch.C -surfaces/interpolatedPatch/interpolatedPatch.C -surfaces/constantPlane/constantPlane.C -surfaces/interpolatedPlane/interpolatedPlane.C - -surfaceWriters/surfaceWriter/surfaceWriters.C -surfaceWriters/foamFile/foamFileWriters.C -surfaceWriters/dx/dxWriters.C -surfaceWriters/raw/rawWriters.C -surfaceWriters/vtk/vtkWriters.C -surfaceWriters/stl/stlWriters.C - -EXE = $(FOAM_APPBIN)/sampleSurface diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/fieldsCache.C b/applications/utilities/postProcessing/sampling/sampleSurface/fieldsCache.C deleted file mode 100644 index c5ea19c432059cca5af4ef2f4476045d90e9f1a6..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/fieldsCache.C +++ /dev/null @@ -1,105 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "fieldsCache.H" -#include "volPointInterpolation.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::fieldsCache<Type>::fieldsCache() -: - HashPtrTable<GeometricField<Type, fvPatchField, volMesh> >(), - pointFields_(), - interpolators_() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -const Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>& -Foam::fieldsCache<Type>::pointField -( - const word& name, - const volPointInterpolation& pInterp -) const -{ - if (!pointFields_.found(name)) - { - const GeometricField<Type, fvPatchField, volMesh>& vField = - *this->operator[](name); - - tmp<GeometricField<Type, pointPatchField, pointMesh> > tptField = - pInterp.interpolate(vField); - - GeometricField<Type, pointPatchField, pointMesh>* ptFieldPtr = - tptField.ptr(); - - pointFields_.insert(name, ptFieldPtr); - - return *ptFieldPtr; - } - else - { - return *pointFields_[name]; - } -} - - -template<class Type> -const Foam::interpolation<Type>& Foam::fieldsCache<Type>::interpolator -( - const word& name, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - if (!interpolators_.found(name)) - { - const GeometricField<Type, fvPatchField, volMesh>& vField = - *this->operator[](name); - - interpolation<Type>* interpolatorPtr = - interpolation<Type>::New - ( - interpolationSchemes, - pInterp, - vField - ).ptr(); - - interpolators_.insert(name, interpolatorPtr); - - return *interpolatorPtr; - } - else - { - return *interpolators_[name]; - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/fieldsCache.H b/applications/utilities/postProcessing/sampling/sampleSurface/fieldsCache.H deleted file mode 100644 index 98b6904a61d70e56038abb6b5a7aa138aa655a87..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/fieldsCache.H +++ /dev/null @@ -1,109 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::fieldsCache - -Description - -SourceFiles - fieldsCache.C - -\*---------------------------------------------------------------------------*/ - -#ifndef fieldsCache_H -#define fieldsCache_H - -#include "volFields.H" -#include "pointFields.H" -#include "HashPtrTable.H" -#include "interpolation.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class fieldsCache Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class fieldsCache -: - public HashPtrTable<GeometricField<Type, fvPatchField, volMesh> > -{ - -private: - - //- Cached pointFields - mutable HashPtrTable<GeometricField<Type, pointPatchField, pointMesh> > - pointFields_; - - //- Cached interpolators - mutable HashPtrTable<interpolation<Type> > interpolators_; - - -public: - - // Constructors - - //- Construct null - fieldsCache(); - - - // Member Functions - - //- Get pointField of named field - const GeometricField<Type, pointPatchField, pointMesh>& pointField - ( - const word&, - const volPointInterpolation& pInterp - ) const; - - //- Get interpolator for named field - const interpolation<Type>& interpolator - ( - const word&, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "fieldsCache.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/sampleSurface.C b/applications/utilities/postProcessing/sampling/sampleSurface/sampleSurface.C deleted file mode 100644 index cc7fcedc5440945a621ae56a484f1f1a0ea3414e..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/sampleSurface.C +++ /dev/null @@ -1,842 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "argList.H" -#include "OSspecific.H" -#include "meshSearch.H" -#include "interpolation.H" -#include "volPointInterpolation.H" -#include "cuttingPlane.H" -#include "OFstream.H" -#include "Pstream.H" -#include "ListListOps.H" -#include "Cloud.H" -#include "passiveParticle.H" -#include "mergePoints.H" - -#include "fieldsCache.H" -#include "surface.H" -#include "surfaceWriter.H" - -using namespace Foam; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Used to offset faces in Pstream::combineOffset -namespace Foam -{ - -template <> -class offsetOp<face> -{ - -public: - - face operator() - ( - const face& x, - const label offset - ) const - { - face result(x.size()); - - forAll(x, xI) - { - result[xI] = x[xI] + offset; - } - return result; - } -}; - -} - - -void mergePoints -( - const polyMesh& mesh, - const scalar mergeTol, - List<pointField>& allPoints, - List<faceList>& allFaces, - labelListList& allOldToNew -) -{ - const boundBox& bb = mesh.globalData().bb(); - - scalar mergeDim = mergeTol * mag(bb.max() - bb.min()); - - Info<< nl << "Merging all points within " << mergeDim << " meter." << endl; - - allOldToNew.setSize(allPoints.size()); - - forAll(allPoints, surfaceI) - { - pointField newPoints; - labelList oldToNew; - - bool hasMerged = mergePoints - ( - allPoints[surfaceI], - mergeDim, - false, // verbosity - oldToNew, - newPoints - ); - - if (hasMerged) - { - // Copy points - allPoints[surfaceI].transfer(newPoints); - - // Store point mapping - allOldToNew[surfaceI].transfer(oldToNew); - - // Relabel faces. - faceList& faces = allFaces[surfaceI]; - - forAll(faces, faceI) - { - inplaceRenumber(allOldToNew[surfaceI], faces[faceI]); - } - - Info<< "For surface " << surfaceI << " merged from " - << allOldToNew[surfaceI].size() << " points down to " - << allPoints[surfaceI].size() << " points." << endl; - } - } -} - - -template<class T> -void renumberData -( - const labelList& oldToNewPoints, - const label newSize, - Field<T>& values -) -{ - if (oldToNewPoints.size() == values.size()) - { - inplaceReorder(oldToNewPoints, values); - values.setSize(newSize); - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Main program: - -int main(int argc, char *argv[]) -{ - -# include "addTimeOptions.H" -# include "setRootCase.H" - -# include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - - // set startTime and endTime depending on -time and -latestTime options -# include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); - -# include "createMesh.H" - - - // - // Hack: initialize Cloud to initialize the processor table so from - // now on we can use cloud (in meshSearch) on single processors only. - // - Cloud<passiveParticle> dummyCloud(mesh, IDLList<passiveParticle>()); - - // - // Read control dictionary - // - - IOdictionary sampleDict - ( - IOobject - ( - "sampleSurfaceDict", - runTime.system(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - const word interpolationScheme(sampleDict.lookup("interpolationScheme")); - const wordList fieldNames = sampleDict.lookup("fields"); - - // - // Construct writers - // - - word writeFormat(sampleDict.lookup("surfaceFormat")); - - autoPtr<surfaceWriter<scalar> > scalarFormatter - ( - surfaceWriter<scalar>::New(writeFormat) - ); - autoPtr<surfaceWriter<vector> > vectorFormatter - ( - surfaceWriter<vector>::New(writeFormat) - ); - autoPtr<surfaceWriter<sphericalTensor> > sphericalTensorFormatter - ( - surfaceWriter<sphericalTensor>::New(writeFormat) - ); - autoPtr<surfaceWriter<symmTensor> > symmTensorFormatter - ( - surfaceWriter<symmTensor>::New(writeFormat) - ); - autoPtr<surfaceWriter<tensor> > tensorFormatter - ( - surfaceWriter<tensor>::New(writeFormat) - ); - - // - // Construct interpolation dictionary (same interpolation for all fields) - // - - dictionary interpolationSchemes; - - forAll(fieldNames, fieldI) - { - interpolationSchemes.add - ( - fieldNames[fieldI], - interpolationScheme - ); - } - - fileName samplePath; - - if (Pstream::parRun()) - { - samplePath = runTime.path()/".."/"sampleSurfaces"; - } - else - { - samplePath = runTime.path()/"sampleSurfaces"; - } - - if (Pstream::master() && exists(samplePath)) - { - Info<< "Deleting sampleSurfaces/ directory" << endl << endl; - rmDir(samplePath); - } - - // Set up interpolation - autoPtr<pointMesh> pMeshPtr(new pointMesh(mesh)); - autoPtr<volPointInterpolation> pInterpPtr - ( - new volPointInterpolation(mesh, pMeshPtr()) - ); - - // Set up mesh searching - meshSearch searchEngine(mesh, true); - - // Create sample surfaces - PtrList<surface> surfaces - ( - sampleDict.lookup("surfaces"), - surface::iNew(mesh, searchEngine) - ); - Info<< endl; - - - fileName oldPointsDir("constant"); - - - for (label i=startTime; i<endTime; i++) - { - runTime.setTime(Times[i], i); - - Info<< "Time = " << runTime.timeName() << endl; - - // - // Handle geometry/topology changes - // - polyMesh::readUpdateState state = mesh.readUpdate(); - - bool meshChanged = false; - - if - ( - state == polyMesh::POINTS_MOVED - || state == polyMesh::TOPO_CHANGE - ) - { - // Geometry and topology changes - searchEngine.correct(); - - pMeshPtr.reset(new pointMesh(mesh)); - - pInterpPtr.reset(new volPointInterpolation(mesh, pMeshPtr())); - - meshChanged = true; - } - - if (Pstream::master()) - { - Info<< "Creating directory " << samplePath/runTime.timeName() - << endl << endl; - - mkDir(samplePath/runTime.timeName()); - } - - - // - // Cache used fields and interpolators - // - - fieldsCache<scalar> scalarCache; - fieldsCache<vector> vectorCache; - fieldsCache<sphericalTensor> sphericalTensorCache; - fieldsCache<symmTensor> symmTensorCache; - fieldsCache<tensor> tensorCache; - - forAll(fieldNames, fieldI) - { - const word& fieldName = fieldNames[fieldI]; - - IOobject fieldHeader - ( - fieldName, - runTime.timeName(), - mesh, - IOobject::MUST_READ - ); - - if (fieldHeader.headerOk()) - { - if - ( - fieldHeader.headerClassName() == volScalarField::typeName - ) - { - Info<< "Loading " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volScalarField* fieldPtr - ( - new volScalarField - ( - fieldHeader, - mesh - ) - ); - - scalarCache.insert(fieldName, fieldPtr); - } - - else if - ( - fieldHeader.headerClassName() == volVectorField::typeName - ) - { - Info<< "Loading " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volVectorField* fieldPtr - ( - new volVectorField - ( - fieldHeader, - mesh - ) - ); - - vectorCache.insert(fieldName, fieldPtr); - } - - else if - ( - fieldHeader.headerClassName() - == volSphericalTensorField::typeName - ) - { - Info<< "Loading " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volSphericalTensorField* fieldPtr - ( - new volSphericalTensorField - ( - fieldHeader, - mesh - ) - ); - - sphericalTensorCache.insert(fieldName, fieldPtr); - } - - else if - ( - fieldHeader.headerClassName() - == volSymmTensorField::typeName - ) - { - Info<< "Loading " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volSymmTensorField* fieldPtr - ( - new volSymmTensorField - ( - fieldHeader, - mesh - ) - ); - - symmTensorCache.insert(fieldName, fieldPtr); - } - - else if - ( - fieldHeader.headerClassName() == volTensorField::typeName - ) - { - Info<< "Loading " << fieldHeader.headerClassName() - << ' ' << fieldName << endl; - - volTensorField* fieldPtr - ( - new volTensorField - ( - fieldHeader, - mesh - ) - ); - - tensorCache.insert(fieldName, fieldPtr); - } - } - } - - - - // - // Now we have fields cached and know whether mesh has changed. - // Update surfaces with this information. - // - - forAll(surfaces, surfaceI) - { - surfaces[surfaceI].correct - ( - meshChanged, - pInterpPtr, - interpolationSchemes, - scalarCache - ); - } - - - // - // Combine surfaces onto master (bug:should not be redone for static - // meshes) - // - - List<pointField> allPoints(surfaces.size()); - List<faceList> allFaces(surfaces.size()); - - forAll(surfaces, surfaceI) - { - // Collect points from all processors - List<pointField> gatheredPoints(Pstream::nProcs()); - gatheredPoints[Pstream::myProcNo()] = surfaces[surfaceI].points(); - Pstream::gatherList(gatheredPoints); - - if (Pstream::master()) - { - allPoints[surfaceI] = ListListOps::combine<pointField> - ( - gatheredPoints, - accessOp<pointField>() - ); - } - - // Collect faces from all processors and renumber using sizes of - // gathered points - List<faceList> gatheredFaces(Pstream::nProcs()); - gatheredFaces[Pstream::myProcNo()] = surfaces[surfaceI].faces(); - Pstream::gatherList(gatheredFaces); - - if (Pstream::master()) - { - allFaces[surfaceI] = static_cast<const faceList&> - ( - ListListOps::combineOffset<faceList> - ( - gatheredFaces, - ListListOps::subSizes - ( - gatheredPoints, - accessOp<pointField>() - ), - accessOp<faceList>(), - offsetOp<face>() - ) - ); - } - } - - // Merge close points (1E-10 of mesh bounding box) - labelListList allOldToNewPoints; - mergePoints(mesh, 1E-10, allPoints, allFaces, allOldToNewPoints); - - - // - // Do actual interpolation - // - - forAll(fieldNames, fieldI) - { - Info<< endl; - - const word& fieldName = fieldNames[fieldI]; - - // Scalar fields - - if (scalarCache.found(fieldName)) - { - Info<< "Sampling volScalarField " << fieldName << endl << endl; - - forAll(surfaces, surfaceI) - { - const surface& s = surfaces[surfaceI]; - - scalarField values - ( - s.interpolate - ( - fieldName, - scalarCache, - pInterpPtr, - interpolationSchemes - ) - ); - - // Collect values from all processors - List<scalarField> gatheredValues(Pstream::nProcs()); - gatheredValues[Pstream::myProcNo()] = values; - Pstream::gatherList(gatheredValues); - - if (Pstream::master()) - { - // Combine values into single field - scalarField allValues - ( - ListListOps::combine<scalarField> - ( - gatheredValues, - accessOp<scalarField>() - ) - ); - - // Renumber (point data) to correspond to merged points - renumberData - ( - allOldToNewPoints[surfaceI], - allPoints[surfaceI].size(), - allValues - ); - - // Write to time directory under sampleSurfaces/ - scalarFormatter().write - ( - samplePath, - runTime.timeName(), - s.name(), - allPoints[surfaceI], - allFaces[surfaceI], - fieldName, - allValues - ); - } - } - } - - // Vector fields - - else if (vectorCache.found(fieldName)) - { - Info<< "Sampling volVectorField " << fieldName << endl << endl; - - forAll(surfaces, surfaceI) - { - const surface& s = surfaces[surfaceI]; - - vectorField values - ( - s.interpolate - ( - fieldName, - vectorCache, - pInterpPtr, - interpolationSchemes - ) - ); - - // Collect values from all processors - List<vectorField> gatheredValues(Pstream::nProcs()); - gatheredValues[Pstream::myProcNo()] = values; - Pstream::gatherList(gatheredValues); - - if (Pstream::master()) - { - vectorField allValues - ( - ListListOps::combine<vectorField> - ( - gatheredValues, - accessOp<vectorField>() - ) - ); - - // Renumber (point data) to correspond to merged points - renumberData - ( - allOldToNewPoints[surfaceI], - allPoints[surfaceI].size(), - allValues - ); - - // Write to time directory under sampleSurfaces/ - vectorFormatter().write - ( - samplePath, - runTime.timeName(), - s.name(), - allPoints[surfaceI], - allFaces[surfaceI], - fieldName, - allValues - ); - } - } - } - - // SphericalTensor fields - - else if (sphericalTensorCache.found(fieldName)) - { - Info<< "Sampling volSphericalTensorField " - << fieldName << endl << endl; - - forAll(surfaces, surfaceI) - { - const surface& s = surfaces[surfaceI]; - - sphericalTensorField values - ( - s.interpolate - ( - fieldName, - sphericalTensorCache, - pInterpPtr, - interpolationSchemes - ) - ); - - // Collect values from all processors - List<sphericalTensorField> - gatheredValues(Pstream::nProcs()); - - gatheredValues[Pstream::myProcNo()] = values; - Pstream::gatherList(gatheredValues); - - if (Pstream::master()) - { - sphericalTensorField allValues - ( - ListListOps::combine<sphericalTensorField> - ( - gatheredValues, - accessOp<sphericalTensorField>() - ) - ); - - // Renumber (point data) to correspond to merged points - renumberData - ( - allOldToNewPoints[surfaceI], - allPoints[surfaceI].size(), - allValues - ); - - // Write to time directory under sampleSurfaces/ - sphericalTensorFormatter().write - ( - samplePath, - runTime.timeName(), - s.name(), - allPoints[surfaceI], - allFaces[surfaceI], - fieldName, - allValues - ); - } - } - } - - // SymmTensor fields - - else if (symmTensorCache.found(fieldName)) - { - Info<< "Sampling volSymmTensorField " - << fieldName << endl << endl; - - forAll(surfaces, surfaceI) - { - const surface& s = surfaces[surfaceI]; - - symmTensorField values - ( - s.interpolate - ( - fieldName, - symmTensorCache, - pInterpPtr, - interpolationSchemes - ) - ); - - // Collect values from all processors - List<symmTensorField> gatheredValues(Pstream::nProcs()); - gatheredValues[Pstream::myProcNo()] = values; - Pstream::gatherList(gatheredValues); - - if (Pstream::master()) - { - symmTensorField allValues - ( - ListListOps::combine<symmTensorField> - ( - gatheredValues, - accessOp<symmTensorField>() - ) - ); - - // Renumber (point data) to correspond to merged points - renumberData - ( - allOldToNewPoints[surfaceI], - allPoints[surfaceI].size(), - allValues - ); - - // Write to time directory under sampleSurfaces/ - symmTensorFormatter().write - ( - samplePath, - runTime.timeName(), - s.name(), - allPoints[surfaceI], - allFaces[surfaceI], - fieldName, - allValues - ); - } - } - } - - // Tensor fields - - else if (tensorCache.found(fieldName)) - { - Info<< "Sampling volTensorField " << fieldName << endl << endl; - - forAll(surfaces, surfaceI) - { - const surface& s = surfaces[surfaceI]; - - tensorField values - ( - s.interpolate - ( - fieldName, - tensorCache, - pInterpPtr, - interpolationSchemes - ) - ); - - // Collect values from all processors - List<tensorField> gatheredValues(Pstream::nProcs()); - gatheredValues[Pstream::myProcNo()] = values; - Pstream::gatherList(gatheredValues); - - if (Pstream::master()) - { - tensorField allValues - ( - ListListOps::combine<tensorField> - ( - gatheredValues, - accessOp<tensorField>() - ) - ); - - // Renumber (point data) to correspond to merged points - renumberData - ( - allOldToNewPoints[surfaceI], - allPoints[surfaceI].size(), - allValues - ); - - // Write to time directory under sampleSurfaces/ - tensorFormatter().write - ( - samplePath, - runTime.timeName(), - s.name(), - allPoints[surfaceI], - allFaces[surfaceI], - fieldName, - allValues - ); - } - } - } - } - - Info<< endl; - } - - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/sampleSurfaceDict b/applications/utilities/postProcessing/sampling/sampleSurface/sampleSurfaceDict deleted file mode 100644 index 6065785638ed55142d2295ea177235d73db558d8..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/sampleSurfaceDict +++ /dev/null @@ -1,117 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root "/home/penfold/mattijs/foam/mattijs2.1/run/icoFoam"; - case "cavity"; - instance "system"; - local ""; - - class dictionary; - object sampleDict; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -// Output format. Choice of -// foamFile : separate points, faces and values file -// dx : DX scalar or vector format -// vtk : VTK ascii format -// raw : x y z value format for use with e.g. gnuplot 'splot'. -// stl : ascii stl. Does not contain values! -surfaceFormat vtk; - - -// interpolationScheme : choice of -// cell : use cell-centre value only; constant over cells -// cellPoint : use cell-centre and vertex values -// cellPointFace : use cell-centre, vertex and face values. -// 1] vertex values determined from neighbouring cell-centre values -// 2] face values determined using the current face interpolation scheme -// for the field (linear, gamma, etc.) -interpolationScheme cellPointFace; - - -// sampling definition: choice of -// interpolatedPlane : values on plane defined by point, normal. -// One value per vertex using above -// interpolationScheme -// constantPlane : values on plane defined by point, normal. -// One (cell centre) value per triangle -// constantPatch : values on patch. One (face centre) value -// per triangle. -surfaces -( - constantPlane - { - name constantPlane; - - basePoint (0.05 0.05 0.005); - normalVector (0.1 0.1 1); - - // Optional: whether to leave as faces or triangulate (=default) - triangulate false; - } - - interpolatedPlane - { - name interpolatedPlane; - - basePoint (0.05 0.05 0.005); - normalVector (0.1 0.1 1); - - triangulate false; - } - - - constantPatch - { - name movingWall_constant; - patchName movingWall; - - triangulate false; - } - - interpolatedPatch - { - name movingWall_interpolated; - patchName movingWall; - - triangulate false; - } - - constantIsoSurface - { - name constantIso; - field p; - value 0; - } - interpolatedIsoSurface - { - name someIso; - field p; - value 0; - } -); - - -// Fields to sample. Note: need to include isoSurface fields. -fields -( - p - U -); - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dx.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dx.C deleted file mode 100644 index 37bd38ace0cbd1f1cb1a8ef42907c2e874c83c2d..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dx.C +++ /dev/null @@ -1,325 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "dx.H" -#include "fileName.H" -#include "OFstream.H" -#include "faceList.H" -#include "OSspecific.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -void Foam::dx<Type>::writeDXGeometry -( - const pointField& points, - const faceList& faces, - Ostream& os -) const -{ - // Write vertex coordinates - - os << "# The irregular positions" << nl - << "object 1 class array type float rank 1 shape 3 items " - << points.size() << " data follows" << nl; - - forAll(points, pointI) - { - const point& pt = points[pointI]; - - os << float(pt.x()) << ' ' << float(pt.y()) << ' ' << float(pt.z()) - << nl; - } - os << nl; - - // Write triangles - - os << "# The irregular connections (triangles)" << nl - << "object 2 class array type int rank 1 shape 3 items " - << faces.size() << " data follows" << nl; - - forAll(faces, faceI) - { - const face& f = faces[faceI]; - - if (f.size() != 3) - { - FatalErrorIn - ( - "writeDXGeometry(Ostream&, const pointField&, const faceList&)" - ) << "Face " << faceI << " vertices " << f - << " is not a triangle." - << exit(FatalError); - } - - os << f[0] << ' ' << f[1] << ' ' << f[2] << nl; - } - os << "attribute \"element type\" string \"triangles\"" << nl - << "attribute \"ref\" string \"positions\"" << nl << nl; -} - - -// Write scalarField in DX format -template<class Type> -void Foam::dx<Type>::writeDXData -( - const pointField& points, - const scalarField& values, - Ostream& os -) const -{ - // Write data - os << "object 3 class array type float rank 0 items " - << values.size() - << " data follows" << nl; - - forAll(values, elemI) - { - os << float(values[elemI]) << nl; - } - - if (values.size() == points.size()) - { - os << nl << "attribute \"dep\" string \"positions\"" - << nl << nl; - } - else - { - os << nl << "attribute \"dep\" string \"connections\"" - << nl << nl; - } -} - - -// Write vectorField in DX format -template<class Type> -void Foam::dx<Type>::writeDXData -( - const pointField& points, - const vectorField& values, - Ostream& os -) const -{ - // Write data - os << "object 3 class array type float rank 1 shape 3 items " - << values.size() - << " data follows" << nl; - - forAll(values, elemI) - { - os << float(values[elemI].x()) << ' ' - << float(values[elemI].y()) << ' ' - << float(values[elemI].z()) << nl; - } - - if (values.size() == points.size()) - { - os << nl << "attribute \"dep\" string \"positions\"" - << nl << nl; - } - else - { - os << nl << "attribute \"dep\" string \"connections\"" - << nl << nl; - } -} - - -// Write sphericalTensorField in DX format -template<class Type> -void Foam::dx<Type>::writeDXData -( - const pointField& points, - const sphericalTensorField& values, - Ostream& os -) const -{ - // Write data - os << "object 3 class array type float rank 0 items " - << values.size() - << " data follows" << nl; - - forAll(values, elemI) - { - os << float(values[elemI][0]) << nl; - } - - if (values.size() == points.size()) - { - os << nl << "attribute \"dep\" string \"positions\"" - << nl << nl; - } - else - { - os << nl << "attribute \"dep\" string \"connections\"" - << nl << nl; - } -} - - -// Write symmTensorField in DX format -template<class Type> -void Foam::dx<Type>::writeDXData -( - const pointField& points, - const symmTensorField& values, - Ostream& os -) const -{ - // Write data - os << "object 3 class array type float rank 2 shape 3 items " - << values.size() - << " data follows" << nl; - - forAll(values, elemI) - { - const symmTensor& t = values[elemI]; - - os << float(t.xx()) << ' ' << float(t.xy()) << ' ' << float(t.xz()) - << float(t.xy()) << ' ' << float(t.yy()) << ' ' << float(t.yz()) - << float(t.xz()) << ' ' << float(t.yz()) << ' ' << float(t.zz()) - << nl; - } - - if (values.size() == points.size()) - { - os << nl << "attribute \"dep\" string \"positions\"" - << nl << nl; - } - else - { - os << nl << "attribute \"dep\" string \"connections\"" - << nl << nl; - } -} - - -// Write tensorField in DX format -template<class Type> -void Foam::dx<Type>::writeDXData -( - const pointField& points, - const tensorField& values, - Ostream& os -) const -{ - // Write data - os << "object 3 class array type float rank 2 shape 3 items " - << values.size() - << " data follows" << nl; - - forAll(values, elemI) - { - const tensor& t = values[elemI]; - - os << float(t.xx()) << ' ' << float(t.xy()) << ' ' << float(t.xz()) - << float(t.yx()) << ' ' << float(t.yy()) << ' ' << float(t.yz()) - << float(t.zx()) << ' ' << float(t.zy()) << ' ' << float(t.zz()) - << nl; - } - - if (values.size() == points.size()) - { - os << nl << "attribute \"dep\" string \"positions\"" - << nl << nl; - } - else - { - os << nl << "attribute \"dep\" string \"connections\"" - << nl << nl; - } -} - - -// Write trailer in DX format -template<class Type> -void Foam::dx<Type>::writeDXTrailer(Ostream& os) const -{ - os << "# the field, with three components: \"positions\"," - << " \"connections\", and \"data\"" << nl - << "object \"irregular positions irregular " - << "connections\" class field" - << nl - << "component \"positions\" value 1" << nl - << "component \"connections\" value 2" << nl - << "component \"data\" value 3" << nl; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::dx<Type>::dx() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::dx<Type>::~dx() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::dx<Type>::write -( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values -) const -{ - fileName surfaceDir(samplePath/timeDir); - - if (!exists(surfaceDir)) - { - mkDir(surfaceDir); - } - - fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".dx"); - - Info<< "Writing field " << fieldName << " to " << planeFName << endl; - - OFstream dxFile(planeFName); - - writeDXGeometry(points, faces, dxFile); - - writeDXData(points, values, dxFile); - - writeDXTrailer(dxFile); - - dxFile << "end" << nl; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dx.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dx.H deleted file mode 100644 index 8732ac1ae0284a09b1750a929ad1e96b118689a0..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dx.H +++ /dev/null @@ -1,150 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::dx - -Description - -SourceFiles - dx.C - -\*---------------------------------------------------------------------------*/ - -#ifndef dx_H -#define dx_H - -#include "surfaceWriter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class dx Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class dx -: - public surfaceWriter<Type> -{ - - // Private Member Functions - - void writeDXGeometry - ( - const pointField& points, - const faceList& faces, - Ostream& os - ) const; - - void writeDXData - ( - const pointField& points, - const scalarField& values, - Ostream& os - ) const; - - void writeDXData - ( - const pointField& points, - const vectorField& values, - Ostream& os - ) const; - - void writeDXData - ( - const pointField& points, - const sphericalTensorField& values, - Ostream& os - ) const; - - void writeDXData - ( - const pointField& points, - const symmTensorField& values, - Ostream& os - ) const; - - void writeDXData - ( - const pointField& points, - const tensorField& values, - Ostream& os - ) const; - - void writeDXTrailer(Ostream& os) const; - -public: - - //- Runtime type information - TypeName("dx"); - - - // Constructors - - //- Construct null - dx(); - - - // Destructor - - virtual ~dx(); - - - // Member Functions - - // Write - - //- Writes single surface to file. - virtual void write - ( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "dx.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dxWriters.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dxWriters.H deleted file mode 100644 index 39dfedabdd1e94e5780f36e7a7c52f747f905a4c..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dxWriters.H +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -InClass - Foam::dxWriters - -Description - -SourceFiles - dxWriters.C - -\*---------------------------------------------------------------------------*/ - -#ifndef dxWriters_H -#define dxWriters_H - -#include "dx.H" -#include "surfaceWriters.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -typedef dx<scalar> dxScalarWriter; -typedef dx<vector> dxVectorWriter; -typedef dx<sphericalTensor> dxSphericalTensorWriter; -typedef dx<symmTensor> dxSymmTensorWriter; -typedef dx<tensor> dxTensorWriter; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFile.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFile.C deleted file mode 100644 index 9c54699c40a82446bb0276958298c61210850991..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFile.C +++ /dev/null @@ -1,99 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "foamFile.H" -#include "fileName.H" -#include "OFstream.H" -#include "faceList.H" -#include "OSspecific.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::foamFile<Type>::foamFile() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::foamFile<Type>::~foamFile() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::foamFile<Type>::write -( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values -) const -{ - fileName planeFName(samplePath/timeDir/surfaceName); - - if (!exists(planeFName)) - { - mkDir(planeFName); - } - - Info<< "Writing field " << fieldName << " to " << planeFName << endl; - - // Points - OFstream pointsFile(planeFName/"points"); - - pointsFile << points; - - // Faces - OFstream facesFile(planeFName/"faces"); - - facesFile << faces; - - // Values to separate directory (e.g. "scalarField/p") - - fileName foamName(pTraits<Type>::typeName); - - fileName valuesDir(planeFName / (foamName + Field<Type>::typeName)); - - if (!exists(valuesDir)) - { - mkDir(valuesDir); - } - - OFstream valuesFile(valuesDir/fieldName); - - valuesFile << values; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFile.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFile.H deleted file mode 100644 index 3f5d1455e6eb31793f3f15ec681c273a07121e8b..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFile.H +++ /dev/null @@ -1,104 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::foamFile - -Description - -SourceFiles - foamFile.C - -\*---------------------------------------------------------------------------*/ - -#ifndef foamFile_H -#define foamFile_H - -#include "surfaceWriter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class foamFile Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class foamFile -: - public surfaceWriter<Type> -{ - -public: - - //- Runtime type information - TypeName("foamFile"); - - - // Constructors - - //- Construct null - foamFile(); - - - // Destructor - - virtual ~foamFile(); - - - // Member Functions - - // Write - - //- Writes single surface to file. - virtual void write - ( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "foamFile.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/raw.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/raw.C deleted file mode 100644 index 9aaa6a4f7ed7e8a1df84a3ae976005e1833a622d..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/raw.C +++ /dev/null @@ -1,359 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "raw.H" -#include "fileName.H" -#include "OFstream.H" -#include "faceList.H" -#include "OSspecific.H" -#include "IOmanip.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -void Foam::raw<Type>::writeGeometry -( - const pointField& points, - const label& pointI, - Ostream& os -) const -{ - const point& pt = points[pointI]; - - os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' '; -} - - -template<class Type> -void Foam::raw<Type>::writeGeometry -( - const pointField& points, - const faceList& faces, - const label& faceI, - Ostream& os -) const -{ - const point& ct = faces[faceI].centre(points); - - os << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' '; -} - -// Write scalarField in raw format -template<class Type> -void Foam::raw<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const scalarField& values, - Ostream& os -) const -{ - // header - os << "# " << fieldName; - - if (values.size() == points.size()) - { - os << " POINT_DATA " << values.size() - << nl; - } - else - { - os << " FACE_DATA " << values.size() - << nl; - } - - os << "# x y z " << fieldName - << endl; - - // Write data - forAll(values, elemI) - { - if (values.size() == points.size()) - { - writeGeometry(points, elemI, os); - } - else - { - writeGeometry(points, faces, elemI, os); - } - os << values[elemI] << endl; - } - os << nl; -} - - -// Write vectorField in raw format -template<class Type> -void Foam::raw<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const vectorField& values, - Ostream& os -) const -{ - // header - os << "# " << fieldName; - - if (values.size() == points.size()) - { - os << " POINT_DATA " << values.size() - << nl; - } - else - { - os << " FACE_DATA " << values.size() - << nl; - } - - os << "# x y z " - << fieldName << "_x " - << fieldName << "_y " - << fieldName << "_z " - << endl; - - // Write data - forAll(values, elemI) - { - const vector& v = values[elemI]; - - if (values.size() == points.size()) - { - writeGeometry(points, elemI, os); - } - else - { - writeGeometry(points, faces, elemI, os); - } - - os << v[0] << ' ' << v[1] << ' ' << v[2] << nl; - } -} - - -// Write sphericalTensorField in raw format -template<class Type> -void Foam::raw<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const sphericalTensorField& values, - Ostream& os -) const -{ - // header - os << "# " << fieldName; - - if (values.size() == points.size()) - { - os << " POINT_DATA " << values.size() - << nl; - } - else - { - os << " FACE_DATA " << values.size() - << nl; - } - - os << "# ii "; - os << fieldName << "_ii" << endl; - - // Write data - forAll(values, elemI) - { - const sphericalTensor& v = values[elemI]; - - if (values.size() == points.size()) - { - writeGeometry(points, elemI, os); - } - else - { - writeGeometry(points, faces, elemI, os); - } - - os << v[0] << nl; - } -} - - -// Write symmTensorField in raw format -template<class Type> -void Foam::raw<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const symmTensorField& values, - Ostream& os -) const -{ - // header - os << "# " << fieldName; - - if (values.size() == points.size()) - { - os << " POINT_DATA " << values.size() - << nl; - } - else - { - os << " FACE_DATA " << values.size() - << nl; - } - - os << "# xx xy xz yy yz "; - for(int i=0; i<6; i++) - { - os << fieldName << "_" << i << " "; - } - os << endl; - - // Write data - forAll(values, elemI) - { - const symmTensor& v = values[elemI]; - - if (values.size() == points.size()) - { - writeGeometry(points, elemI, os); - } - else - { - writeGeometry(points, faces, elemI, os); - } - - os << v[0] << ' ' << v[1] << ' ' << v[2] - << v[3] << ' ' << v[4] << ' ' << v[5] - << nl; - } -} - - -// Write tensorField in raw format -template<class Type> -void Foam::raw<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const tensorField& values, - Ostream& os -) const -{ - // header - os << "# " << fieldName; - - if (values.size() == points.size()) - { - os << " POINT_DATA " << values.size() - << nl; - } - else - { - os << " FACE_DATA " << values.size() - << nl; - } - - os << "# xx xy xz yx yy yz zx zy zz"; - for(int i=0; i<9; i++) - { - os << fieldName << "_" << i << " "; - } - os << endl; - - // Write data - forAll(values, elemI) - { - const tensor& v = values[elemI]; - - if (values.size() == points.size()) - { - writeGeometry(points, elemI, os); - } - else - { - writeGeometry(points, faces, elemI, os); - } - - os << v[0] << ' ' << v[1] << ' ' << v[2] - << v[3] << ' ' << v[4] << ' ' << v[5] - << v[6] << ' ' << v[7] << ' ' << v[8] << nl; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::raw<Type>::raw() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::raw<Type>::~raw() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::raw<Type>::write -( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values -) const -{ - fileName surfaceDir(samplePath/timeDir); - - if (!exists(surfaceDir)) - { - mkDir(surfaceDir); - } - - fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".raw"); - - Info<< "Writing field " << fieldName << " to " << planeFName << endl; - - OFstream rawFile(planeFName); - - writeData(fieldName, points, faces, values, rawFile); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/raw.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/raw.H deleted file mode 100644 index a98e44bdc6d401c6cfb01dce455eaf3d865e79cb..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/raw.H +++ /dev/null @@ -1,166 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::raw - -Description - -SourceFiles - raw.C - -\*---------------------------------------------------------------------------*/ - -#ifndef raw_H -#define raw_H - -#include "surfaceWriter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class raw Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class raw -: - public surfaceWriter<Type> -{ - - // Private Member Functions - - void writeGeometry - ( - const pointField& points, - const label& pointI, - Ostream& os - ) const; - - void writeGeometry - ( - const pointField& points, - const faceList& faces, - const label& faceI, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const scalarField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const vectorField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const sphericalTensorField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const symmTensorField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const faceList& faces, - const tensorField& values, - Ostream& os - ) const; - - -public: - - //- Runtime type information - TypeName("raw"); - - - // Constructors - - //- Construct null - raw(); - - // Destructor - - virtual ~raw(); - - - // Member Functions - - // Write - - //- Writes single surface to file. - virtual void write - ( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "raw.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/rawWriters.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/rawWriters.H deleted file mode 100644 index 63012f65128c7e79dfc52f434db3e1705794a5be..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/rawWriters.H +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -InClass - Foam::rawWriters - -Description - -SourceFiles - rawWriters.C - -\*---------------------------------------------------------------------------*/ - -#ifndef rawWriters_H -#define rawWriters_H - -#include "raw.H" -#include "surfaceWriters.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -typedef raw<scalar> rawScalarWriter; -typedef raw<vector> rawVectorWriter; -typedef raw<sphericalTensor> rawSphericalTensorWriter; -typedef raw<symmTensor> rawSymmTensorWriter; -typedef raw<tensor> rawTensorWriter; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stl.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stl.C deleted file mode 100644 index e35b6a915f13f019d3137ae5a7e61a1e2e4bf3fa..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stl.C +++ /dev/null @@ -1,112 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "stl.H" -#include "fileName.H" -#include "OFstream.H" -#include "faceList.H" -#include "OSspecific.H" -#include "triSurface.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::stl<Type>::stl() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::stl<Type>::~stl() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::stl<Type>::write -( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values -) const -{ - fileName surfaceDir(samplePath/timeDir); - - if (!exists(surfaceDir)) - { - mkDir(surfaceDir); - } - - fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".stl"); - - Info<< "Writing field " << fieldName << " to " << planeFName << endl; - - - // Convert faces to triangles. - DynamicList<labelledTri> tris(faces.size()); - - forAll(faces, i) - { - const face& f = faces[i]; - - faceList triFaces(f.nTriangles(points)); - label nTris = 0; - f.triangles(points, nTris, triFaces); - - forAll(triFaces, triI) - { - const face& tri = triFaces[triI]; - tris.append(labelledTri(tri[0], tri[1], tri[2], 0)); - } - } - - triSurface - ( - tris.shrink(), - geometricSurfacePatchList - ( - 1, - geometricSurfacePatch - ( - "patch", // geometricType - string::validate<word>(fieldName), // fieldName - 0 // index - ) - ), - points - ).write(planeFName); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stl.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stl.H deleted file mode 100644 index 528969dffa0e348cd9691c279260a5fb3c003d1a..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stl.H +++ /dev/null @@ -1,104 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::stl - -Description - -SourceFiles - stl.C - -\*---------------------------------------------------------------------------*/ - -#ifndef stl_H -#define stl_H - -#include "surfaceWriter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class stl Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class stl -: - public surfaceWriter<Type> -{ - -public: - - //- Runtime type information - TypeName("stl"); - - - // Constructors - - //- Construct null - stl(); - - - // Destructor - - virtual ~stl(); - - - // Member Functions - - // Write - - //- Writes single surface to file. - virtual void write - ( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "stl.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stlWriters.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stlWriters.H deleted file mode 100644 index 735587ef8bec67b57c0317252880c1edb9047459..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stlWriters.H +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -InClass - Foam::stlWriters - -Description - -SourceFiles - stlWriters.C - -\*---------------------------------------------------------------------------*/ - -#ifndef stlWriters_H -#define stlWriters_H - -#include "stl.H" -#include "surfaceWriters.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -typedef stl<scalar> stlScalarWriter; -typedef stl<vector> stlVectorWriter; -typedef stl<sphericalTensor> stlSphericalTensorWriter; -typedef stl<symmTensor> stlSymmTensorWriter; -typedef stl<tensor> stlTensorWriter; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriter.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriter.H deleted file mode 100644 index 36ee07b519485e17138989d471842370086f6572..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriter.H +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::surfaceWriter - -Description - -SourceFiles - surfaceWriter.C - -\*---------------------------------------------------------------------------*/ - -#ifndef surfaceWriter_H -#define surfaceWriter_H - -#include "Field.H" -#include "typeInfo.H" -#include "runTimeSelectionTables.H" -#include "autoPtr.H" -#include "pointField.H" -#include "faceList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class surfaceWriter Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class surfaceWriter -{ - -public: - - //- Runtime type information - TypeName("surfaceWriter"); - - // Declare run-time constructor selection table - - declareRunTimeSelectionTable - ( - autoPtr, - surfaceWriter, - word, - (), - () - ); - - - // Selectors - - //- Return a reference to the selected surfaceWriter - static autoPtr<surfaceWriter> New(const word& writeFormat); - - - // Constructors - - //- Construct null - surfaceWriter(); - - - // Destructor - - virtual ~surfaceWriter(); - - - // Member Functions - - //- Writes single surface to file. Either one value per vertex or - // one value per face (detected by values.size()==faces.size()) - virtual void write - ( - const fileName& samplePath, // <root>/<case>/sampleSurfaces - const fileName& timeDir, // time directory - const fileName& surfaceName, // name of surface - const pointField& points, - const faceList& faces, - const fileName& fieldName, // name of field - const Field<Type>& values - ) const = 0; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "surfaceWriter.C" -#endif - -// Only used internally -#define makeTypeWritersTypeName(type) \ - \ -defineNamedTemplateTypeNameAndDebug(type, 0); - -// Used externally sometimes -#define makeWritersTypeName(typeWriter) \ - \ -makeTypeWritersTypeName(typeWriter##ScalarWriter); \ -makeTypeWritersTypeName(typeWriter##VectorWriter); \ -makeTypeWritersTypeName(typeWriter##SphericalTensorWriter); \ -makeTypeWritersTypeName(typeWriter##SymmTensorWriter); \ -makeTypeWritersTypeName(typeWriter##TensorWriter); - -// Define type info for single template instantiation (e.g. vector) -#define makeWriterTypes(WriterType, type) \ - \ -defineNamedTemplateTypeNameAndDebug(type, 0); \ - \ -addToRunTimeSelectionTable \ -( \ - WriterType, type, word \ -); - - -// Define type info info for scalar, vector etc. instantiations -#define makeWriters(typeWriter) \ - \ -makeWriterTypes(scalarWriter, typeWriter##ScalarWriter); \ -makeWriterTypes(vectorWriter, typeWriter##VectorWriter); \ -makeWriterTypes(sphericalTensorWriter, typeWriter##SphericalTensorWriter); \ -makeWriterTypes(symmTensorWriter, typeWriter##SymmTensorWriter);\ -makeWriterTypes(tensorWriter, typeWriter##TensorWriter); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriters.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriters.H deleted file mode 100644 index 33a5e87ba76b559445d3a9ad533311558d69a3af..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriters.H +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -InClass - Foam::surfaceWriter - -Description - -\*---------------------------------------------------------------------------*/ - -#ifndef surfaceWriters_H -#define surfaceWriters_H - -#include "surfaceWriter.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -typedef surfaceWriter<scalar> scalarWriter; -typedef surfaceWriter<vector> vectorWriter; -typedef surfaceWriter<sphericalTensor> sphericalTensorWriter; -typedef surfaceWriter<symmTensor> symmTensorWriter; -typedef surfaceWriter<tensor> tensorWriter; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtk.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtk.C deleted file mode 100644 index 204b6aca2c9483efa3b9cb8f2af893a62597172d..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtk.C +++ /dev/null @@ -1,330 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "vtk.H" -#include "fileName.H" -#include "OFstream.H" -#include "faceList.H" -#include "OSspecific.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -void Foam::vtk<Type>::writeGeometry -( - const pointField& points, - const faceList& faces, - Ostream& os -) const -{ - // Write vertex coordinates - - os - << "# vtk DataFile Version 2.0" << nl - << "sampleSurface" << nl - << "ASCII" << nl - << "DATASET POLYDATA" << nl; - - os << "POINTS " << points.size() << " float" << nl; - - forAll(points, pointI) - { - const point& pt = points[pointI]; - - os << float(pt.x()) << ' ' << float(pt.y()) << ' ' << float(pt.z()) - << nl; - } - os << endl; - - - // Write triangles - - label nFaceVerts = 0; - - forAll(faces, faceI) - { - const face& f = faces[faceI]; - - nFaceVerts += f.size() + 1; - } - - os << "POLYGONS " << faces.size() << ' ' << nFaceVerts << nl; - - forAll(faces, faceI) - { - const face& f = faces[faceI]; - - os << f.size(); - - forAll(f, fp) - { - os << ' ' << f[fp]; - } - os << nl; - } -} - - -// Write scalarField in vtk format -template<class Type> -void Foam::vtk<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const scalarField& values, - Ostream& os -) const -{ - // Write data - if (values.size() == points.size()) - { - os << "POINT_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - else - { - os << "CELL_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - - os << fieldName << " 1 " << values.size() << " float" << nl; - - forAll(values, elemI) - { - os << float(values[elemI]); - - if (elemI > 0 && (elemI%10) == 0) - { - os << nl; - } - else - { - os << ' '; - } - } - os << nl; -} - - -// Write vectorField in vtk format -template<class Type> -void Foam::vtk<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const vectorField& values, - Ostream& os -) const -{ - // Write data - if (values.size() == points.size()) - { - os << "POINT_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - else - { - os << "CELL_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - - os << fieldName << " 3 " << values.size() << " float" << nl; - - forAll(values, elemI) - { - const vector& v = values[elemI]; - - os << float(v[0]) << ' ' << float(v[1]) << ' ' << float(v[2]) << nl; - } -} - - -// Write sphericalTensorField in vtk format -template<class Type> -void Foam::vtk<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const sphericalTensorField& values, - Ostream& os -) const -{ - // Write data - if (values.size() == points.size()) - { - os << "POINT_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - else - { - os << "CELL_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - - os << fieldName << " 1 " << values.size() << " float" << nl; - - forAll(values, elemI) - { - const sphericalTensor& v = values[elemI]; - - os << float(v[0]) - << nl; - } -} - - -// Write symmTensorField in vtk format -template<class Type> -void Foam::vtk<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const symmTensorField& values, - Ostream& os -) const -{ - // Write data - if (values.size() == points.size()) - { - os << "POINT_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - else - { - os << "CELL_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - - os << fieldName << " 6 " << values.size() << " float" << nl; - - forAll(values, elemI) - { - const symmTensor& v = values[elemI]; - - os << float(v[0]) << ' ' << float(v[1]) << ' ' << float(v[2]) - << float(v[3]) << ' ' << float(v[4]) << ' ' << float(v[5]) - << nl; - } -} - - -// Write tensorField in vtk format -template<class Type> -void Foam::vtk<Type>::writeData -( - const fileName& fieldName, - const pointField& points, - const tensorField& values, - Ostream& os -) const -{ - // Write data - if (values.size() == points.size()) - { - os << "POINT_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - else - { - os << "CELL_DATA " << values.size() - << nl - << "FIELD attributes 1" << nl; - } - - os << fieldName << " 9 " << values.size() << " float" << nl; - - forAll(values, elemI) - { - const tensor& v = values[elemI]; - - os << float(v[0]) << ' ' << float(v[1]) << ' ' << float(v[2]) - << float(v[3]) << ' ' << float(v[4]) << ' ' << float(v[5]) - << float(v[6]) << ' ' << float(v[7]) << ' ' << float(v[8]) - << nl; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components -template<class Type> -Foam::vtk<Type>::vtk() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::vtk<Type>::~vtk() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::vtk<Type>::write -( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values -) const -{ - fileName surfaceDir(samplePath/timeDir); - - if (!exists(surfaceDir)) - { - mkDir(surfaceDir); - } - - fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".vtk"); - - Info<< "Writing field " << fieldName << " to " << planeFName << endl; - - OFstream vtkFile(planeFName); - - writeGeometry(points, faces, vtkFile); - - writeData(fieldName, points, values, vtkFile); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtk.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtk.H deleted file mode 100644 index 2da3ed496f40263b5797b03f7f7d413f1b010249..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtk.H +++ /dev/null @@ -1,153 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::vtk - -Description - -SourceFiles - vtk.C - -\*---------------------------------------------------------------------------*/ - -#ifndef vtk_H -#define vtk_H - -#include "surfaceWriter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class vtk Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class vtk -: - public surfaceWriter<Type> -{ - - // Private Member Functions - - void writeGeometry - ( - const pointField& points, - const faceList& faces, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const scalarField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const vectorField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const sphericalTensorField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const symmTensorField& values, - Ostream& os - ) const; - - void writeData - ( - const fileName& fieldName, - const pointField& points, - const tensorField& values, - Ostream& os - ) const; - - -public: - - //- Runtime type information - TypeName("vtk"); - - - // Constructors - - //- Construct null - vtk(); - - // Destructor - - virtual ~vtk(); - - - // Member Functions - - // Write - - //- Writes single surface to file. - virtual void write - ( - const fileName& samplePath, - const fileName& timeDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field<Type>& values - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "vtk.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtkWriters.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtkWriters.H deleted file mode 100644 index 1e8e0cea19e5deeb376842654e54e350230c9575..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtkWriters.H +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -InClass - Foam::vtkWriters - -Description - -SourceFiles - vtkWriters.C - -\*---------------------------------------------------------------------------*/ - -#ifndef vtkWriters_H -#define vtkWriters_H - -#include "vtk.H" -#include "surfaceWriters.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -typedef vtk<scalar> vtkScalarWriter; -typedef vtk<vector> vtkVectorWriter; -typedef vtk<sphericalTensor> vtkSphericalTensorWriter; -typedef vtk<symmTensor> vtkSymmTensorWriter; -typedef vtk<tensor> vtkTensorWriter; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantIsoSurface/constantIsoSurface.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantIsoSurface/constantIsoSurface.C deleted file mode 100644 index e701487791025a17d363900c9afd5510f729c021..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantIsoSurface/constantIsoSurface.C +++ /dev/null @@ -1,271 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "constantIsoSurface.H" -#include "meshSearch.H" -#include "polyMesh.H" -#include "interpolation.H" -#include "dictionary.H" -#include "meshCutSurface.H" -#include "cellDecompIsoSurfaceCuts.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(constantIsoSurface, 0); - -addToRunTimeSelectionTable(surface, constantIsoSurface, word); - -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -Foam::tmp<Foam::Field<Type> > Foam::constantIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - const GeometricField<Type, fvPatchField, volMesh>& vField = - *cache[fieldName]; - - tmp<Field<Type> > tresult(new Field<Type>(faces().size())); - Field<Type>& result = tresult(); - - forAll(result, faceI) - { - result[faceI] = vField[cellLabels_[faceI]]; - } - - return tresult; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::constantIsoSurface::constantIsoSurface -( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& isoFieldName, - const scalar isoVal -) -: - surface(mesh, searchEngine, name), - isoFieldName_(isoFieldName), - isoVal_(isoVal), - points_(0), - faces_(0), - cellLabels_(0) -{} - - -Foam::constantIsoSurface::constantIsoSurface -( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -: - surface(mesh, searchEngine, dict), - isoFieldName_(dict.lookup("field")), - isoVal_(readScalar(dict.lookup("value"))), - points_(0), - faces_(0), - cellLabels_(0) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::constantIsoSurface::~constantIsoSurface() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::constantIsoSurface::correct -( - const bool meshChanged, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& scalarCache -) -{ - if (!scalarCache.found(isoFieldName_)) - { - FatalErrorIn - ( - "constantIsoSurface::correct(const bool meshChanged," - "const volPointInterpolation&, const fieldsCache<scalar>&" - ", const fieldsCache<vector>&, const fieldsCache<tensor>&)" - ) << "Field " << isoFieldName_ << " not loaded." << endl - << "It has to be one of the sampled fields" - << exit(FatalError); - } - const volScalarField& vField = *scalarCache[isoFieldName_]; - - const pointScalarField& pField = - scalarCache.pointField(isoFieldName_, pInterp); - - // Create smooth volField. - volScalarField smoothVolField(vField); - - const labelListList& cellPoints = vField.mesh().cellPoints(); - - forAll(cellPoints, cellI) - { - const labelList& cPoints = cellPoints[cellI]; - - scalar sum = 0; - - forAll(cPoints, i) - { - sum += pField[cPoints[i]]; - } - smoothVolField[cellI] = sum / cPoints.size(); - } - - - cellDecompIsoSurfaceCuts isoSurfaceCuts - ( - smoothVolField, - pField, - isoVal_, - -0.1 - ); - - meshCutSurface isoSurf(isoSurfaceCuts); - - points_ = isoSurf.points(); - - // Convert triangles into faces - faces_.setSize(isoSurf.size()); - cellLabels_.setSize(isoSurf.size()); - - forAll(isoSurf, triI) - { - face& f = faces_[triI]; - const labelledTri& t = isoSurf[triI]; - - f.setSize(3); - f[0] = t[0]; - f[1] = t[1]; - f[2] = t[2]; - - cellLabels_[triI] = t.region(); - } - - Pout<< "Created " << name() << " :" - << " isoValue:" << isoVal_ - << " field:" << isoFieldName_ - << " faces:" << faces_.size() - << " points:" << points_.size() << endl; -} - - -Foam::tmp<Foam::scalarField> Foam::constantIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<scalar>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<scalar>(fieldName, cache, pInterp, interpolationSchemes); -} - - -Foam::tmp<Foam::vectorField> Foam::constantIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<vector>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<vector>(fieldName, cache, pInterp, interpolationSchemes); -} - - -Foam::tmp<Foam::sphericalTensorField> Foam::constantIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<sphericalTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<sphericalTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::symmTensorField> Foam::constantIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<symmTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<symmTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::tensorField> Foam::constantIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<tensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<tensor>(fieldName, cache, pInterp, interpolationSchemes); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantIsoSurface/constantIsoSurface.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantIsoSurface/constantIsoSurface.H deleted file mode 100644 index 7ab98c788f8a389f031ab07a2104d45b783315ff..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantIsoSurface/constantIsoSurface.H +++ /dev/null @@ -1,199 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::constantIsoSurface - -Description - -SourceFiles - constantIsoSurface.C - -\*---------------------------------------------------------------------------*/ - -#ifndef constantIsoSurface_H -#define constantIsoSurface_H - -#include "surface.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -//class meshSearch; -class dictionary; -class plane; -class volPointInterpolation; -template<class Type> class fieldsCache; -class cellDecompIsoSurfaceCuts; - -/*---------------------------------------------------------------------------*\ - Class constantIsoSurface Declaration -\*---------------------------------------------------------------------------*/ - -class constantIsoSurface -: - public surface -{ - // Private data - - //- Name of field to use to construct isosurface - const word isoFieldName_; - - //- Iso surface value - const scalar isoVal_; - - //- Generated points - mutable pointField points_; - - //- Generated triangles - mutable faceList faces_; - - //- Labels into original cells - mutable labelList cellLabels_; - - - // Private Member Functions - - template<class Type> - tmp<Field<Type> > interpolate - ( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes - ) const; - - -public: - - //- Runtime type information - TypeName("constantIsoSurface"); - - // Constructors - - //- Construct from components - constantIsoSurface - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& isoFieldName, - const scalar isoVal - ); - - //- Construct from dictionary - constantIsoSurface - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - - // Destructor - - virtual ~constantIsoSurface(); - - - // Member Functions - - //- Points of surface - virtual const pointField& points() const - { - return points_; - }; - - //- Faces of surface - virtual const faceList& faces() const - { - return faces_; - } - - //- Correct for mesh movement and/or field changes - virtual void correct - ( - const bool meshChanged, - const volPointInterpolation&, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& - ); - - //- interpolate field to surface - virtual tmp<scalarField> interpolate - ( - const word&, - const fieldsCache<scalar>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<vectorField> interpolate - ( - const word&, - const fieldsCache<vector>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<sphericalTensorField> interpolate - ( - const word&, - const fieldsCache<sphericalTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<symmTensorField> interpolate - ( - const word&, - const fieldsCache<symmTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<tensorField> interpolate - ( - const word&, - const fieldsCache<tensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPatch/constantPatch.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPatch/constantPatch.C deleted file mode 100644 index 91c5efa4d3579856b130e55eea50da6dd7273712..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPatch/constantPatch.C +++ /dev/null @@ -1,282 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "constantPatch.H" -#include "meshSearch.H" -#include "polyMesh.H" -#include "interpolation.H" -#include "dictionary.H" -#include "polyPatch.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(constantPatch, 0); - -addToRunTimeSelectionTable(surface, constantPatch, word); - -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::constantPatch::makeTriangles() -{ - if (patchIndex_ != -1) - { - const polyPatch& patch = mesh().boundaryMesh()[patchIndex_]; - - // Count triangles - label nTris = 0; - - const faceList& localFaces = patch.localFaces(); - - forAll(localFaces, patchFaceI) - { - const face& f = localFaces[patchFaceI]; - - nTris += f.nTriangles(patch.localPoints()); - } - - // Triangulation is done using all localPoints - points_ = patch.localPoints(); - - faces_.setSize(nTris); - patchFaceLabels_.setSize(nTris); - - label triI = 0; - label oldTriI = 0; - - forAll(localFaces, patchFaceI) - { - const face& f = localFaces[patchFaceI]; - - f.triangles(patch.localPoints(), triI, faces_); - - for(label i = oldTriI; i < triI; i++) - { - patchFaceLabels_[i] = patchFaceI; - } - - oldTriI = triI; - } - } -} - - -void Foam::constantPatch::copyFaces() -{ - if (patchIndex_ != -1) - { - const polyPatch& patch = mesh().boundaryMesh()[patchIndex_]; - - points_ = patch.localPoints(); - faces_ = patch.localFaces(); - patchFaceLabels_.setSize(faces_.size()); - forAll(patchFaceLabels_, i) - { - patchFaceLabels_[i] = i; - } - } -} - - -void Foam::constantPatch::createGeometry() -{ - if (triangulate_) - { - makeTriangles(); - } - else - { - copyFaces(); - } - - Pout<< "Created " << name() << " :" - << " patch:" << patchName_ - << " faces:" << faces_.size() - << " points:" << points_.size() << endl; -} - - -template <class Type> -Foam::tmp<Foam::Field<Type> > Foam::constantPatch::interpolate -( - const word& fieldName, - const fieldsCache<Type>& cache -) const -{ - // One value per face - tmp<Field<Type> > tvalues(new Field<Type>(patchFaceLabels_.size())); - Field<Type>& values = tvalues(); - - if (patchIndex_ != -1) - { - const GeometricField<Type, fvPatchField, volMesh>& vField = - *cache[fieldName]; - - const Field<Type>& bField = vField.boundaryField()[patchIndex_]; - - forAll(patchFaceLabels_, elemI) - { - values[elemI] = bField[patchFaceLabels_[elemI]]; - } - } - - return tvalues; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::constantPatch::constantPatch -( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& patchName, - const bool triangulate -) -: - surface(mesh, searchEngine, name), - patchName_(patchName), - patchIndex_(mesh.boundaryMesh().findPatchID(patchName_)), - triangulate_(triangulate), - points_(0), - faces_(0), - patchFaceLabels_(0) -{ - createGeometry(); -} - - -Foam::constantPatch::constantPatch -( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -: - surface(mesh, searchEngine, dict), - patchName_(dict.lookup("patchName")), - patchIndex_(mesh.boundaryMesh().findPatchID(patchName_)), - triangulate_(getBool(dict, "triangulate", true)), - points_(0), - faces_(0), - patchFaceLabels_(0) -{ - createGeometry(); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::constantPatch::~constantPatch() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::constantPatch::correct -( - const bool meshChanged, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& scalarCache -) -{ - if (meshChanged) - { - createGeometry(); - } -} - - -Foam::tmp<Foam::scalarField> Foam::constantPatch::interpolate -( - const word& fieldName, - const fieldsCache<scalar>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<scalar>(fieldName, cache); -} - - -Foam::tmp<Foam::vectorField> Foam::constantPatch::interpolate -( - const word& fieldName, - const fieldsCache<vector>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<vector>(fieldName, cache); -} - - -Foam::tmp<Foam::sphericalTensorField> Foam::constantPatch::interpolate -( - const word& fieldName, - const fieldsCache<sphericalTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<sphericalTensor>(fieldName, cache); -} - - -Foam::tmp<Foam::symmTensorField> Foam::constantPatch::interpolate -( - const word& fieldName, - const fieldsCache<symmTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<symmTensor>(fieldName, cache); -} - - -Foam::tmp<Foam::tensorField> Foam::constantPatch::interpolate -( - const word& fieldName, - const fieldsCache<tensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<tensor>(fieldName, cache); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPatch/constantPatch.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPatch/constantPatch.H deleted file mode 100644 index bbb07f90df31d6fd5610341101601a3e5c157c9a..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPatch/constantPatch.H +++ /dev/null @@ -1,223 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::constantPatch - -Description - -SourceFiles - constantPatch.C - -\*---------------------------------------------------------------------------*/ - -#ifndef constantPatch_H -#define constantPatch_H - -#include "surface.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -//class meshSearch; -class dictionary; -class plane; -class volPointInterpolation; -template<class Type> class fieldsCache; - -/*---------------------------------------------------------------------------*\ - Class constantPatch Declaration -\*---------------------------------------------------------------------------*/ - -class constantPatch -: - public surface -{ - // Private data - - //- Name of patch - const word patchName_; - - //- Index of patch in boundaryMesh - const label patchIndex_; - - //- Make triangles or keep faces - const bool triangulate_; - - //- Zero size or copy of patch.localPoints() - pointField points_; - - //- Generated triangles - faceList faces_; - - //- Original patch face labels - labelList patchFaceLabels_; - - // Private Member Functions - - //- Triangulate patch - void makeTriangles(); - - void copyFaces(); - - //- Do all to construct geometry. - void createGeometry(); - - //- Interpolate field onto faces - template <class Type> - tmp<Field<Type> > interpolate - ( - const word&, - const fieldsCache<Type>& - ) const; - - -public: - - //- Runtime type information - TypeName("constantPatch"); - - - // Constructors - - //- Construct from components - constantPatch - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& patchName, - const bool triangulate = true - ); - - //- Construct from dictionary - constantPatch - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - - // Destructor - - virtual ~constantPatch(); - - - // Member Functions - - const word patchName() const - { - return patchName_; - } - - label patchIndex() const - { - return patchIndex_; - } - - const labelList& patchFaceLabels() const - { - return patchFaceLabels_; - } - - //- Points of surface - virtual const pointField& points() const - { - return points_; - } - - //- Faces of surface - virtual const faceList& faces() const - { - return faces_; - } - - //- Correct for mesh movement and/or field changes - virtual void correct - ( - const bool meshChanged, - const volPointInterpolation&, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& - ); - - //- interpolate field to surface - virtual tmp<scalarField> interpolate - ( - const word&, - const fieldsCache<scalar>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<vectorField> interpolate - ( - const word&, - const fieldsCache<vector>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<sphericalTensorField> interpolate - ( - const word&, - const fieldsCache<sphericalTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<symmTensorField> interpolate - ( - const word&, - const fieldsCache<symmTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<tensorField> interpolate - ( - const word&, - const fieldsCache<tensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPlane/constantPlane.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPlane/constantPlane.C deleted file mode 100644 index 73bd4f0b942a86fdd24a411e103decfa11d794a3..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPlane/constantPlane.C +++ /dev/null @@ -1,263 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "constantPlane.H" -#include "meshSearch.H" -#include "polyMesh.H" -#include "interpolation.H" -#include "dictionary.H" -#include "plane.H" -#include "cuttingPlane.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(constantPlane, 0); - -addToRunTimeSelectionTable(surface, constantPlane, word); - -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::constantPlane::makeTriangles(const cuttingPlane& cut) -{ - // Count triangles - label nTris = 0; - forAll(cut.faces(), cutFaceI) - { - const face& f = cut.faces()[cutFaceI]; - - nTris += f.nTriangles(cut.points()); - } - - // Triangulation uses all points from cut - points_ = cut.points(); - - faces_.setSize(nTris); - meshCells_.setSize(nTris); - - label triI = 0; - label oldTriI = 0; - - forAll(cut.faces(), cutFaceI) - { - const face& f = cut.faces()[cutFaceI]; - - f.triangles(cut.points(), triI, faces_); - - for(label i = oldTriI; i < triI; i++) - { - meshCells_[i] = cut.cells()[cutFaceI]; - } - - oldTriI = triI; - } -} - - -void Foam::constantPlane::copyFaces(const cuttingPlane& cut) -{ - points_ = cut.points(); - faces_ = cut.faces(); - meshCells_ = cut.cells(); -} - - -void Foam::constantPlane::createGeometry() -{ - cuttingPlane plane(mesh(), planeDesc_); - - if (triangulate_) - { - makeTriangles(plane); - } - else - { - copyFaces(plane); - } - - Pout<< "Created " << name() << " :" - << " base:" << planeDesc_.refPoint() - << " normal:" << planeDesc_.normal() - << " faces:" << faces_.size() - << " points:" << points_.size() << endl; -} - - -template <class Type> -Foam::tmp<Foam::Field<Type> > Foam::constantPlane::interpolate -( - const word& fieldName, - const fieldsCache<Type>& cache -) const -{ - // One value per face - tmp<Field<Type> > tvalues(new Field<Type>(meshCells_.size())); - Field<Type>& values = tvalues(); - - const GeometricField<Type, fvPatchField, volMesh>& field = - *cache[fieldName]; - - forAll(meshCells_, elemI) - { - values[elemI] = field[meshCells_[elemI]]; - } - - return tvalues; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::constantPlane::constantPlane -( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const plane& planeDesc, - const bool triangulate -) -: - surface(mesh, searchEngine, name), - planeDesc_(planeDesc), - triangulate_(triangulate), - points_(0), - faces_(0), - meshCells_(0) -{ - createGeometry(); -} - - -Foam::constantPlane::constantPlane -( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -: - surface(mesh, searchEngine, dict), - planeDesc_(dict.lookup("basePoint"), dict.lookup("normalVector")), - triangulate_(getBool(dict, "triangulate", true)), - points_(0), - faces_(0), - meshCells_(0) -{ - createGeometry(); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::constantPlane::~constantPlane() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::constantPlane::correct -( - const bool meshChanged, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& scalarCache -) -{ - if (meshChanged) - { - // Only change of mesh changes plane. - createGeometry(); - } -} - - -Foam::tmp<Foam::scalarField> Foam::constantPlane::interpolate -( - const word& fieldName, - const fieldsCache<scalar>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<scalar>(fieldName, cache); -} - - -Foam::tmp<Foam::vectorField> Foam::constantPlane::interpolate -( - const word& fieldName, - const fieldsCache<vector>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<vector>(fieldName, cache); -} - - -Foam::tmp<Foam::sphericalTensorField> Foam::constantPlane::interpolate -( - const word& fieldName, - const fieldsCache<sphericalTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<sphericalTensor>(fieldName, cache); -} - - -Foam::tmp<Foam::symmTensorField> Foam::constantPlane::interpolate -( - const word& fieldName, - const fieldsCache<symmTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<symmTensor>(fieldName, cache); -} - - -Foam::tmp<Foam::tensorField> Foam::constantPlane::interpolate -( - const word& fieldName, - const fieldsCache<tensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<tensor>(fieldName, cache); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPlane/constantPlane.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPlane/constantPlane.H deleted file mode 100644 index e5d807cb1dd3a14b63c169bf69aaa8a9dca013fa..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/constantPlane/constantPlane.H +++ /dev/null @@ -1,219 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::constantPlane - -Description - -SourceFiles - constantPlane.C - -\*---------------------------------------------------------------------------*/ - -#ifndef constantPlane_H -#define constantPlane_H - -#include "surface.H" -#include "cuttingPlane.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class polyMesh; -class meshSearch; -class dictionary; -class plane; -class volPointInterpolation; -template<class Type> class fieldsCache; - -/*---------------------------------------------------------------------------*\ - Class constantPlane Declaration -\*---------------------------------------------------------------------------*/ - -class constantPlane -: - public surface -{ - // Private data - - //- Cutting plane description - const plane planeDesc_; - - //- Make triangles or keep faces - const bool triangulate_; - - //- Generated points - pointField points_; - - //- Generated faces - faceList faces_; - - //- Fro every face original cell in mesh - labelList meshCells_; - - - // Private Member Functions - - //- Cut & triangulate - void makeTriangles(const cuttingPlane&); - - //- Copy cut; do not triangulate - void copyFaces(const cuttingPlane&); - - //- Do all to create geometry. Cut&triangulate if nessecary - void createGeometry(); - - //- Interpolate field onto faces - template <class Type> - tmp<Field<Type> > interpolate - ( - const word& fieldName, - const fieldsCache<Type>& cache - ) const; - - -public: - - //- Runtime type information - TypeName("constantPlane"); - - - // Constructors - - //- Construct from components - constantPlane - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const plane& planeDesc, - const bool triangulate = true - ); - - //- Construct from dictionary - constantPlane - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - - // Destructor - - virtual ~constantPlane(); - - - // Member Functions - - const plane& planeDesc() const - { - return planeDesc_; - } - - const labelList& meshCells() const - { - return meshCells_; - } - - //- Points of surface - virtual const pointField& points() const - { - return points_; - } - - //- Faces of surface - virtual const faceList& faces() const - { - return faces_; - } - - //- Correct for mesh movement and/or field changes - virtual void correct - ( - const bool meshChanged, - const volPointInterpolation&, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& - ); - - //- interpolate field to surface - virtual tmp<scalarField> interpolate - ( - const word&, - const fieldsCache<scalar>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<vectorField> interpolate - ( - const word&, - const fieldsCache<vector>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<sphericalTensorField> interpolate - ( - const word&, - const fieldsCache<sphericalTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<symmTensorField> interpolate - ( - const word&, - const fieldsCache<symmTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<tensorField> interpolate - ( - const word&, - const fieldsCache<tensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedIsoSurface/interpolatedIsoSurface.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedIsoSurface/interpolatedIsoSurface.C deleted file mode 100644 index 983a621eb0536432e8333da4335de98b9f27c068..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedIsoSurface/interpolatedIsoSurface.C +++ /dev/null @@ -1,281 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "interpolatedIsoSurface.H" -#include "meshSearch.H" -#include "polyMesh.H" -#include "interpolation.H" -#include "dictionary.H" -#include "meshCutSurface.H" -#include "cellDecompIsoSurfaceCuts.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(interpolatedIsoSurface, 0); - -addToRunTimeSelectionTable(surface, interpolatedIsoSurface, word); - -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class Type> -Foam::tmp<Foam::Field<Type> > Foam::interpolatedIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - const GeometricField<Type, fvPatchField, volMesh>& vField = - *cache[fieldName]; - - const GeometricField<Type, pointPatchField, pointMesh>& pField = - cache.pointField(fieldName, pInterp); - - return meshCutSurface::interpolate(isoSurfCuts(), vField, pField); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::interpolatedIsoSurface::interpolatedIsoSurface -( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& isoFieldName, - const scalar isoVal -) -: - surface(mesh, searchEngine, name), - isoFieldName_(isoFieldName), - isoVal_(isoVal), - points_(0), - faces_(0), - isoSurfCutsPtr_(NULL) -{} - - -Foam::interpolatedIsoSurface::interpolatedIsoSurface -( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -: - surface(mesh, searchEngine, dict), - isoFieldName_(dict.lookup("field")), - isoVal_(readScalar(dict.lookup("value"))), - points_(0), - faces_(0), - isoSurfCutsPtr_(NULL) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::interpolatedIsoSurface::~interpolatedIsoSurface() -{ - if (isoSurfCutsPtr_) - { - delete isoSurfCutsPtr_; - isoSurfCutsPtr_ = NULL; - } -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::cellDecompIsoSurfaceCuts& -Foam::interpolatedIsoSurface::isoSurfCuts() const -{ - if (!isoSurfCutsPtr_) - { - FatalErrorIn("interpolatedIsoSurface::isoSurfCuts()") - << "No interpolatedIsoSurfaceCuts allocated" << abort(FatalError); - } - return *isoSurfCutsPtr_; -} - - -void Foam::interpolatedIsoSurface::correct -( - const bool meshChanged, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& scalarCache -) -{ - if (!scalarCache.found(isoFieldName_)) - { - FatalErrorIn - ( - "interpolatedIsoSurface::correct(const bool meshChanged," - "const volPointInterpolation&, const fieldsCache<scalar>&" - ", const fieldsCache<vector>&, const fieldsCache<tensor>&)" - ) << "Field " << isoFieldName_ << " not loaded." << endl - << "It has to be one of the sampled fields" - << exit(FatalError); - } - const volScalarField& vField = *scalarCache[isoFieldName_]; - - const pointScalarField& pField = - scalarCache.pointField(isoFieldName_, pInterp); - - if (isoSurfCutsPtr_) - { - delete isoSurfCutsPtr_; - } - - isoSurfCutsPtr_ = new cellDecompIsoSurfaceCuts - ( - vField, - pField, - isoVal_, - -0.1 - ); - - meshCutSurface isoSurf(isoSurfCuts()); - - points_ = isoSurf.points(); - - // Convert triangles into faces - faces_.setSize(isoSurf.size()); - - forAll(isoSurf, triI) - { - face& f = faces_[triI]; - const labelledTri& t = isoSurf[triI]; - - f.setSize(3); - f[0] = t[0]; - f[1] = t[1]; - f[2] = t[2]; - } - - Pout<< "Created " << name() << " :" - << " isoValue:" << isoVal_ - << " field:" << isoFieldName_ - << " faces:" << faces_.size() - << " points:" << points_.size() << endl; -} - - -Foam::tmp<Foam::scalarField> Foam::interpolatedIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<scalar>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - if (fieldName == isoFieldName_) - { - // Same field as isoSurface was based on -> single value. - return tmp<scalarField>(new scalarField(points_.size(), isoVal_)); - } - else - { - return interpolate<scalar> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); - } -} - - -Foam::tmp<Foam::vectorField> Foam::interpolatedIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<vector>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<vector>(fieldName, cache, pInterp, interpolationSchemes); -} - - -Foam::tmp<Foam::sphericalTensorField> Foam::interpolatedIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<sphericalTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<sphericalTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::symmTensorField> Foam::interpolatedIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<symmTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<symmTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::tensorField> Foam::interpolatedIsoSurface::interpolate -( - const word& fieldName, - const fieldsCache<tensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<tensor>(fieldName, cache, pInterp, interpolationSchemes); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedIsoSurface/interpolatedIsoSurface.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedIsoSurface/interpolatedIsoSurface.H deleted file mode 100644 index c66083103edd299ce2636f51df3d04210442681d..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedIsoSurface/interpolatedIsoSurface.H +++ /dev/null @@ -1,203 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::interpolatedIsoSurface - -Description - -SourceFiles - interpolatedIsoSurface.C - -\*---------------------------------------------------------------------------*/ - -#ifndef interpolatedIsoSurface_H -#define interpolatedIsoSurface_H - -#include "surface.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -//class meshSearch; -class dictionary; -class plane; -class volPointInterpolation; -template<class Type> class fieldsCache; -class cellDecompIsoSurfaceCuts; - -/*---------------------------------------------------------------------------*\ - Class interpolatedIsoSurface Declaration -\*---------------------------------------------------------------------------*/ - -class interpolatedIsoSurface -: - public surface -{ - // Private data - - //- Name of field to use to construct isosurface - const word isoFieldName_; - - //- Iso surface value - const scalar isoVal_; - - //- Generated points - mutable pointField points_; - - //- Generated triangles - mutable faceList faces_; - - //- Iso surface edge descriptors - const cellDecompIsoSurfaceCuts* isoSurfCutsPtr_; - - // Private Member Functions - - template<class Type> - tmp<Field<Type> > interpolate - ( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes - ) const; - - -public: - - //- Runtime type information - TypeName("interpolatedIsoSurface"); - - // Constructors - - //- Construct from components - interpolatedIsoSurface - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& isoFieldName, - const scalar isoVal - ); - - //- Construct from dictionary - interpolatedIsoSurface - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - - // Destructor - - virtual ~interpolatedIsoSurface(); - - - // Member Functions - - //- Access isoSurface edge cuts - const cellDecompIsoSurfaceCuts& isoSurfCuts() const; - - //- Points of surface - virtual const pointField& points() const - { - return points_; - }; - - //- Faces of surface - virtual const faceList& faces() const - { - return faces_; - } - - //- Correct for mesh movement and/or field changes. Differs from - // constantIsoSurface one since meshCuts are stored for use in - // interpolation later on - virtual void correct - ( - const bool meshChanged, - const volPointInterpolation&, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& - ); - - //- interpolate field to surface - virtual tmp<scalarField> interpolate - ( - const word&, - const fieldsCache<scalar>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<vectorField> interpolate - ( - const word&, - const fieldsCache<vector>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<sphericalTensorField> interpolate - ( - const word&, - const fieldsCache<sphericalTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<symmTensorField> interpolate - ( - const word&, - const fieldsCache<symmTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<tensorField> interpolate - ( - const word&, - const fieldsCache<tensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPatch/interpolatedPatch.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPatch/interpolatedPatch.C deleted file mode 100644 index e0029398ca482132dc841b9ca3471f1178c1d97c..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPatch/interpolatedPatch.C +++ /dev/null @@ -1,211 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "interpolatedPatch.H" -#include "meshSearch.H" -#include "polyMesh.H" -#include "interpolation.H" -#include "dictionary.H" -#include "polyPatch.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(interpolatedPatch, 0); - -addToRunTimeSelectionTable(surface, interpolatedPatch, word); - -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template <class Type> -Foam::tmp<Foam::Field<Type> > Foam::interpolatedPatch::interpolate -( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - // One value per vertex - tmp<Field<Type> > tvalues(new Field<Type>(points().size())); - Field<Type>& values = tvalues(); - - // Get interpolator from cache - const interpolation<Type>& interpolator = - cache.interpolator(fieldName, pInterp, interpolationSchemes); - - if (patchIndex() != -1) - { - const polyPatch& patch = mesh().boundaryMesh()[patchIndex()]; - const labelList& own = mesh().faceOwner(); - - boolList pointDone(points().size(), false); - - forAll(faces(), cutFaceI) - { - const face& f = faces()[cutFaceI]; - - forAll(f, faceVertI) - { - label pointI = f[faceVertI]; - - if (!pointDone[pointI]) - { - label faceI = patchFaceLabels()[cutFaceI] + patch.start(); - - label cellI = own[faceI]; - - values[pointI] = - interpolator.interpolate - ( - points()[pointI], - cellI, - faceI - ); - pointDone[pointI] = true; - } - } - } - } - - return tvalues; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::interpolatedPatch::interpolatedPatch -( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& patchName, - const bool triangulate -) -: - constantPatch(mesh, searchEngine, name, patchName, triangulate) -{} - - -Foam::interpolatedPatch::interpolatedPatch -( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -: - constantPatch(mesh, searchEngine, dict) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::interpolatedPatch::~interpolatedPatch() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp<Foam::scalarField> Foam::interpolatedPatch::interpolate -( - const word& fieldName, - const fieldsCache<scalar>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<scalar>(fieldName, cache, pInterp, interpolationSchemes); -} - - -Foam::tmp<Foam::vectorField> Foam::interpolatedPatch::interpolate -( - const word& fieldName, - const fieldsCache<vector>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<vector>(fieldName, cache, pInterp, interpolationSchemes); -} - - -Foam::tmp<Foam::sphericalTensorField> Foam::interpolatedPatch::interpolate -( - const word& fieldName, - const fieldsCache<sphericalTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<sphericalTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::symmTensorField> Foam::interpolatedPatch::interpolate -( - const word& fieldName, - const fieldsCache<symmTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<symmTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::tensorField> Foam::interpolatedPatch::interpolate -( - const word& fieldName, - const fieldsCache<tensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<tensor>(fieldName, cache, pInterp, interpolationSchemes); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPatch/interpolatedPatch.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPatch/interpolatedPatch.H deleted file mode 100644 index a589a8a4aa5bbd73caf74af5d20b88da13d02a11..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPatch/interpolatedPatch.H +++ /dev/null @@ -1,163 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::interpolatedPatch - -Description - -SourceFiles - interpolatedPatch.C - -\*---------------------------------------------------------------------------*/ - -#ifndef interpolatedPatch_H -#define interpolatedPatch_H - -#include "surface.H" -#include "constantPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class meshSearch; -class dictionary; -class plane; -class volPointInterpolation; -template<class Type> class fieldsCache; - -/*---------------------------------------------------------------------------*\ - Class interpolatedPatch Declaration -\*---------------------------------------------------------------------------*/ - -class interpolatedPatch -: - public constantPatch -{ - // Private Member Functions - - //- Interpolate field onto faces - template <class Type> - tmp<Field<Type> > interpolate - ( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes - ) const; - - -public: - - //- Runtime type information - TypeName("interpolatedPatch"); - - // Constructors - - //- Construct from components - interpolatedPatch - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const word& patchName, - const bool triangulate = true - ); - - //- Construct from dictionary - interpolatedPatch - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - - // Destructor - - virtual ~interpolatedPatch(); - - - // Member Functions - - //- correct() implemented by constantPatch::correct() - - //- interpolate field to surface - virtual tmp<scalarField> interpolate - ( - const word&, - const fieldsCache<scalar>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<vectorField> interpolate - ( - const word&, - const fieldsCache<vector>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<sphericalTensorField> interpolate - ( - const word&, - const fieldsCache<sphericalTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<symmTensorField> interpolate - ( - const word&, - const fieldsCache<symmTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<tensorField> interpolate - ( - const word&, - const fieldsCache<tensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPlane/interpolatedPlane.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPlane/interpolatedPlane.C deleted file mode 100644 index 5d4146a8c3f24c091d510957b9b90d10f0be8786..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPlane/interpolatedPlane.C +++ /dev/null @@ -1,203 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "interpolatedPlane.H" -#include "meshSearch.H" -#include "polyMesh.H" -#include "meshSearch.H" -#include "interpolation.H" -#include "dictionary.H" -#include "plane.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(interpolatedPlane, 0); - -addToRunTimeSelectionTable(surface, interpolatedPlane, word); - -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template <class Type> -Foam::tmp<Foam::Field<Type> > Foam::interpolatedPlane::interpolate -( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - // One value per point - tmp<Field<Type> > tvalues(new Field<Type>(points().size())); - Field<Type>& values = tvalues(); - - // Get interpolator from cache - const interpolation<Type>& interpolator = - cache.interpolator(fieldName, pInterp, interpolationSchemes); - - boolList pointDone(points().size(), false); - - forAll(faces(), cutFaceI) - { - const face& f = faces()[cutFaceI]; - - forAll(f, faceVertI) - { - label pointI = f[faceVertI]; - - if (!pointDone[pointI]) - { - values[pointI] = - interpolator.interpolate - ( - points()[pointI], - meshCells()[cutFaceI] - ); - pointDone[pointI] = true; - } - } - } - - return tvalues; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components -Foam::interpolatedPlane::interpolatedPlane -( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const plane& planeDesc, - const bool triangulate -) -: - constantPlane(mesh, searchEngine, name, planeDesc, triangulate) -{} - - -// Construct from dictionary -Foam::interpolatedPlane::interpolatedPlane -( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -: - constantPlane(mesh, searchEngine, dict) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::interpolatedPlane::~interpolatedPlane() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp<Foam::scalarField> Foam::interpolatedPlane::interpolate -( - const word& fieldName, - const fieldsCache<scalar>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<scalar>(fieldName, cache, pInterp, interpolationSchemes); -} - - -Foam::tmp<Foam::vectorField> Foam::interpolatedPlane::interpolate -( - const word& fieldName, - const fieldsCache<vector>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<vector>(fieldName, cache, pInterp, interpolationSchemes); -} - - -Foam::tmp<Foam::sphericalTensorField> Foam::interpolatedPlane::interpolate -( - const word& fieldName, - const fieldsCache<sphericalTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<sphericalTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::symmTensorField> Foam::interpolatedPlane::interpolate -( - const word& fieldName, - const fieldsCache<symmTensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<symmTensor> - ( - fieldName, - cache, - pInterp, - interpolationSchemes - ); -} - - -Foam::tmp<Foam::tensorField> Foam::interpolatedPlane::interpolate -( - const word& fieldName, - const fieldsCache<tensor>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes -) const -{ - return interpolate<tensor>(fieldName, cache, pInterp, interpolationSchemes); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPlane/interpolatedPlane.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPlane/interpolatedPlane.H deleted file mode 100644 index 91e55ae65c2bc388e5cdfd2bb30b512ff2c08613..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/interpolatedPlane/interpolatedPlane.H +++ /dev/null @@ -1,164 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::interpolatedPlane - -Description - -SourceFiles - interpolatedPlane.C - -\*---------------------------------------------------------------------------*/ - -#ifndef interpolatedPlane_H -#define interpolatedPlane_H - -#include "surface.H" -#include "constantPlane.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class polyMesh; -class meshSearch; -class dictionary; -class plane; -class volPointInterpolation; - -/*---------------------------------------------------------------------------*\ - Class interpolatedPlane Declaration -\*---------------------------------------------------------------------------*/ - -class interpolatedPlane -: - public constantPlane -{ - - // Private Member Functions - - //- Interpolate field onto vertices - template<class Type> - tmp<Field<Type> > interpolate - ( - const word& fieldName, - const fieldsCache<Type>& cache, - const volPointInterpolation& pInterp, - const dictionary& interpolationSchemes - ) const; - - -public: - - //- Runtime type information - TypeName("interpolatedPlane"); - - // Constructors - - //- Construct from components - interpolatedPlane - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name, - const plane& planeDesc, - const bool triangulate - ); - - //- Construct from dictionary - interpolatedPlane - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - - // Destructor - - virtual ~interpolatedPlane(); - - - // Member Functions - - //- correct surface for new mesh done by constantPlane::correct() - - //- interpolate field to surface - virtual tmp<scalarField> interpolate - ( - const word&, - const fieldsCache<scalar>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<vectorField> interpolate - ( - const word&, - const fieldsCache<vector>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<sphericalTensorField> interpolate - ( - const word&, - const fieldsCache<sphericalTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<symmTensorField> interpolate - ( - const word&, - const fieldsCache<symmTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; - - //- interpolate field to surface - virtual tmp<tensorField> interpolate - ( - const word&, - const fieldsCache<tensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/surface/surface.C b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/surface/surface.C deleted file mode 100644 index ab5f1cceb6130c09fec0d84dee4398881615d06c..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/surface/surface.C +++ /dev/null @@ -1,135 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - -\*---------------------------------------------------------------------------*/ - -#include "surface.H" -#include "polyMesh.H" -#include "primitiveMesh.H" -#include "meshSearch.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(surface, 0); -defineRunTimeSelectionTable(surface, word); - -autoPtr<surface> surface::New -( - const word& sampleType, - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -{ - wordConstructorTable::iterator cstrIter = - wordConstructorTablePtr_ - ->find(sampleType); - - if (cstrIter == wordConstructorTablePtr_->end()) - { - FatalErrorIn - ( - "surface::New(const word&, " - "const polyMesh&, meshSearch&, const dictionary&)" - ) << "Unknown sample type " << sampleType - << endl << endl - << "Valid sample types : " << endl - << wordConstructorTablePtr_->toc() - << exit(FatalError); - } - - return autoPtr<surface> - ( - cstrIter() - ( - mesh, - searchEngine, - dict - ) - ); -} - -} // End namespace Foam - - -bool Foam::surface::getBool -( - const dictionary& dict, - const word& key, - const bool defaultVal -) -{ - if (dict.found(key)) - { - return readBool(dict.lookup(key)); - } - else - { - return defaultVal; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from mesh, name -Foam::surface::surface -( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name -) -: - mesh_(mesh), - searchEngine_(searchEngine), - name_(name) -{} - - -// Construct from dictionary -Foam::surface::surface -( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -: - mesh_(mesh), - searchEngine_(searchEngine), - name_(dict.lookup("name")) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::surface::~surface() -{} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/surface/surface.H b/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/surface/surface.H deleted file mode 100644 index c1bb9022a6576f60b7fd42d9eb8adeb4fd73c5ab..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaces/surface/surface.H +++ /dev/null @@ -1,261 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::surface - -Description - -SourceFiles - surface.C - -\*---------------------------------------------------------------------------*/ - -#ifndef surface_H -#define surface_H - -#include "pointField.H" -#include "word.H" -#include "labelList.H" -#include "faceList.H" -#include "typeInfo.H" -#include "runTimeSelectionTables.H" -#include "autoPtr.H" -#include "volFieldsFwd.H" -#include "fieldsCache.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class polyMesh; -class meshSearch; -class volPointInterpolation; -template<class Type> class fieldsCache; - -/*---------------------------------------------------------------------------*\ - Class surface Declaration -\*---------------------------------------------------------------------------*/ - -class surface -{ - // Private data - - //- Reference to mesh - const polyMesh& mesh_; - - //- Reference to mesh searching class - meshSearch& searchEngine_; - - //- Name of set - const word name_; - -protected: - - // Protected static functions - - //- Read bool from dictionary. Return provided value if not found - static bool getBool(const dictionary& dict, const word&, const bool); - - -public: - - //- Runtime type information - TypeName("surface"); - - - // Declare run-time constructor selection table - - declareRunTimeSelectionTable - ( - autoPtr, - surface, - word, - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ), - (mesh, searchEngine, dict) - ); - - - //- Class used for the read-construction of - // PtrLists of surface - class iNew - { - const polyMesh& mesh_; - meshSearch& searchEngine_; - - public: - - iNew(const polyMesh& mesh, meshSearch& searchEngine) - : - mesh_(mesh), - searchEngine_(searchEngine) - {} - - autoPtr<surface> operator()(Istream& is) const - { - word sampleType(is); - dictionary dict(is); - return surface::New(sampleType, mesh_, searchEngine_, dict); - } - }; - - - // Constructors - - //- Construct from mesh, name - surface - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const word& name - ); - - //- Construct from dictionary - surface - ( - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - //- Clone - autoPtr<surface> clone() const - { - notImplemented("autoPtr<surface> clone() const"); - return autoPtr<surface>(NULL); - } - - - // Selectors - - //- Return a reference to the selected surface - static autoPtr<surface> New - ( - const word& sampleType, - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict - ); - - - // Destructor - - virtual ~surface(); - - - // Member Functions - - const polyMesh& mesh() const - { - return mesh_; - } - - meshSearch& searchEngine() const - { - return searchEngine_; - } - - //- Name of surface - const word& name() const - { - return name_; - } - - //- Points of surface - virtual const pointField& points() const = 0; - - //- Faces of surface - virtual const faceList& faces() const = 0; - - //- Correct for mesh movement and/or field changes - virtual void correct - ( - const bool meshChanged, - const volPointInterpolation&, - const dictionary& interpolationSchemes, - const fieldsCache<scalar>& - ) = 0; - - //- interpolate field to surface - virtual tmp<scalarField> interpolate - ( - const word&, - const fieldsCache<scalar>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const = 0; - - //- interpolate field to surface - virtual tmp<vectorField> interpolate - ( - const word&, - const fieldsCache<vector>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const = 0; - - //- interpolate field to surface - virtual tmp<sphericalTensorField> interpolate - ( - const word&, - const fieldsCache<sphericalTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const = 0; - - //- interpolate field to surface - virtual tmp<symmTensorField> interpolate - ( - const word&, - const fieldsCache<symmTensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const = 0; - - //- interpolate field to surface - virtual tmp<tensorField> interpolate - ( - const word&, - const fieldsCache<tensor>&, - const volPointInterpolation&, - const dictionary& interpolationSchemes - ) const = 0; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/files b/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..2546931c3f6c7066fdacd5a010b5f092cc07f6f7 --- /dev/null +++ b/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/files @@ -0,0 +1,3 @@ +probeLocations.C + +EXE = $(FOAM_APPBIN)/probeLocations diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/Make/options b/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/options similarity index 63% rename from applications/utilities/postProcessing/sampling/sampleSurface/Make/options rename to applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/options index f58ef8fd320f6c473037b28fcb900bdc8cecf83d..083d04c7a6724b1099fcb35b9b8526573503c7ba 100644 --- a/applications/utilities/postProcessing/sampling/sampleSurface/Make/options +++ b/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/options @@ -1,10 +1,5 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -Isurfaces/surface \ - -Isurfaces/constantPlane \ - -Isurfaces/constantPatch \ - -Isurfaces/isoSurface \ - -IsurfaceWriters/surfaceWriter \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ @@ -15,5 +10,4 @@ EXE_LIBS = \ -lmeshTools \ -lsampling \ -ltriSurface \ - -llagrangian \ - + -llagrangian diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFileWriters.H b/applications/utilities/postProcessing/sampling/sampling/probeLocations/probeLocations.C similarity index 57% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFileWriters.H rename to applications/utilities/postProcessing/sampling/sampling/probeLocations/probeLocations.C index 61868b618e3fa678702872156974b3129811b2e5..07e06e8dd6ad5b1d076279ec2f69aed3a4c57fd5 100644 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFileWriters.H +++ b/applications/utilities/postProcessing/sampling/sampling/probeLocations/probeLocations.C @@ -22,42 +22,66 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::foamFileWriters - Description - -SourceFiles - foamFileWriters.C + Probe locations. \*---------------------------------------------------------------------------*/ -#ifndef foamFileWriters_H -#define foamFileWriters_H +#include "argList.H" +#include "IOprobes.H" -#include "foamFile.H" -#include "surfaceWriters.H" -#include "fieldTypes.H" +using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: -namespace Foam +int main(int argc, char *argv[]) { -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +# include "addTimeOptions.H" +# include "setRootCase.H" -typedef foamFile<scalar> foamFileScalarWriter; -typedef foamFile<vector> foamFileVectorWriter; -typedef foamFile<sphericalTensor> foamFileSphericalTensorWriter; -typedef foamFile<symmTensor> foamFileSymmTensorWriter; -typedef foamFile<tensor> foamFileTensorWriter; +# include "createTime.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + // Get times list + instantList Times = runTime.times(); -} // End namespace Foam + // set startTime and endTime depending on -time and -latestTime options +# include "checkTimeOptions.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + runTime.setTime(Times[startTime], startTime); + +# include "createMesh.H" + + IOprobes sniff(mesh, "probesDict", true); + + for (label i=startTime; i<endTime; i++) + { + runTime.setTime(Times[i], i); + Info<< "Time = " << runTime.timeName() << endl; + + // Handle geometry/topology changes + polyMesh::readUpdateState state = mesh.readUpdate(); + + if + ( + state == polyMesh::POINTS_MOVED + || state == polyMesh::TOPO_CHANGE + ) + { + sniff.read(); + } + + sniff.write(); + + Info<< endl; + } + + + Info<< "End\n" << endl; + + return 0; +} -#endif // ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampling/probeLocations/probesDict b/applications/utilities/postProcessing/sampling/sampling/probeLocations/probesDict new file mode 100644 index 0000000000000000000000000000000000000000..3f7679f0dedd0316db3bb3d610209b06bc77370f --- /dev/null +++ b/applications/utilities/postProcessing/sampling/sampling/probeLocations/probesDict @@ -0,0 +1,38 @@ +/*-------------------------------*- C++ -*---------------------------------*\ +| ========= | +| \\ / OpenFOAM 1.4.1 | +| \\ / | +| \\ / The Open Source CFD Toolbox | +| \\/ http://www.OpenFOAM.org | +\*-------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location system; + object probesDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// Fields to be probed. runTime modifiable! +fields +( + p +); + +// Locations to be probed. runTime modifiable! +probeLocations +( + (0.0254 0.0253 0.0) + (0.0508 0.0253 0.0) + (0.0762 0.0253 0.0) + (0.1016 0.0253 0.0) + (0.1270 0.0253 0.0) + (0.1524 0.0253 0.0) + (0.1778 0.0253 0.0) +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/sampling/sampling/sample/Make/files b/applications/utilities/postProcessing/sampling/sampling/sample/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..287a5f8a83fd219e5c255db082dfe1673b0d5f01 --- /dev/null +++ b/applications/utilities/postProcessing/sampling/sampling/sample/Make/files @@ -0,0 +1,3 @@ +sample.C + +EXE = $(FOAM_APPBIN)/sample diff --git a/applications/utilities/postProcessing/sampling/sample/Make/options b/applications/utilities/postProcessing/sampling/sampling/sample/Make/options similarity index 60% rename from applications/utilities/postProcessing/sampling/sample/Make/options rename to applications/utilities/postProcessing/sampling/sampling/sample/Make/options index 672f2483700274b6ca59a75e7c39de770997d9e3..083d04c7a6724b1099fcb35b9b8526573503c7ba 100644 --- a/applications/utilities/postProcessing/sampling/sample/Make/options +++ b/applications/utilities/postProcessing/sampling/sampling/sample/Make/options @@ -1,16 +1,13 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -IsampleSets/sampleSet \ - -IsampleSets/coordSet \ - -IsampleSets/face \ - -Iwriters/writer \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ EXE_LIBS = \ - -lsampling \ + -lfiniteVolume \ -lmeshTools \ - -llagrangian \ - -lfiniteVolume - + -lsampling \ + -ltriSurface \ + -llagrangian diff --git a/applications/utilities/postProcessing/sampling/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sampling/sample/sample.C new file mode 100644 index 0000000000000000000000000000000000000000..e73591de51c2524f9b8f08be9bcfaab55fc48306 --- /dev/null +++ b/applications/utilities/postProcessing/sampling/sampling/sample/sample.C @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Sample field data with a choice of interpolation schemes, sampling options + and write formats. + + Keywords: + + setFormat: set output format, choice of + xmgr + jplot + gnuplot + raw + + surfaceFormat: surface output format, choice of + null : suppress output + foamFile : separate points, faces and values file + dx : DX scalar or vector format + vtk : VTK ascii format + raw : x y z value format for use with e.g. gnuplot 'splot'. + stl : ascii stl. Does not contain values! + + interpolationScheme: interpolation scheme, choice of + cell : use cell-centre value; constant over cells (default) + cellPoint : use cell-centre and vertex values + cellPointFace : use cell-centre, vertex and face values. + 1] vertex values determined from neighbouring cell-centre values + 2] face values determined using the current face interpolation scheme + for the field (linear, limitedLinear, etc.) + + fields: list of fields to sample + + sets: list of sets to sample, choice of + uniform evenly distributed points on line + face one point per face intersection + midPoint one point per cell, inbetween two face intersections + midPointAndFace combination of face and midPoint + + curve specified points, not nessecary on line, uses + tracking + cloud specified points, uses findCell + + Option axis: how to write point coordinate. Choice of + - x/y/z: x/y/z coordinate only + - xyz: three columns + (probably does not make sense for anything but raw) + - distance: distance from start of sampling line (if uses line) + or distance from first specified sampling point + + Type specific options: + uniform, face, midPoint, midPointAndFace : start and end coordinate + uniform: extra number of sampling points + curve, cloud: list of coordinates + + surfaces: list of surfaces to sample, choice of + plane : values on plane defined by point, normal. + patch : values on patch. + + Runs in parallel. + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "IOsampledSets.H" +#include "IOsampledSurfaces.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + +# include "addTimeOptions.H" +# include "setRootCase.H" + +# include "createTime.H" + + // Get times list + instantList Times = runTime.times(); + + // set startTime and endTime depending on -time and -latestTime options +# include "checkTimeOptions.H" + + runTime.setTime(Times[startTime], startTime); + +# include "createMesh.H" + + IOsampledSets sSets(mesh, "sampleDict", true); + IOsampledSurfaces sSurfaces(mesh, "sampleDict", true); + + for (label i=startTime; i<endTime; i++) + { + runTime.setTime(Times[i], i); + Info<< "Time = " << runTime.timeName() << endl; + + // Handle geometry/topology changes + polyMesh::readUpdateState state = mesh.readUpdate(); + + sSets.readUpdate(state); + sSurfaces.readUpdate(state); + + sSets.write(); + sSurfaces.write(); + + Info<< endl; + } + + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sampling/sample/sampleDict new file mode 100644 index 0000000000000000000000000000000000000000..ea6e1f7dbd7a83d7d04463e486299f91c3b70b02 --- /dev/null +++ b/applications/utilities/postProcessing/sampling/sampling/sample/sampleDict @@ -0,0 +1,173 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location system; + object sampleDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Set output format : choice of +// xmgr +// jplot +// gnuplot +// raw +setFormat raw; + +// Surface output format. Choice of +// null : suppress output +// foamFile : separate points, faces and values file +// dx : DX scalar or vector format +// vtk : VTK ascii format +// raw : x y z value format for use with e.g. gnuplot 'splot'. +// stl : ascii stl. Does not contain values! +surfaceFormat vtk; + +// interpolationScheme. choice of +// cell : use cell-centre value only; constant over cells (default) +// cellPoint : use cell-centre and vertex values +// cellPointFace : use cell-centre, vertex and face values. +// 1] vertex values determined from neighbouring cell-centre values +// 2] face values determined using the current face interpolation scheme +// for the field (linear, gamma, etc.) +interpolationScheme cellPointFace; + +// Fields to sample. +fields +( + p + U +); + + +// Set sampling definition: choice of +// uniform evenly distributed points on line +// face one point per face intersection +// midPoint one point per cell, inbetween two face intersections +// midPointAndFace combination of face and midPoint +// +// curve specified points, not nessecary on line, uses +// tracking +// cloud specified points, uses findCell +// +// axis: how to write point coordinate. Choice of +// - x/y/z: x/y/z coordinate only +// - xyz: three columns +// (probably does not make sense for anything but raw) +// - distance: distance from start of sampling line (if uses line) or +// distance from first specified sampling point +// +// type specific: +// uniform, face, midPoint, midPointAndFace : start and end coordinate +// uniform: extra number of sampling points +// curve, cloud: list of coordinates +sets +( + lineX1 + { + type uniform; + axis distance; + + //- cavity + start (0.02 0.051 0.005); + end (0.06 0.051 0.005); + nPoints 10; + } + + lineX2 + { + type face; + axis x; + + //- flangeHex + //start (0 20 -20); + //end (0 20 10); + + //- nablaCavity + //start (-1 0.05 0.005); + //end ( 1 0.05 0.005); + + //- cavity + start (0.0 0.51 0.005); + end (2 0.51 0.005); + nPoints 10; + } +); + + +// Surface sampling definition: choice of +// plane : values on plane defined by point, normal. +// patch : values on patch. +surfaces +( + constantPlane + { + type plane; + basePoint (0.0501 0.0501 0.005); + normalVector (0.1 0.1 1); + + //- Optional: restrict to a particular zone + // zoneName zone1; + + // Optional: whether to leave as faces or triangulate (=default) + triangulate false; + } + + interpolatedPlane + { + type plane; + // make plane relative to the coordinateSystem (Cartesian) + coordinateSystem + { + origin (0.0501 0.0501 0.005); + } + basePoint (0 0 0); + normalVector (0.1 0.1 1); + triangulate false; + interpolate true; + } + + movingWall_constant + { + type patch; + patchName movingWall; + triangulate false; + } + + movingWall_interpolated + { + type patch; + patchName movingWall; + triangulate false; + interpolate true; + } + +/* not yet (re)implemented -- + constantIso + { + name iso; + field rho; + value 0.5; + } + someIso + { + type iso; + field rho; + value 0.5; + interpolate true; + } + */ +); + + +// *********************************************************************** // diff --git a/bin/-- b/bin/-- deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/-----Original b/bin/-----Original deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/5.1. b/bin/5.1. deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/9 b/bin/9 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Basically b/bin/Basically deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Best b/bin/Best deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Can b/bin/Can deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Capgemini b/bin/Capgemini deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Caversham, b/bin/Caversham, deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Cent b/bin/Cent deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Charles. b/bin/Charles. deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Dear b/bin/Dear deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Do b/bin/Do deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Email: b/bin/Email: deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/FYI b/bin/FYI deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/From: b/bin/From: deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Henry b/bin/Henry deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/It b/bin/It deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Meanwhile, b/bin/Meanwhile, deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/OpenCFD b/bin/OpenCFD deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Out b/bin/Out deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Reading b/bin/Reading deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Reddy b/bin/Reddy deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Regards b/bin/Regards deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Sent: b/bin/Sent: deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Skype b/bin/Skype deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Subject: b/bin/Subject: deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Sure b/bin/Sure deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/This b/bin/This deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/To: b/bin/To: deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/URL: b/bin/URL: deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/Woking, b/bin/Woking, deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/[tt7dnr@linux17 b/bin/[tt7dnr@linux17 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/and b/bin/and deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/baffling b/bin/baffling deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/buildParaView3.2.1 b/bin/buildParaView3.2.1 new file mode 100755 index 0000000000000000000000000000000000000000..81a315fcee17cb171f07a5cef21e1376711054fb --- /dev/null +++ b/bin/buildParaView3.2.1 @@ -0,0 +1,156 @@ +#!/bin/sh +set -x + +# ParaView 3.x build script +# - run from folder above source folder +PARAVIEW_SRC="ParaView3.2.1" + +VERBOSE="OFF" +INCLUDE_MPI="ON" +MPI_MAX_PROCS=32 +INCLUDE_PYTHON="ON" +INCLUDE_MESA="OFF" + +# initialisation +CMAKE_VARIABLES="" +PWD=`pwd` +OBJ_ADD="" + +# set general options +CMAKE_VARIABLES="$CMAKE_VARIABLES -DBUILD_SHARED_LIBS:BOOL=ON" + +if [ "$VERBOSE" = "ON" ]; then + CMAKE_VARIABLES="$CMAKE_VARIABLES -DCMAKE_VERBOSE_MAKEFILE=TRUE" +fi + +# set MPI specific options +if [ "$INCLUDE_MPI" = "ON" ]; then + OBJ_ADD="$OBJ_ADD-mpi" + + if [ "$WM_MPLIB" = "OPENMPI" ]; then + MPI_INCLUDE_PATH=$OPENMPI_ARCH_PATH/include + MPI_LIBRARY=$OPENMPI_ARCH_PATH/lib/libmpi.so + MPI_RUN=$OPENMPI_ARCH_PATH/bin/mpirun + elif [ "$WM_MPLIB" = "LAM" ]; then + MPI_INCLUDE_PATH=$LAM_ARCH_PATH/include + MPI_LIBRARY=$LAM_ARCH_PATH/lib/libmpi.so + MPI_RUN=$LAM_ARCH_PATH/bin/mpirun + elif [ "$WM_MPLIB" = "MPICH" ]; then + MPI_INCLUDE_PATH=$MPICH_ARCH_PATH/include + MPI_LIBRARY=$MPICH_ARCH_PATH/lib/libmpich.so + MPI_RUN=$MPICH_ARCH_PATH/bin/mpirun + fi + + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_USE_MPI=ON" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DPARAVIEW_USE_MPI=ON" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DMPI_INCLUDE_PATH=$MPI_INCLUDE_PATH" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DMPI_LIBRARY=$MPI_LIBRARY" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_MPIRUN_EXE=$MPI_RUN" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" +fi + +# set python specific options +if [ "$INCLUDE_PYTHON" = "ON" ]; then + WHICH_PYTHON=`which python` + if [ "$WHICH_PYTHON" != "" ]; then + OBJ_ADD="$OBJ_ADD-py" + + PYTHON_LIBRARY=`ldd $WHICH_PYTHON | grep libpython | \ + sed 's/.* => \(.*\) (.*/\1/'` + PYTHON_MAJOR_VERSION=`echo $PYTHON_LIBRARY | \ + sed 's/.*libpython\(.*\).so.*/\1/'` + PYTHON_INCLUDE_DIR=/usr/include/python$PYTHON_MAJOR_VERSION + + CMAKE_VARIABLES="$CMAKE_VARIABLES -DPARAVIEW_ENABLE_PYTHON=ON" + CMAKE_VARIABLES= \ + "$CMAKE_VARIABLES -DPYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_DIR" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DPYTHON_LIBRARY=$PYTHON_LIBRARY" + else + echo "*** Warning: Unable to determine python libray" + echo "*** De-activating python support" + INCLUDE_PYTHON="OFF" + fi +fi + +# set MESA specific options +if [ "$INCLUDE_MESA" = "ON" ]; then + OBJ_ADD="$OBJ_ADD-mesa" + + MESA_INCLUDE_DIR=/usr/include/GL + MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so + + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_OPENGL_HAS_OSMESA=ON" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DOSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DOSMESA_LIBRARY=$MESA_LIBRARY" +fi + +# set paraview environment +PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC +#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD +PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS + +# remove existing build folder if present +if [ -e "$PARAVIEW_OBJ_DIR" ]; then + rm -rf $PARAVIEW_OBJ_DIR +fi + +# create paraview build folder +mkdir -p $PARAVIEW_OBJ_DIR +cd $PARAVIEW_OBJ_DIR + +echo "Building $PARAVIEW_SRC" +echo " MPI support : $INCLUDE_MPI" +echo " Python support : $INCLUDE_PYTHON" +echo " MESA support : $INCLUDE_MESA" +echo " Source : $PARAVIEW_SRC_DIR" +echo " Target : $PARAVIEW_OBJ_DIR" + +# make paraview +cmake \ + -DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \ + $CMAKE_VARIABLES \ + $PARAVIEW_SRC_DIR + +if [ -r /proc/cpuinfo ]; then + WM_NCOMPPROCS=`egrep "^processor" /proc/cpuinfo | wc -l` + + if [ $WM_NCOMPPROCS -gt 8 ]; then + WM_NCOMPPROCS=8 + fi + + make -j $WM_NCOMPPROCS +else + make +fi + +if [ -e "$PARAVIEW_OBJ_DIR/bin/paraview" ]; then + echo " Build complete" + + # replace local links with ParaView_INST_DIR environment variables + echo " Replacing path hard links" + find . -iname \*.cmake -execdir sed -i \ + "s,$PARAVIEW_SRC_DIR,\$ENV{ParaView_INST_DIR},g" {} ';' \ + -print + + # create a softlink to the $PARAVIEW_OBJ_DIR/bin folder + echo " Creating paraview 3.2 soft link to /bin" + ( mkdir lib && cd lib && ln -s ../bin paraview-3.2 ) + + # info on symlinks to screen + echo "" + echo " ---" + echo " Installation complete" + echo " Set environment variables:" + echo " - ParaView_INST_DIR to $PARAVIEW_SRC_DIR" + echo " - ParaView_DIR to $PARAVIEW_OBJ_DIR" + echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN" + echo " Add $PARAVIEW_OBJ_DIR/bin to PATH" + #echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH" + echo " ---" + echo "done." +fi + +# finalisation +cd $PWD + + diff --git a/bin/buildParaView3.3-cvs b/bin/buildParaView3.3-cvs new file mode 100755 index 0000000000000000000000000000000000000000..ed5683aa0f49b81b456cd0a65c6b182dbf0eeb78 --- /dev/null +++ b/bin/buildParaView3.3-cvs @@ -0,0 +1,156 @@ +#!/bin/sh +set -x + +# ParaView 3.x build script +# - run from folder above source folder +PARAVIEW_SRC="ParaView3.3-cvs" + +VERBOSE="OFF" +INCLUDE_MPI="ON" +MPI_MAX_PROCS=32 +INCLUDE_PYTHON="ON" +INCLUDE_MESA="OFF" + +# initialisation +CMAKE_VARIABLES="" +PWD=`pwd` +OBJ_ADD="" + +# set general options +CMAKE_VARIABLES="$CMAKE_VARIABLES -DBUILD_SHARED_LIBS:BOOL=ON" + +if [ "$VERBOSE" = "ON" ]; then + CMAKE_VARIABLES="$CMAKE_VARIABLES -DCMAKE_VERBOSE_MAKEFILE=TRUE" +fi + +# set MPI specific options +if [ "$INCLUDE_MPI" = "ON" ]; then + OBJ_ADD="$OBJ_ADD-mpi" + + if [ "$WM_MPLIB" = "OPENMPI" ]; then + MPI_INCLUDE_PATH=$OPENMPI_ARCH_PATH/include + MPI_LIBRARY=$OPENMPI_ARCH_PATH/lib/libmpi.so + MPI_RUN=$OPENMPI_ARCH_PATH/bin/mpirun + elif [ "$WM_MPLIB" = "LAM" ]; then + MPI_INCLUDE_PATH=$LAM_ARCH_PATH/include + MPI_LIBRARY=$LAM_ARCH_PATH/lib/libmpi.so + MPI_RUN=$LAM_ARCH_PATH/bin/mpirun + elif [ "$WM_MPLIB" = "MPICH" ]; then + MPI_INCLUDE_PATH=$MPICH_ARCH_PATH/include + MPI_LIBRARY=$MPICH_ARCH_PATH/lib/libmpich.so + MPI_RUN=$MPICH_ARCH_PATH/bin/mpirun + fi + + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_USE_MPI=ON" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DPARAVIEW_USE_MPI=ON" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DMPI_INCLUDE_PATH=$MPI_INCLUDE_PATH" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DMPI_LIBRARY=$MPI_LIBRARY" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_MPIRUN_EXE=$MPI_RUN" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" +fi + +# set python specific options +if [ "$INCLUDE_PYTHON" = "ON" ]; then + WHICH_PYTHON=`which python` + if [ "$WHICH_PYTHON" != "" ]; then + OBJ_ADD="$OBJ_ADD-py" + + PYTHON_LIBRARY=`ldd $WHICH_PYTHON | grep libpython | \ + sed 's/.* => \(.*\) (.*/\1/'` + PYTHON_MAJOR_VERSION=`echo $PYTHON_LIBRARY | \ + sed 's/.*libpython\(.*\).so.*/\1/'` + PYTHON_INCLUDE_DIR=/usr/include/python$PYTHON_MAJOR_VERSION + + CMAKE_VARIABLES="$CMAKE_VARIABLES -DPARAVIEW_ENABLE_PYTHON=ON" + CMAKE_VARIABLES= \ + "$CMAKE_VARIABLES -DPYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_DIR" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DPYTHON_LIBRARY=$PYTHON_LIBRARY" + else + echo "*** Warning: Unable to determine python libray" + echo "*** De-activating python support" + INCLUDE_PYTHON="OFF" + fi +fi + +# set MESA specific options +if [ "$INCLUDE_MESA" = "ON" ]; then + OBJ_ADD="$OBJ_ADD-mesa" + + MESA_INCLUDE_DIR=/usr/include/GL + MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so + + CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_OPENGL_HAS_OSMESA=ON" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DOSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR" + CMAKE_VARIABLES="$CMAKE_VARIABLES -DOSMESA_LIBRARY=$MESA_LIBRARY" +fi + +# set paraview environment +PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC +#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD +PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS + +# remove existing build folder if present +if [ -e "$PARAVIEW_OBJ_DIR" ]; then + rm -rf $PARAVIEW_OBJ_DIR +fi + +# create paraview build folder +mkdir -p $PARAVIEW_OBJ_DIR +cd $PARAVIEW_OBJ_DIR + +echo "Building $PARAVIEW_SRC" +echo " MPI support : $INCLUDE_MPI" +echo " Python support : $INCLUDE_PYTHON" +echo " MESA support : $INCLUDE_MESA" +echo " Source : $PARAVIEW_SRC_DIR" +echo " Target : $PARAVIEW_OBJ_DIR" + +# make paraview +cmake \ + -DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \ + $CMAKE_VARIABLES \ + $PARAVIEW_SRC_DIR + +if [ -r /proc/cpuinfo ]; then + WM_NCOMPPROCS=`egrep "^processor" /proc/cpuinfo | wc -l` + + if [ $WM_NCOMPPROCS -gt 8 ]; then + WM_NCOMPPROCS=8 + fi + + make -j $WM_NCOMPPROCS +else + make +fi + +if [ -e "$PARAVIEW_OBJ_DIR/bin/paraview" ]; then + echo " Build complete" + + # replace local links with ParaView_INST_DIR environment variables + echo " Replacing path hard links" + find . -iname \*.cmake -execdir sed -i \ + "s,$PARAVIEW_SRC_DIR,\$ENV{ParaView_INST_DIR},g" {} ';' \ + -print + + # create a softlink to the $PARAVIEW_OBJ_DIR/bin folder + echo " Creating paraview 3.2 soft link to /bin" + ( mkdir lib && cd lib && ln -s ../bin paraview-3.2 ) + + # info on symlinks to screen + echo "" + echo " ---" + echo " Installation complete" + echo " Set environment variables:" + echo " - ParaView_INST_DIR to $PARAVIEW_SRC_DIR" + echo " - ParaView_DIR to $PARAVIEW_OBJ_DIR" + echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN" + echo " Add $PARAVIEW_OBJ_DIR/bin to PATH" + #echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH" + echo " ---" + echo "done." +fi + +# finalisation +cd $PWD + + diff --git a/bin/cases b/bin/cases deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/doxyClassPatch b/bin/doxyClassPatch old mode 100644 new mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f724ca8d432681dbb107841adeb9238f0fcfa1f3 --- a/bin/doxyClassPatch +++ b/bin/doxyClassPatch @@ -0,0 +1,103 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. +# \\/ 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 2 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, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Script +# doxyClassPatch +# +# Description +# search for header files and fix up 'Class' section for doxygen +# +# change: +# |Class +# | className +# -> +# |Class +# | Foam::className +# +# change: +# |Class +# | +# -> +# |Class +# | Foam::(basename) +# +# leave untouched: +# |Class +# | Foam... +# and +# |Class +# | Namespace::className +# +# +# ----------------------------------------------------------------------------- +backup=.unclassified +remove=no + +for search +do + for file in $( + find -H $search \ + -type f -name "*.H" \ + -exec perl -ne \ + 'if (/^Class\s*$/) { $_ = <>; /(^\s*Foam|::)/ or print "$ARGV\n"; exit 0; }' \ + \{\} \; + ) + do + perl -i$backup -x $0 $file + if [ -f $file$backup ] + then + [ $file -nt $file$backup ] && touch -r $file$backup $file + [ "$remove" = yes ] && /bin/rm $file$backup 2>/dev/null + fi + done +done + +exit 0 +# ---------------------------------------------------------------- end-of-file + +# embedded Perl program +#!/usr/bin/perl -wp +use strict; + +my $namespace = "Foam::"; +( my $class = $ARGV ) =~ s{^.*/|\.[A-Za-z]$}{}g; + +if (/^Class\s*$/) { + print; + $_ = <>; + + # provide a reasonable guess for empty classes + if (/^\s*$/) { + $_ = " $namespace$class\n"; + warn "modified $ARGV\n"; + } + elsif ( not /(^\s*Foam|::)/ ) { + s{^\s+|\s*$}{}g; + $_ = " $namespace$_\n"; + warn "modified $ARGV\n"; + } +} + +# ---------------------------------------------------------------- end-of-file diff --git a/bin/in b/bin/in deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/intended b/bin/intended deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/or b/bin/or deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/paraFoam.pvs b/bin/paraFoam.pvs deleted file mode 100644 index 23f8dd2414803f5abfc0ad188031da34a9f4ff9d..0000000000000000000000000000000000000000 --- a/bin/paraFoam.pvs +++ /dev/null @@ -1,12 +0,0 @@ -# ParaView State Version 2.2 - -set kw(vtkTemp2) [$Application GetMainWindow] -set kw(vtkTemp29) [$kw(vtkTemp2) GetMainView] -set kw(vtkTemp980) [$kw(vtkTemp2) GetAnimationManager] -[$kw(vtkTemp2) GetRotateCameraButton] SetState 1 -$kw(vtkTemp2) ChangeInteractorStyle 1 -set kw(vtkTemp840) [$kw(vtkTemp2) InitializeReadCustom "FoamReader" "FOAM_ROOT/FOAM_CASE/FOAM_CASE.foam"] -$kw(vtkTemp2) ReadFileInformation $kw(vtkTemp840) "FOAM_ROOT/FOAM_CASE/FOAM_CASE.foam" -$kw(vtkTemp2) FinalizeRead $kw(vtkTemp840) "FOAM_ROOT/FOAM_CASE/FOAM_CASE.foam" -set kw(vtkTemp868) [$kw(vtkTemp840) GetPVWidget {Filename}] -$kw(vtkTemp868) SetValue "FOAM_ROOT/FOAM_CASE/FOAM_CASE.foam" diff --git a/bin/qt4-4.2.1-1 b/bin/qt4-4.2.1-1 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/qt4-devel-4.2.1-1 b/bin/qt4-devel-4.2.1-1 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/read, b/bin/read, deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/the b/bin/the deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/this b/bin/this deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/tutorial b/bin/tutorial deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/bin/which b/bin/which deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 6bd2b9646ec8c8df688b70b66fc865d31b1ed5bb..c02b490abb8f9674109f8f85e4a6ca379364caa3 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -45,7 +45,7 @@ fi export ParaView_VERSION=3 -export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/ParaView3.2.1 +export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/ParaView3.3-cvs export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_OPTIONS export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index aa9f8d3c56d9dc605692f00beeadb7eee6bfac80..784734816435d6ecddf287ca559343561bd56016 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -45,14 +45,10 @@ endif setenv ParaView_VERSION 3 -setenv ParaView_INST_DIR $WM_PROJECT_INST_DIR/ParaView3.2.1 +setenv ParaView_INST_DIR $WM_PROJECT_INST_DIR/ParaView3.3-cvs setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_OPTIONS -if ($?PYTHONPATH) then - setenv PYTHONPATH ${PYTHONPATH}:$ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping -else - setenv PYTHONPATH $ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping -endif +setenv PYTHONPATH $PYTHONPATH:$ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping if ( -r $ParaView_INST_DIR ) then set path=($ParaView_DIR/bin $path) diff --git a/src/LESmodels/compressible/Smagorinsky/Smagorinsky.C b/src/LESmodels/compressible/Smagorinsky/Smagorinsky.C index 3cf1691496384cad8833baf0ef77c80495aec022..0bee1a50ceb0bcbd4d5307fdff00082e56c4a277 100644 --- a/src/LESmodels/compressible/Smagorinsky/Smagorinsky.C +++ b/src/LESmodels/compressible/Smagorinsky/Smagorinsky.C @@ -71,7 +71,7 @@ void Smagorinsky::correct(const tmp<volTensorField>& gradU) volScalarField b = (2.0/3.0)*tr(D); volScalarField c = 2*ck_*delta()*(dev(D) && D); - k_ = sqr((2*b + sqrt(sqr(b) + 4*a*c))/(2*a)); + k_ = sqr((-b + sqrt(sqr(b) + 4*a*c))/(2*a)); muSgs_ = ck_*rho()*delta()*sqrt(k_); muSgs_.correctBoundaryConditions(); diff --git a/src/LESmodels/compressible/Smagorinsky/Smagorinsky.H b/src/LESmodels/compressible/Smagorinsky/Smagorinsky.H index ef2bbf72c9e03cbc360607fa82cbfb5f009c7e02..ba951aa86e15a830a98366d5449b768b45730469 100644 --- a/src/LESmodels/compressible/Smagorinsky/Smagorinsky.H +++ b/src/LESmodels/compressible/Smagorinsky/Smagorinsky.H @@ -38,8 +38,8 @@ Description where D = symm(grad(U)); - k = (2*ck/ce)*delta^2*grad(U):dev(D) - nuSgs = ck*sqrt(k)*delta + k from rho*D:B + ce*rho*k^3/2/delta = 0 + muSgs = ck*rho*sqrt(k)*delta @endverbatim SourceFiles diff --git a/src/LESmodels/compressible/oneEqEddy/oneEqEddy.C b/src/LESmodels/compressible/oneEqEddy/oneEqEddy.C index 6a9484b6774aec63870d5085294876ed202785e9..9788ad6115802a812f8da418c6765df788d24f27 100644 --- a/src/LESmodels/compressible/oneEqEddy/oneEqEddy.C +++ b/src/LESmodels/compressible/oneEqEddy/oneEqEddy.C @@ -43,7 +43,6 @@ addToRunTimeSelectionTable(LESmodel, oneEqEddy, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components oneEqEddy::oneEqEddy ( const volScalarField& rho, diff --git a/src/LESmodels/compressible/oneEqEddy/oneEqEddy.H b/src/LESmodels/compressible/oneEqEddy/oneEqEddy.H index 06f249881479b1536479fe073378d1fdaf20532c..a4f0d150f789662bc41c6e6d12b4851e9b065818 100644 --- a/src/LESmodels/compressible/oneEqEddy/oneEqEddy.H +++ b/src/LESmodels/compressible/oneEqEddy/oneEqEddy.H @@ -33,7 +33,7 @@ Description @verbatim d/dt(rho*k) + div(rho*U*k) - div(muEff*grad(k)) = - -rho*B*L - ce*rho*k^3/2/delta + -rho*D:B - ce*rho*k^3/2/delta and @@ -42,7 +42,7 @@ Description where D = symm(grad(U)); - nuSgs = ck*sqrt(k)*delta + muSgs = ck*rho*sqrt(k)*delta @endverbatim @@ -114,7 +114,7 @@ public: //- Return the effective diffusivity for k tmp<volScalarField> DkEff() const { - return tmp<volScalarField> + return tmp<volScalarField> ( new volScalarField("DkEff", muSgs_ + mu()) ); diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.H b/src/OpenFOAM/primitives/Scalar/Scalar.H index 7b83e8c4b26bbadf540ea7b2710b6a0b3c4bdc90..e360f2d7f9c930ac9b3ea633a38792661c1af8c9 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.H +++ b/src/OpenFOAM/primitives/Scalar/Scalar.H @@ -141,7 +141,7 @@ inline Scalar sqrtSumSqr(const Scalar a, const Scalar b) { Scalar maga = mag(a); Scalar magb = mag(b); - + if (maga > magb) { return maga*sqrt(1.0 + sqr(magb/maga)); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..d14d18abe891299dadcc8ea0b4aed12b1a71f9f2 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2006-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "turbulentMixingLengthFrequencyInletFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "surfaceFields.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + mixingLength_(0.0), + kName_("undefined-k") +{} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + mixingLength_(ptf.mixingLength_), + kName_(ptf.kName_) +{} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + mixingLength_(readScalar(dict.lookup("mixingLength"))), + kName_(dict.lookup("k")) +{} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf +) +: + fixedValueFvPatchField<scalar>(ptf), + mixingLength_(ptf.mixingLength_), + kName_(ptf.kName_) +{} + +turbulentMixingLengthFrequencyInletFvPatchScalarField:: +turbulentMixingLengthFrequencyInletFvPatchScalarField +( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(ptf, iF), + mixingLength_(ptf.mixingLength_), + kName_(ptf.kName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Lookup Cmu corresponding to the turbulence model selected + const dictionary& turbulenceProperties = db().lookupObject<IOdictionary> + ( + "turbulenceProperties" + ); + + const dictionary& turbulenceCoeffs = turbulenceProperties.subDict + ( + word(turbulenceProperties.lookup("turbulenceModel")) + "Coeffs" + ); + + scalar Cmu = dimensionedScalar(turbulenceCoeffs.lookup("Cmu")).value(); + scalar Cmu25 = pow(Cmu, 0.25); + + const fvPatchField<scalar>& kp = + patch().lookupPatchField<volScalarField, scalar>(kName_); + + operator==(sqrt(kp)/(Cmu25*mixingLength_)); + + fixedValueFvPatchField<scalar>::updateCoeffs(); +} + + +void turbulentMixingLengthFrequencyInletFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchField<scalar>::write(os); + os.writeKeyword("mixingLength") + << mixingLength_ << token::END_STATEMENT << nl; + os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + turbulentMixingLengthFrequencyInletFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..621741e05ed3f87ce773eeee8510748bfaf98fc6 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2006-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::turbulentMixingLengthDissipationRateInletFvPatchScalarField + +Description + Calculate omega via the mixing length + + Example of the boundary condition specification: + @verbatim + inlet + { + type turbulentMixingLengthFrequencyInlet; + mixingLength 0.005; // 5 mm + k k; // turbulent k field + value uniform 5; // initial value + } + @endverbatim + +SourceFiles + turbulentMixingLengthFrequencyInletFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef turbulentMixingLengthFrequencyInletFvPatchScalarField_H +#define turbulentMixingLengthFrequencyInletFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class turbulentMixingLengthFrequencyInletFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class turbulentMixingLengthFrequencyInletFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Turbulent length scale + scalar mixingLength_; + + //- Name of the turbulent kinetic energy field + word kName_; + + +public: + + //- Runtime type information + TypeName("turbulentMixingLengthFrequencyInlet"); + + + // Constructors + + //- Construct from patch and internal field + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // turbulentMixingLengthFrequencyInletFvPatchScalarField + // onto a new patch + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const turbulentMixingLengthFrequencyInletFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const turbulentMixingLengthFrequencyInletFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + const turbulentMixingLengthFrequencyInletFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new turbulentMixingLengthFrequencyInletFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C index ff46f9ee35bea3ecc2c971e9f263e5193898f6ee..e9e012a09d07bab27bd0111a9a14e806365e59e3 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C @@ -265,8 +265,8 @@ void Foam::MULES::implicitSolve } else { - Info<< "max(psi) - 1 = " << maxPsiM1 << endl; - Info<< "min(psi) = " << minPsi << endl; + Info<< "max(" + psi.name() + " - 1 = " << maxPsiM1 << endl; + Info<< "min(" + psi.name() + ") = " << minPsi << endl; phiBD = psiConvectionDiffusion.flux(); diff --git a/src/postProcessing/forces/forces/forces.H b/src/postProcessing/forces/forces/forces.H index 1c08475ee59f76c73e548c6d1b44550cd3a0df00..25bbe02f9998fdb2d6199e2759d46fcdb022dc77 100644 --- a/src/postProcessing/forces/forces/forces.H +++ b/src/postProcessing/forces/forces/forces.H @@ -50,6 +50,7 @@ SourceFiles #include "Tuple2.H" #include "OFstream.H" #include "Switch.H" +#include "pointFieldFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,6 +60,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class mapPolyMesh; /*---------------------------------------------------------------------------*\ Class forces Declaration @@ -204,6 +206,14 @@ public: //- Calculate and return forces and moment virtual forcesMoments calcForcesMoment() const; + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} }; diff --git a/src/sampling/Make/files b/src/sampling/Make/files index b6c268be3f6463520a740a5d6dd252c061d2860c..9e4a5f1bb4b3f2e9db931f86fcccf5a6a5ec58f4 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -1,21 +1,38 @@ probes/probes.C probes/probesFunctionObject.C +sampledSet/coordSet/coordSet.C +sampledSet/sampledSet/sampledSet.C +sampledSet/cloud/cloudSet.C +sampledSet/face/faceOnlySet.C +sampledSet/curve/curveSet.C +sampledSet/uniform/uniformSet.C +sampledSet/midPoint/midPointSet.C +sampledSet/midPointAndFace/midPointAndFaceSet.C +sampledSet/sampledSets/sampledSets.C +sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C + +sampledSet/writers/writer/writers.C +sampledSet/writers/xmgr/xmgrWriters.C +sampledSet/writers/gnuplot/gnuplotWriters.C +sampledSet/writers/jplot/jplotWriters.C +sampledSet/writers/raw/rawWriters.C + cuttingPlane/cuttingPlane.C sampledSurface/patch/sampledPatch.C sampledSurface/plane/sampledPlane.C -sampledSurface/surface/sampledSurface.C -sampledSurface/surfaces/sampledSurfaces.C -sampledSurface/surfacesFunctionObject/surfacesFunctionObject.C - -surfaceWriters/surfaceWriters.C -surfaceWriters/foamFile/foamFileWriters.C -surfaceWriters/dx/dxWriters.C -surfaceWriters/raw/rawWriters.C -surfaceWriters/vtk/vtkWriters.C -surfaceWriters/stl/stlWriters.C -surfaceWriters/null/nullWriters.C +sampledSurface/sampledSurface/sampledSurface.C +sampledSurface/sampledSurfaces/sampledSurfaces.C +sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.C + +sampledSurface/writers/surfaceWriters.C +sampledSurface/writers/foamFile/foamFileWriters.C +sampledSurface/writers/dx/dxWriters.C +sampledSurface/writers/raw/rawSurfaceWriters.C +sampledSurface/writers/vtk/vtkWriters.C +sampledSurface/writers/stl/stlWriters.C +sampledSurface/writers/null/nullWriters.C graphField/writePatchGraph.C graphField/writeCellGraph.C diff --git a/src/sampling/Make/options b/src/sampling/Make/options index 083733c5a4b140caa203fe8a66f106c2b0da9f55..5bfdcb260cee15abe17ecf4a2908a3b9fc7a5cf2 100644 --- a/src/sampling/Make/options +++ b/src/sampling/Make/options @@ -1,7 +1,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/triSurface/lnInclude + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude LIB_LIBS = \ -lfiniteVolume \ diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C index 5cc1abbf13100770fa5faa68e6d4f6f70d6fbd5c..39434d92cbc0fa10aeddbf293e77b81e071c38a2 100644 --- a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C +++ b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C @@ -48,7 +48,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter IOobject::NO_WRITE ) ), - OutputFilter(name(), obr, *this, readFromFiles) + OutputFilter(OutputFilter::typeName, obr, *this, readFromFiles) {} diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H index fde0f91867e76f2c6afb23e51f05ba155abf873f..aa095f376fe90bb78f38e7037542ae20d29d20f5 100644 --- a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H +++ b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ +/*---------------------------------------------------------------------------* \ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | @@ -99,14 +99,14 @@ public: virtual void write(); //- Update for changes of mesh - void updateMesh(const mapPolyMesh& mpm) + virtual void updateMesh(const mapPolyMesh& mpm) { read(); OutputFilter::updateMesh(mpm); } //- Update for changes of mesh - void movePoints(const pointField& points) + virtual void movePoints(const pointField& points) { read(); OutputFilter::movePoints(points); diff --git a/src/sampling/probes/probes.H b/src/sampling/probes/probes.H index 267cf42c630eb23b5e5eb774d0401c5efcb38b19..e62fe7a50c7400e918f09d1fbb0cb3a42c760afe 100644 --- a/src/sampling/probes/probes.H +++ b/src/sampling/probes/probes.H @@ -40,6 +40,7 @@ SourceFiles #include "HashPtrTable.H" #include "OFstream.H" +#include "polyMesh.H" #include "pointField.H" #include "volFieldsFwd.H" @@ -207,6 +208,10 @@ public: virtual void movePoints(const pointField&) {} + //- Update for changes of mesh due to readUpdate + virtual void readUpdate(const polyMesh::readUpdateState state) + {} + //- Sample a volume field at all locations template<class Type> tmp<Field<Type> > sample diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/cloud/cloudSet.C b/src/sampling/sampledSet/cloud/cloudSet.C similarity index 92% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/cloud/cloudSet.C rename to src/sampling/sampledSet/cloud/cloudSet.C index 9afa3b30cd32c2350bb6999b815d245871ef21db..f8fbf8ecdf96ed89e92de4d48f51db4d98f29521 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/cloud/cloudSet.C +++ b/src/sampling/sampledSet/cloud/cloudSet.C @@ -22,12 +22,10 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "cloudSet.H" -#include "sampleSet.H" +#include "sampledSet.H" #include "meshSearch.H" #include "DynamicList.H" #include "polyMesh.H" @@ -38,11 +36,8 @@ Description namespace Foam { - -defineTypeNameAndDebug(cloudSet, 0); - -addToRunTimeSelectionTable(sampleSet, cloudSet, word); - + defineTypeNameAndDebug(cloudSet, 0); + addToRunTimeSelectionTable(sampledSet, cloudSet, word); } @@ -110,17 +105,16 @@ void Foam::cloudSet::genSamples() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::cloudSet::cloudSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const List<point>& sampleCoords ) : - sampleSet(mesh, searchEngine, name, axis), + sampledSet(name, mesh, searchEngine, axis), sampleCoords_(sampleCoords) { genSamples(); @@ -132,15 +126,15 @@ Foam::cloudSet::cloudSet } -// Construct from dictionary Foam::cloudSet::cloudSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const dictionary& dict + const dictionary& dict ) : - sampleSet(mesh, searchEngine, dict), + sampledSet(name, mesh, searchEngine, dict), sampleCoords_(dict.lookup("points")) { genSamples(); @@ -170,7 +164,7 @@ Foam::point Foam::cloudSet::getRefPoint(const List<point>& pts) const else { return vector::zero; - } + } } diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/cloud/cloudSet.H b/src/sampling/sampledSet/cloud/cloudSet.H similarity index 96% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/cloud/cloudSet.H rename to src/sampling/sampledSet/cloud/cloudSet.H index 6aafc96c9034e1da2dc78b92000ce5c0fd124df8..e13feffb4e1c3ebc511b5af96047c77020e4b44e 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/cloud/cloudSet.H +++ b/src/sampling/sampledSet/cloud/cloudSet.H @@ -35,7 +35,7 @@ SourceFiles #ifndef cloudSet_H #define cloudSet_H -#include "sampleSet.H" +#include "sampledSet.H" #include "DynamicList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,7 +53,7 @@ template<class Type> class particle; class cloudSet : - public sampleSet + public sampledSet { // Private data @@ -87,9 +87,9 @@ public: //- Construct from components cloudSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const List<point>& sampleCoords ); @@ -97,9 +97,10 @@ public: //- Construct from dictionary cloudSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const dictionary& dict + const dictionary& dict ); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/coordSet/coordSet.C b/src/sampling/sampledSet/coordSet/coordSet.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/coordSet/coordSet.C rename to src/sampling/sampledSet/coordSet/coordSet.C diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/coordSet/coordSet.H b/src/sampling/sampledSet/coordSet/coordSet.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/coordSet/coordSet.H rename to src/sampling/sampledSet/coordSet/coordSet.H diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/curve/curveSet.C b/src/sampling/sampledSet/curve/curveSet.C similarity index 97% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/curve/curveSet.C rename to src/sampling/sampledSet/curve/curveSet.C index 91c7ee5ded080c1569cd96c4fa0c18e9a8c3221d..e0d3f5a4f18bcd4bccf2e93527e7aabb1f75e60f 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/curve/curveSet.C +++ b/src/sampling/sampledSet/curve/curveSet.C @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ +/*---------------------------------------------------------------------------* \ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "curveSet.H" @@ -41,11 +39,8 @@ Description namespace Foam { - -defineTypeNameAndDebug(curveSet, 0); - -addToRunTimeSelectionTable(sampleSet, curveSet, word); - + defineTypeNameAndDebug(curveSet, 0); + addToRunTimeSelectionTable(sampledSet, curveSet, word); } @@ -354,17 +349,16 @@ void Foam::curveSet::genSamples() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::curveSet::curveSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const List<point>& sampleCoords ) : - sampleSet(mesh, searchEngine, name, axis), + sampledSet(name, mesh, searchEngine, axis), sampleCoords_(sampleCoords) { genSamples(); @@ -376,15 +370,15 @@ Foam::curveSet::curveSet } -// Construct from dictionary Foam::curveSet::curveSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict ) : - sampleSet(mesh, searchEngine, dict), + sampledSet(name, mesh, searchEngine, dict), sampleCoords_(dict.lookup("points")) { genSamples(); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/curve/curveSet.H b/src/sampling/sampledSet/curve/curveSet.H similarity index 98% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/curve/curveSet.H rename to src/sampling/sampledSet/curve/curveSet.H index 579401fbbc295a46e2dfeaebe1a0f3da7c65b744..b3c245864d54788cab612f0a92aaaaf67f1c62dc 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/curve/curveSet.H +++ b/src/sampling/sampledSet/curve/curveSet.H @@ -35,7 +35,7 @@ SourceFiles #ifndef curveSet_H #define curveSet_H -#include "sampleSet.H" +#include "sampledSet.H" #include "DynamicList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,7 +53,7 @@ template<class Type> class Particle; class curveSet : - public sampleSet + public sampledSet { // Private data @@ -89,6 +89,8 @@ class curveSet //- Uses calcSamples to obtain samples. Copies them into *this. void genSamples(); + + public: //- Runtime type information @@ -100,9 +102,9 @@ public: //- Construct from components curveSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const List<point>& samplePoints ); @@ -110,6 +112,7 @@ public: //- Construct from dictionary curveSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C similarity index 97% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/face/faceOnlySet.C rename to src/sampling/sampledSet/face/faceOnlySet.C index db0486af2b6467a6ad73938ee7d85038defdd25d..8e922bbf3ef09f90a494b6504d96667dcbf0122e 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "faceOnlySet.H" @@ -42,7 +40,7 @@ Description namespace Foam { defineTypeNameAndDebug(faceOnlySet, 0); - addToRunTimeSelectionTable(sampleSet, faceOnlySet, word); + addToRunTimeSelectionTable(sampledSet, faceOnlySet, word); } @@ -334,18 +332,17 @@ void Foam::faceOnlySet::genSamples() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::faceOnlySet::faceOnlySet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end ) : - sampleSet(mesh, searchEngine, name, axis), + sampledSet(name, mesh, searchEngine, axis), start_(start), end_(end) { @@ -358,15 +355,15 @@ Foam::faceOnlySet::faceOnlySet } -// Construct from dictionary Foam::faceOnlySet::faceOnlySet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict ) : - sampleSet(mesh, searchEngine, dict), + sampledSet(name, mesh, searchEngine, dict), start_(dict.lookup("start")), end_(dict.lookup("end")) { diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/face/faceOnlySet.H b/src/sampling/sampledSet/face/faceOnlySet.H similarity index 98% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/face/faceOnlySet.H rename to src/sampling/sampledSet/face/faceOnlySet.H index 213881c00aa2e35a03ff53a53b7c74f987608983..2865b9af24afb6ed7526427f4fdad586f18c94a1 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/face/faceOnlySet.H +++ b/src/sampling/sampledSet/face/faceOnlySet.H @@ -35,7 +35,7 @@ SourceFiles #ifndef faceOnlySet_H #define faceOnlySet_H -#include "sampleSet.H" +#include "sampledSet.H" #include "DynamicList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,7 +53,7 @@ template<class Type> class Particle; class faceOnlySet : - public sampleSet + public sampledSet { // Private data @@ -103,9 +103,9 @@ public: //- Construct from components faceOnlySet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end @@ -114,6 +114,7 @@ public: //- Construct from dictionary faceOnlySet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPoint/midPointSet.C b/src/sampling/sampledSet/midPoint/midPointSet.C similarity index 93% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/midPoint/midPointSet.C rename to src/sampling/sampledSet/midPoint/midPointSet.C index 88d4b86a3e349bece6b2a94bb1d5bf83a4abe1c2..4cf5b043117b0c6f052dee88d37c828e1f41bffe 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPoint/midPointSet.C +++ b/src/sampling/sampledSet/midPoint/midPointSet.C @@ -33,11 +33,8 @@ License namespace Foam { - -defineTypeNameAndDebug(midPointSet, 0); - -addToRunTimeSelectionTable(sampleSet, midPointSet, word); - + defineTypeNameAndDebug(midPointSet, 0); + addToRunTimeSelectionTable(sampledSet, midPointSet, word); } @@ -119,18 +116,17 @@ void Foam::midPointSet::genSamples() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::midPointSet::midPointSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end ) : - faceOnlySet(mesh, searchEngine, name, axis, start, end) + faceOnlySet(name, mesh, searchEngine, axis, start, end) { genSamples(); @@ -141,15 +137,15 @@ Foam::midPointSet::midPointSet } -// Construct from dictionary Foam::midPointSet::midPointSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const dictionary& dict + const dictionary& dict ) : - faceOnlySet(mesh, searchEngine, dict) + faceOnlySet(name, mesh, searchEngine, dict) { genSamples(); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPoint/midPointSet.H b/src/sampling/sampledSet/midPoint/midPointSet.H similarity index 97% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/midPoint/midPointSet.H rename to src/sampling/sampledSet/midPoint/midPointSet.H index 10c2dc9688199e027dd6baf9c9daf28dc21dafd2..51eb0cbc356db2a5d5bce7159740a97c56533d29 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPoint/midPointSet.H +++ b/src/sampling/sampledSet/midPoint/midPointSet.H @@ -70,9 +70,9 @@ public: //- Construct from components midPointSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end @@ -81,9 +81,10 @@ public: //- Construct from dictionary midPointSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const dictionary& dict + const dictionary& dict ); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPointAndFace/midPointAndFaceSet.C b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C similarity index 93% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/midPointAndFace/midPointAndFaceSet.C rename to src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C index a425dc9bf65e073f0b18353fe41109779e9dbe0c..ae1dd42849886fbdba28570629217b47493e9dcc 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPointAndFace/midPointAndFaceSet.C +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "midPointAndFaceSet.H" @@ -36,11 +34,8 @@ Description namespace Foam { - -defineTypeNameAndDebug(midPointAndFaceSet, 0); - -addToRunTimeSelectionTable(sampleSet, midPointAndFaceSet, word); - + defineTypeNameAndDebug(midPointAndFaceSet, 0); + addToRunTimeSelectionTable(sampledSet, midPointAndFaceSet, word); } @@ -82,7 +77,7 @@ void Foam::midPointAndFaceSet::genSamples() { // Add mid point const point mid = 0.5*(operator[](sampleI) + operator[](sampleI+1)); - + label cell1 = getCell(faces_[sampleI], mid); label cell2 = getCell(faces_[sampleI+1], mid); @@ -147,18 +142,17 @@ void Foam::midPointAndFaceSet::genSamples() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::midPointAndFaceSet::midPointAndFaceSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end ) : - faceOnlySet(mesh, searchEngine, name, axis, start, end) + faceOnlySet(name, mesh, searchEngine, axis, start, end) { genSamples(); @@ -169,15 +163,15 @@ Foam::midPointAndFaceSet::midPointAndFaceSet } -// Construct from dictionary Foam::midPointAndFaceSet::midPointAndFaceSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const dictionary& dict + const dictionary& dict ) : - faceOnlySet(mesh, searchEngine, dict) + faceOnlySet(name, mesh, searchEngine, dict) { genSamples(); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPointAndFace/midPointAndFaceSet.H b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H similarity index 97% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/midPointAndFace/midPointAndFaceSet.H rename to src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H index 12d957b60fe52984f816bca5e4015473b1a36ae8..5a7e9e919841e2c5acde6579fb85599547a2723e 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/midPointAndFace/midPointAndFaceSet.H +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H @@ -71,9 +71,9 @@ public: //- Construct from components midPointAndFaceSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end @@ -82,9 +82,10 @@ public: //- Construct from dictionary midPointAndFaceSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const dictionary& dict + const dictionary& dict ); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/sampleSet/sampleSet.C b/src/sampling/sampledSet/sampledSet/sampledSet.C similarity index 87% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/sampleSet/sampleSet.C rename to src/sampling/sampledSet/sampledSet/sampledSet.C index 3a06bfb8afc2953a4186ec84de8ad08e06cf745d..4426a27decfd99a2c66dc524a184c43f20e6312c 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/sampleSet/sampleSet.C +++ b/src/sampling/sampledSet/sampledSet/sampledSet.C @@ -22,11 +22,9 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ -#include "sampleSet.H" +#include "sampledSet.H" #include "polyMesh.H" #include "primitiveMesh.H" #include "meshSearch.H" @@ -36,60 +34,22 @@ Description namespace Foam { + const scalar sampledSet::tol = 1e-6; -const scalar sampleSet::tol = 1e-6; - -defineTypeNameAndDebug(sampleSet, 0); -defineRunTimeSelectionTable(sampleSet, word); - -autoPtr<sampleSet> sampleSet::New -( - const word& sampleType, - const polyMesh& mesh, - meshSearch& searchEngine, - const dictionary& dict -) -{ - wordConstructorTable::iterator cstrIter = - wordConstructorTablePtr_ - ->find(sampleType); - - if (cstrIter == wordConstructorTablePtr_->end()) - { - FatalErrorIn - ( - "sampleSet::New(const word&, " - "const polyMesh&, meshSearch&, const dictionary&)" - ) << "Unknown sample type " << sampleType - << endl << endl - << "Valid sample types : " << endl - << wordConstructorTablePtr_->toc() - << exit(FatalError); - } - - return autoPtr<sampleSet> - ( - cstrIter() - ( - mesh, - searchEngine, - dict - ) - ); + defineTypeNameAndDebug(sampledSet, 0); + defineRunTimeSelectionTable(sampledSet, word); } -} // End namespace Foam - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::label Foam::sampleSet::getBoundaryCell(const label faceI) const +Foam::label Foam::sampledSet::getBoundaryCell(const label faceI) const { return mesh().faceOwner()[faceI]; } -Foam::label Foam::sampleSet::getCell +Foam::label Foam::sampledSet::getCell ( const label faceI, const point& sample @@ -99,7 +59,7 @@ Foam::label Foam::sampleSet::getCell { FatalErrorIn ( - "sampleSet::getCell(const label, const point&)" + "sampledSet::getCell(const label, const point&)" ) << "Illegal face label " << faceI << abort(FatalError); } @@ -112,7 +72,7 @@ Foam::label Foam::sampleSet::getCell { FatalErrorIn ( - "sampleSet::getCell(const label, const point&)" + "sampledSet::getCell(const label, const point&)" ) << "Found cell " << cellI << " using face " << faceI << ". But cell does not contain point " << sample << abort(FatalError); @@ -141,7 +101,7 @@ Foam::label Foam::sampleSet::getCell { FatalErrorIn ( - "sampleSet::getCell(const label, const point&)" + "sampledSet::getCell(const label, const point&)" ) << "None of the neighbours of face " << faceI << " contains point " << sample << abort(FatalError); @@ -153,7 +113,7 @@ Foam::label Foam::sampleSet::getCell } -Foam::scalar Foam::sampleSet::calcSign +Foam::scalar Foam::sampledSet::calcSign ( const label faceI, const point& sample @@ -175,12 +135,12 @@ Foam::scalar Foam::sampleSet::calcSign n /= mag(n) + VSMALL; - return n & vec; + return n & vec; } // Return face (or -1) of face which is within smallDist of sample -Foam::label Foam::sampleSet::findNearFace +Foam::label Foam::sampledSet::findNearFace ( const label cellI, const point& sample, @@ -217,7 +177,7 @@ Foam::label Foam::sampleSet::findNearFace // 'Pushes' point facePt (which is almost on face) in direction of cell centre // so it is clearly inside. -Foam::point Foam::sampleSet::pushIn +Foam::point Foam::sampledSet::pushIn ( const point& facePt, const label faceI @@ -234,7 +194,7 @@ Foam::point Foam::sampleSet::pushIn { FatalErrorIn ( - "sampleSet::pushIn(const point&, const label)" + "sampledSet::pushIn(const point&, const label)" ) << "After pushing " << facePt << " to " << newSample << " it is still outside faceI " << faceI << endl << "Please change your starting point" @@ -250,7 +210,7 @@ Foam::point Foam::sampleSet::pushIn // Calculates start of tracking given samplePt and first boundary intersection // (bPoint, bFaceI). bFaceI == -1 if no boundary intersection. // Returns true if trackPt is sampling point -bool Foam::sampleSet::getTrackingPoint +bool Foam::sampledSet::getTrackingPoint ( const vector& offset, const point& samplePt, @@ -341,7 +301,7 @@ bool Foam::sampleSet::getTrackingPoint if (debug) { - Info<< "sampleSet::getTrackingPoint :" + Info<< "sampledSet::getTrackingPoint :" << " offset:" << offset << " samplePt:" << samplePt << " bPoint:" << bPoint @@ -355,10 +315,10 @@ bool Foam::sampleSet::getTrackingPoint } return isGoodSample; -} +} -void Foam::sampleSet::setSamples +void Foam::sampledSet::setSamples ( const List<point>& samplingPts, const labelList& samplingCells, @@ -381,7 +341,7 @@ void Foam::sampleSet::setSamples || (curveDist_.size() != size()) ) { - FatalErrorIn("sampleSet::setSamples()") + FatalErrorIn("sampledSet::setSamples()") << "sizes not equal : " << " points:" << size() << " cells:" << cells_.size() @@ -404,12 +364,11 @@ void Foam::sampleSet::setSamples // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from mesh, name -Foam::sampleSet::sampleSet +Foam::sampledSet::sampledSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis ) : @@ -423,15 +382,15 @@ Foam::sampleSet::sampleSet {} -// Construct from dictionary -Foam::sampleSet::sampleSet +Foam::sampledSet::sampledSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const dictionary& dict + const dictionary& dict ) : - coordSet(dict.lookup("name"), dict.lookup("axis")), + coordSet(name, dict.lookup("axis")), mesh_(mesh), searchEngine_(searchEngine), segments_(0), @@ -443,25 +402,66 @@ Foam::sampleSet::sampleSet // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::sampleSet::~sampleSet() +Foam::sampledSet::~sampledSet() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::Ostream& Foam::sampleSet::write(Ostream& os) const +Foam::autoPtr<Foam::sampledSet> Foam::sampledSet::New +( + const word& name, + const polyMesh& mesh, + meshSearch& searchEngine, + const dictionary& dict +) +{ + word sampleType(dict.lookup("type")); + + wordConstructorTable::iterator cstrIter = + wordConstructorTablePtr_->find(sampleType); + + if (cstrIter == wordConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "sampledSet::New(const word&, " + "const polyMesh&, meshSearch&, const dictionary&)" + ) << "Unknown sample type " << sampleType + << endl << endl + << "Valid sample types : " << endl + << wordConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr<sampledSet> + ( + cstrIter() + ( + name, + mesh, + searchEngine, + dict + ) + ); +} + + +Foam::Ostream& Foam::sampledSet::write(Ostream& os) const { coordSet::write(os); - os << endl << "\t(cellI)\t(faceI)" - << endl; + os << endl << "\t(cellI)\t(faceI)" << endl; + forAll(*this, sampleI) { os << '\t' << cells_[sampleI] << '\t' << faces_[sampleI] << endl; } + return os; } + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/sampleSet/sampleSet.H b/src/sampling/sampledSet/sampledSet/sampledSet.H similarity index 87% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/sampleSet/sampleSet.H rename to src/sampling/sampledSet/sampledSet/sampledSet.H index 96cdef7ad2d2e9c866c6f81be9eb8587b6901f45..e8cf28c1a383ab3c6d96b4e38fabc134e7cc70c5 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/sampleSet/sampleSet.H +++ b/src/sampling/sampledSet/sampledSet/sampledSet.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::sampleSet + Foam::sampledSet Description Holds list of sampling points which is filled at construction time. @@ -31,16 +31,16 @@ Description at uniform distance along a line (uniformSet) or directly specified (cloudSet) - Each 'sampleSet' has a name and a specifier of how the axis should be + Each 'sampledSet' has a name and a specifier of how the axis should be write (x/y/z component or all 3 components) SourceFiles - sampleSet.C + sampledSet.C \*---------------------------------------------------------------------------*/ -#ifndef sampleSet_H -#define sampleSet_H +#ifndef sampledSet_H +#define sampledSet_H #include "pointField.H" #include "word.H" @@ -60,10 +60,10 @@ class polyMesh; class meshSearch; /*---------------------------------------------------------------------------*\ - Class sampleSet Declaration + Class sampledSet Declaration \*---------------------------------------------------------------------------*/ -class sampleSet +class sampledSet : public coordSet { @@ -75,6 +75,7 @@ class sampleSet //- Reference to mesh searching class meshSearch& searchEngine_; + protected: //- Segment numbers @@ -90,6 +91,7 @@ protected: //- Face numbers (-1 if not known) labelList faces_; + // Protected Member Functions //- Returns cell next to boundary face @@ -148,10 +150,11 @@ protected: const scalarList& samplingCurveDist ); + public: //- Runtime type information - TypeName("sampleSet"); + TypeName("sampledSet"); // Declare run-time constructor selection table @@ -159,19 +162,20 @@ public: declareRunTimeSelectionTable ( autoPtr, - sampleSet, + sampledSet, word, ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict ), - (mesh, searchEngine, dict) + (name, mesh, searchEngine, dict) ); //- Class used for the read-construction of - // PtrLists of sampleSet + // PtrLists of sampledSet class iNew { const polyMesh& mesh_; @@ -185,11 +189,11 @@ public: searchEngine_(searchEngine) {} - autoPtr<sampleSet> operator()(Istream& is) const + autoPtr<sampledSet> operator()(Istream& is) const { - word sampleType(is); - dictionary dict(is); - return sampleSet::New(sampleType, mesh_, searchEngine_, dict); + word name(is); + dictionary dict(is); + return sampledSet::New(name, mesh_, searchEngine_, dict); } }; @@ -203,37 +207,38 @@ public: // Constructors - //- Construct from mesh, name - sampleSet + //- Construct from components + sampledSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis ); //- Construct from dictionary - sampleSet + sampledSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict ); //- Clone - autoPtr<sampleSet> clone() const + autoPtr<sampledSet> clone() const { - notImplemented("autoPtr<sampleSet> clone() const"); - return autoPtr<sampleSet>(NULL); + notImplemented("autoPtr<sampledSet> clone() const"); + return autoPtr<sampledSet>(NULL); } // Selectors - //- Return a reference to the selected sampleSet - static autoPtr<sampleSet> New + //- Return a reference to the selected sampledSet + static autoPtr<sampledSet> New ( - const word& sampleType, + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict @@ -242,7 +247,7 @@ public: // Destructor - virtual ~sampleSet(); + virtual ~sampledSet(); // Member Functions diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/rawWriters.C b/src/sampling/sampledSet/sampledSets/IOsampledSets.H similarity index 84% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/rawWriters.C rename to src/sampling/sampledSet/sampledSets/IOsampledSets.H index ecf4146d17fb00164cdf4306316e725a2a0d6a89..84923c76f39792f4dbaacc12089113326372ad35 100644 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/raw/rawWriters.C +++ b/src/sampling/sampledSet/sampledSets/IOsampledSets.H @@ -22,22 +22,29 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Typedef + IOsampledSets + +Description + Instance of the generic IOOutputFilter for sampledSets. + \*---------------------------------------------------------------------------*/ -#include "rawWriters.H" -#include "addToRunTimeSelectionTable.H" +#ifndef IOsampledSets_H +#define IOsampledSets_H + +#include "sampledSets.H" +#include "IOOutputFilter.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeWriters(raw); + typedef IOOutputFilter<sampledSets> IOsampledSets; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +#endif // ************************************************************************* // diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C new file mode 100644 index 0000000000000000000000000000000000000000..c70c1144d68358af4609c21c46998b4937a6fc1e --- /dev/null +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -0,0 +1,368 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sampledSets.H" +#include "dictionary.H" +#include "Time.H" +#include "volFields.H" +#include "ListListOps.H" +#include "SortableList.H" + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(sampledSets, 0); +} + +bool Foam::sampledSets::verbose_ = false; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +bool Foam::sampledSets::checkFieldTypes() +{ + wordList fieldTypes(fieldNames_.size()); + + // check files for a particular time + if (loadFromFiles_) + { + forAll(fieldNames_, fieldi) + { + IOobject io + ( + fieldNames_[fieldi], + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + if (io.headerOk()) + { + fieldTypes[fieldi] = io.headerClassName(); + } + else + { + fieldTypes[fieldi] = "(notFound)"; + } + } + } + else + { + // check objectRegistry + forAll(fieldNames_, fieldi) + { + objectRegistry::const_iterator iter = + mesh_.find(fieldNames_[fieldi]); + + if (iter != mesh_.objectRegistry::end()) + { + fieldTypes[fieldi] = iter()->type(); + } + else + { + fieldTypes[fieldi] = "(notFound)"; + } + } + } + + + label nFields = 0; + + // classify fieldTypes + nFields += grep(scalarFields_, fieldTypes); + nFields += grep(vectorFields_, fieldTypes); + nFields += grep(sphericalTensorFields_, fieldTypes); + nFields += grep(symmTensorFields_, fieldTypes); + nFields += grep(tensorFields_, fieldTypes); + + if (Pstream::master) + { + if (debug) + { + Pout<< "timeName = " << mesh_.time().timeName() << nl + << "scalarFields " << scalarFields_ << nl + << "vectorFields " << vectorFields_ << nl + << "sphTensorFields " << sphericalTensorFields_ << nl + << "symTensorFields " << symmTensorFields_ <<nl + << "tensorFields " << tensorFields_ <<nl; + } + + if (nFields > 0) + { + if (debug) + { + Pout<< "Creating directory " + << outputPath_/mesh_.time().timeName() + << nl << endl; + } + + mkDir(outputPath_/mesh_.time().timeName()); + } + } + + return nFields > 0; +} + + +void Foam::sampledSets::combineSampledSets +( + PtrList<coordSet>& masterSampledSets, + labelListList& indexSets +) +{ + // Combine sampleSets from processors. Sort by curveDist. Return + // ordering in indexSets. + // Note: only master results are valid + + masterSampledSets_.clear(); + masterSampledSets_.setSize(size()); + indexSets_.setSize(size()); + + const PtrList<sampledSet>& sampledSets = *this; + + forAll(sampledSets, seti) + { + const sampledSet& samplePts = sampledSets[seti]; + + // Collect data from all processors + List<List<point> > gatheredPts(Pstream::nProcs()); + gatheredPts[Pstream::myProcNo()] = samplePts; + Pstream::gatherList(gatheredPts); + + List<labelList> gatheredSegments(Pstream::nProcs()); + gatheredSegments[Pstream::myProcNo()] = samplePts.segments(); + Pstream::gatherList(gatheredSegments); + + List<scalarList> gatheredDist(Pstream::nProcs()); + gatheredDist[Pstream::myProcNo()] = samplePts.curveDist(); + Pstream::gatherList(gatheredDist); + + + // Combine processor lists into one big list. + List<point> allPts + ( + ListListOps::combine<List<point> > + ( + gatheredPts, accessOp<List<point> >() + ) + ); + labelList allSegments + ( + ListListOps::combine<labelList> + ( + gatheredSegments, accessOp<labelList>() + ) + ); + scalarList allCurveDist + ( + ListListOps::combine<scalarList> + ( + gatheredDist, accessOp<scalarList>() + ) + ); + + // Sort curveDist and use to fill masterSamplePts + SortableList<scalar> sortedDist(allCurveDist); + indexSets[seti] = sortedDist.indices(); + + // Get reference point (note: only master has all points) + point refPt; + + if (allPts.size() > 0) + { + refPt = samplePts.getRefPoint(allPts); + } + else + { + refPt = vector::zero; + } + + + masterSampledSets.set + ( + seti, + new coordSet + ( + samplePts.name(), + samplePts.axis(), + IndirectList<point>(allPts, indexSets[seti]), + refPt + ) + ); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::sampledSets::sampledSets +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + PtrList<sampledSet>(), + name_(name), + mesh_(refCast<const fvMesh>(obr)), + loadFromFiles_(loadFromFiles), + outputPath_(fileName::null), + searchEngine_(mesh_, true), + pMeshPtr_(NULL), + pInterpPtr_(NULL), + fieldNames_(), + interpolationScheme_(word::null), + writeFormat_(word::null) +{ + if (Pstream::parRun()) + { + outputPath_ = mesh_.time().path()/".."/name_; + } + else + { + outputPath_ = mesh_.time().path()/name_; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::sampledSets::~sampledSets() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::sampledSets::verbose(const bool verbosity) +{ + verbose_ = verbosity; +} + + +void Foam::sampledSets::write() +{ + if (size() && checkFieldTypes()) + { + sampleAndWrite(scalarFields_); + sampleAndWrite(vectorFields_); + sampleAndWrite(sphericalTensorFields_); + sampleAndWrite(symmTensorFields_); + sampleAndWrite(tensorFields_); + } +} + + +void Foam::sampledSets::read(const dictionary& dict) +{ + dict_ = dict; + + fieldNames_ = wordList(dict_.lookup("fields")); + + interpolationScheme_ = "cell"; + if (dict_.found("interpolationScheme")) + { + dict_.lookup("interpolationScheme") >> interpolationScheme_; + } + + writeFormat_ = "null"; + if (dict_.found("setFormat")) + { + dict_.lookup("setFormat") >> writeFormat_; + } + + scalarFields_.clear(); + vectorFields_.clear(); + sphericalTensorFields_.clear(); + symmTensorFields_.clear(); + tensorFields_.clear(); + + PtrList<sampledSet> newList + ( + dict_.lookup("sets"), + sampledSet::iNew(mesh_, searchEngine_) + ); + transfer(newList); + combineSampledSets(masterSampledSets_, indexSets_); + + if (Pstream::master() && debug) + { + Pout<< "sample fields:" << fieldNames_ << nl + << "sample sets:" << nl << "(" << nl; + + forAll(*this, si) + { + Pout << " " << operator[](si) << endl; + } + Pout << ")" << endl; + } +} + + +void Foam::sampledSets::correct() +{ + pMeshPtr_.clear(); + pInterpPtr_.clear(); + searchEngine_.correct(); + + PtrList<sampledSet> newList + ( + dict_.lookup("sets"), + sampledSet::iNew(mesh_, searchEngine_) + ); + transfer(newList); + combineSampledSets(masterSampledSets_, indexSets_); +} + + +void Foam::sampledSets::updateMesh(const mapPolyMesh&) +{ + correct(); +} + + +void Foam::sampledSets::movePoints(const pointField&) +{ + correct(); +} + + +void Foam::sampledSets::readUpdate(const polyMesh::readUpdateState state) +{ + if (state != polyMesh::UNCHANGED) + { + correct(); + } +} + + +// ************************************************************************* // diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.H b/src/sampling/sampledSet/sampledSets/sampledSets.H new file mode 100644 index 0000000000000000000000000000000000000000..d60ce1a7e9f3f32340d91d577e298cd63a5031ed --- /dev/null +++ b/src/sampling/sampledSet/sampledSets/sampledSets.H @@ -0,0 +1,315 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::sampledSets + +Description + Set of sets to sample. + Call sampledSets.write() to sample&write files. + +SourceFiles + sampledSets.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sampledSets_H +#define sampledSets_H + +#include "sampledSet.H" +#include "volFieldsFwd.H" +#include "meshSearch.H" +#include "interpolation.H" +#include "coordSet.H" +#include "writer.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class objectRegistry; +class dictionary; +class fvMesh; +class volPointInterpolation; + +/*---------------------------------------------------------------------------*\ + Class sampledSets Declaration +\*---------------------------------------------------------------------------*/ + +class sampledSets +: + public PtrList<sampledSet> +{ + // Private classes + + //- Class used for grouping field types + template<class Type> + class fieldGroup + : + public wordList + { + public: + + //- Set formatter + autoPtr<writer<Type> > formatter; + + //- Construct null + fieldGroup() + : + wordList(0), + formatter(NULL) + {} + + void clear() + { + wordList::clear(); + formatter.clear(); + } + }; + + + //- Class used for sampling volFields + template <class Type> + class volFieldSampler + : + public List<Field<Type> > + { + //- Name of this collection of values + const word name_; + + public: + + //- Construct interpolating field to the sampleSets + volFieldSampler + ( + const volPointInterpolation&, + const word& interpolationScheme, + const GeometricField<Type, fvPatchField, volMesh>& field, + const PtrList<sampledSet>& + ); + + //- Construct mapping field to the sampleSets + volFieldSampler + ( + const GeometricField<Type, fvPatchField, volMesh>& field, + const PtrList<sampledSet>& + ); + + //- Construct from components + volFieldSampler + ( + const List<Field<Type> >& values, + const word& name + ); + + //- Return the field name + const word& name() const + { + return name_; + } + }; + + + // Static data members + + //- output verbosity + static bool verbose_; + + + // Private data + + //- Name of this set of sets, + // Also used as the name of the sampledSets directory. + word name_; + + //- Const reference to fvMesh + const fvMesh& mesh_; + + //- Keep the dictionary to recreate sets for moving mesh cases + dictionary dict_; + + //- Load fields from files (not from objectRegistry) + bool loadFromFiles_; + + //- Output path + fileName outputPath_; + + //- Mesh search engine + meshSearch searchEngine_; + + //- pointMesh for interpolation + autoPtr<pointMesh> pMeshPtr_; + + //- volPointInterpolation for interpolation + autoPtr<volPointInterpolation> pInterpPtr_; + + + // Read from dictonary + + //- Names of fields to sample + wordList fieldNames_; + + //- Interpolation scheme to use + word interpolationScheme_; + + //- Output format to use + word writeFormat_; + + + // Categorized scalar/vector/tensor fields + + fieldGroup<scalar> scalarFields_; + fieldGroup<vector> vectorFields_; + fieldGroup<sphericalTensor> sphericalTensorFields_; + fieldGroup<symmTensor> symmTensorFields_; + fieldGroup<tensor> tensorFields_; + + + // Merging structures + + PtrList<coordSet> masterSampledSets_; + labelListList indexSets_; + + + // Private Member Functions + + //- Classify field types, return true if nFields > 0 + bool checkFieldTypes(); + + //- Find the fields in the list of the given type, return count + template<class Type> + label grep + ( + fieldGroup<Type>& fieldList, + const wordList& fieldTypes + ) const; + + //- Combine points from all processors. Sort by curveDist and produce + // index list. Valid result only on master processor. + void combineSampledSets + ( + PtrList<coordSet>& masterSampledSets, + labelListList& indexSets + ); + + //- Combine values from all processors. + // Valid result only on master processor. + template<class T> + void combineSampledValues + ( + const PtrList<volFieldSampler<T> >& sampledFields, + const labelListList& indexSets, + PtrList<volFieldSampler<T> >& masterFields + ); + + template<class Type> + void writeSampleFile + ( + const coordSet& masterSampleSet, + const PtrList<volFieldSampler<Type> >& masterFields, + const label setI, + const fileName& timeDir, + const writer<Type>& formatter + ); + + template<class Type> + void sampleAndWrite(fieldGroup<Type>& fields); + + + //- Disallow default bitwise copy construct and assignment + sampledSets(const sampledSets&); + void operator=(const sampledSets&); + + +public: + + //- Runtime type information + TypeName("sets"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary + // allow the possibility to load fields from files + sampledSets + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + // Destructor + + virtual ~sampledSets(); + + + // Member Functions + + //- Return name of the set of probes + virtual const word& name() const + { + return name_; + } + + //- set verbosity level + void verbose(const bool verbosity = true); + + //- Sample and write + virtual void write(); + + //- Read the sampledSets + virtual void read(const dictionary&); + + //- Correct for mesh changes + void correct(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&); + + //- Update for mesh point-motion + virtual void movePoints(const pointField&); + + //- Update for changes of mesh due to readUpdate + virtual void readUpdate(const polyMesh::readUpdateState state); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "sampledSetsTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..41668609dc9f80d3e6cff17df228ca7510ce2537 --- /dev/null +++ b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C @@ -0,0 +1,353 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sampledSets.H" +#include "volFields.H" +#include "volPointInterpolation.H" +#include "ListListOps.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template <class Type> +Foam::sampledSets::volFieldSampler<Type>::volFieldSampler +( + const volPointInterpolation& pInterp, + const word& interpolationScheme, + const GeometricField<Type, fvPatchField, volMesh>& field, + const PtrList<sampledSet>& samplers +) +: + List<Field<Type> >(samplers.size()), + name_(field.name()) +{ + autoPtr<interpolation<Type> > interpolator + ( + interpolation<Type>::New(interpolationScheme, pInterp, field) + ); + + forAll(samplers, seti) + { + Field<Type>& values = this->operator[](seti); + const sampledSet& samples = samplers[seti]; + + values.setSize(samples.size()); + forAll(samples, samplei) + { + const point& samplePt = samples[samplei]; + label celli = samples.cells()[samplei]; + label facei = samples.faces()[samplei]; + + values[samplei] = interpolator().interpolate + ( + samplePt, + celli, + facei + ); + } + } +} + + +template <class Type> +Foam::sampledSets::volFieldSampler<Type>::volFieldSampler +( + const GeometricField<Type, fvPatchField, volMesh>& field, + const PtrList<sampledSet>& samplers +) +: + List<Field<Type> >(samplers.size()), + name_(field.name()) +{ + forAll(samplers, seti) + { + Field<Type>& values = this->operator[](seti); + const sampledSet& samples = samplers[seti]; + + values.setSize(samples.size()); + forAll(samples, samplei) + { + values[samplei] = field[samples.cells()[samplei]]; + } + } +} + + +template <class Type> +Foam::sampledSets::volFieldSampler<Type>::volFieldSampler +( + const List<Field<Type> >& values, + const word& name +) +: + List<Field<Type> >(values), + name_(name) +{} + + +template<class Type> +Foam::label Foam::sampledSets::grep +( + fieldGroup<Type>& fieldList, + const wordList& fieldTypes +) const +{ + fieldList.setSize(fieldNames_.size()); + label nFields = 0; + + forAll(fieldNames_, fieldi) + { + if + ( + fieldTypes[fieldi] + == GeometricField<Type, fvPatchField, volMesh>::typeName + ) + { + fieldList[nFields] = fieldNames_[fieldi]; + nFields++; + } + } + + fieldList.setSize(nFields); + + return nFields; +} + + +template<class Type> +void Foam::sampledSets::writeSampleFile +( + const coordSet& masterSampleSet, + const PtrList<volFieldSampler<Type> >& masterFields, + const label seti, + const fileName& timeDir, + const writer<Type>& formatter +) +{ + wordList valueSetNames(masterFields.size()); + List<const Field<Type>*> valueSets(masterFields.size()); + + forAll(masterFields, fieldi) + { + valueSetNames[fieldi] = masterFields[fieldi].name(); + valueSets[fieldi] = &masterFields[fieldi][seti]; + } + + fileName fName + ( + timeDir/formatter.getFileName(masterSampleSet, valueSetNames) + ); + + formatter.write + ( + masterSampleSet, + valueSetNames, + valueSets, + OFstream(fName)() + ); +} + + +template<class T> +void Foam::sampledSets::combineSampledValues +( + const PtrList<volFieldSampler<T> >& sampledFields, + const labelListList& indexSets, + PtrList<volFieldSampler<T> >& masterFields +) +{ + forAll(sampledFields, fieldi) + { + List<Field<T> > masterValues(indexSets.size()); + + forAll(indexSets, seti) + { + // Collect data from all processors + List<Field<T> > gatheredData(Pstream::nProcs()); + gatheredData[Pstream::myProcNo()] = sampledFields[fieldi][seti]; + Pstream::gatherList(gatheredData); + + if (Pstream::master()) + { + Field<T> allData + ( + ListListOps::combine<Field<T> > + ( + gatheredData, + Foam::accessOp<Field<T> >() + ) + ); + + masterValues[seti] = + IndirectList<T>(allData, indexSets[seti])(); + } + } + + masterFields.set + ( + fieldi, + new volFieldSampler<T> + ( + masterValues, + sampledFields[fieldi].name() + ) + ); + } +} + + +template<class Type> +void Foam::sampledSets::sampleAndWrite +( + fieldGroup<Type>& fields +) +{ + if (fields.size()) + { + bool interpolate = interpolationScheme_ != "cell"; + + if (interpolate && (!pMeshPtr_.valid() || !pInterpPtr_.valid())) + { + // set up interpolation + pMeshPtr_.reset(new pointMesh(mesh_)); + pInterpPtr_.reset(new volPointInterpolation(mesh_, pMeshPtr_())); + } + + // Create or use existing writer + if (!fields.formatter.valid()) + { + fields.formatter = writer<Type>::New(writeFormat_); + } + + // Storage for interpolated values + PtrList<volFieldSampler<Type> > sampledFields(fields.size()); + + forAll(fields, fieldi) + { + if (Pstream::master() && verbose_) + { + Pout<< "sampledSets::sampleAndWrite: " + << fields[fieldi] << endl; + } + + if (loadFromFiles_) + { + GeometricField<Type, fvPatchField, volMesh> vf + ( + IOobject + ( + fields[fieldi], + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ), + mesh_ + ); + + if (interpolate) + { + sampledFields.set + ( + fieldi, + new volFieldSampler<Type> + ( + pInterpPtr_(), + interpolationScheme_, + vf, + *this + ) + ); + } + else + { + sampledFields.set + ( + fieldi, + new volFieldSampler<Type>(vf, *this) + ); + } + } + else + { + if (interpolate) + { + sampledFields.set + ( + fieldi, + new volFieldSampler<Type> + ( + pInterpPtr_(), + interpolationScheme_, + mesh_.lookupObject + <GeometricField<Type, fvPatchField, volMesh> > + (fields[fieldi]), + *this + ) + ); + } + else + { + sampledFields.set + ( + fieldi, + new volFieldSampler<Type> + ( + mesh_.lookupObject + <GeometricField<Type, fvPatchField, volMesh> > + (fields[fieldi]), + *this + ) + ); + } + } + } + + // Combine sampled fields from processors. + // Note: only master results are valid + + PtrList<volFieldSampler<Type> > masterFields(sampledFields.size()); + combineSampledValues(sampledFields, indexSets_, masterFields); + + if (Pstream::master()) + { + forAll(masterSampledSets_, seti) + { + writeSampleFile + ( + masterSampledSets_[seti], + masterFields, + seti, + outputPath_/mesh_.time().timeName(), + fields.formatter() + ); + } + } + } +} + + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.C b/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C similarity index 91% rename from src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.C rename to src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C index 7c6a69d9231ae253c86aea52157fb4d39b0d1565..26f5df7d955fcc4ced938367effed62ba03b2707 100644 --- a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.C +++ b/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C @@ -24,18 +24,18 @@ License \*---------------------------------------------------------------------------*/ -#include "surfacesFunctionObject.H" +#include "sampledSetsFunctionObject.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineNamedTemplateTypeNameAndDebug(surfacesFunctionObject, 0); + defineNamedTemplateTypeNameAndDebug(sampledSetsFunctionObject, 0); addToRunTimeSelectionTable ( functionObject, - surfacesFunctionObject, + sampledSetsFunctionObject, dictionary ); } diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stlWriters.C b/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.H similarity index 76% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stlWriters.C rename to src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.H index 4bccc9da5c85e93d1b965add7b7bf24d4f3d686b..acfa7b584ef7f2321aca38183f8a8b417b07c1dc 100644 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/stl/stlWriters.C +++ b/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.H @@ -22,22 +22,34 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Typedef + Foam::sampledSetsFunctionObject + +Description + FunctionObject wrapper around sets to allow them to be created via the + functions list within controlDict. + +SourceFiles + sampledSetsFunctionObject.C + \*---------------------------------------------------------------------------*/ -#include "stlWriters.H" -#include "addToRunTimeSelectionTable.H" +#ifndef sampledSetsFunctionObject_H +#define sampledSetsFunctionObject_H + +#include "sampledSets.H" +#include "OutputFilterFunctionObject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeWriters(stl); + typedef OutputFilterFunctionObject<sampledSets> + sampledSetsFunctionObject; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +#endif // ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C similarity index 98% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/uniform/uniformSet.C rename to src/sampling/sampledSet/uniform/uniformSet.C index c50fe97adb087b9a6e7e86dfb13068c8bf804678..cb06b105fe56301f0096c23ef56905c9770d499b 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -40,7 +40,7 @@ License namespace Foam { defineTypeNameAndDebug(uniformSet, 0); - addToRunTimeSelectionTable(sampleSet, uniformSet, word); + addToRunTimeSelectionTable(sampledSet, uniformSet, word); } @@ -432,19 +432,18 @@ void Foam::uniformSet::genSamples() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::uniformSet::uniformSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end, const label nPoints ) : - sampleSet(mesh, searchEngine, name, axis), + sampledSet(name, mesh, searchEngine, axis), start_(start), end_(end), nPoints_(nPoints) @@ -458,15 +457,15 @@ Foam::uniformSet::uniformSet } -// Construct from dictionary Foam::uniformSet::uniformSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict ) : - sampleSet(mesh, searchEngine, dict), + sampledSet(name, mesh, searchEngine, dict), start_(dict.lookup("start")), end_(dict.lookup("end")), nPoints_(readLabel(dict.lookup("nPoints"))) diff --git a/applications/utilities/postProcessing/sampling/sample/sampleSets/uniform/uniformSet.H b/src/sampling/sampledSet/uniform/uniformSet.H similarity index 97% rename from applications/utilities/postProcessing/sampling/sample/sampleSets/uniform/uniformSet.H rename to src/sampling/sampledSet/uniform/uniformSet.H index 99dc0e815bf71b80a75ff5276c771c4deb1bca87..a19a7c73067ebdd6e193c02248f6ffa79f25ee65 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleSets/uniform/uniformSet.H +++ b/src/sampling/sampledSet/uniform/uniformSet.H @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ +/*---------------------------------------------------------------------------* \ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | @@ -35,7 +35,7 @@ SourceFiles #ifndef uniformSet_H #define uniformSet_H -#include "sampleSet.H" +#include "sampledSet.H" #include "DynamicList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,7 +53,7 @@ template<class Type> class Particle; class uniformSet : - public sampleSet + public sampledSet { // Private data @@ -109,6 +109,7 @@ class uniformSet //- Uses calcSamples to obtain samples. Copies them into *this. void genSamples(); + public: //- Runtime type information @@ -119,9 +120,9 @@ public: //- Construct from components uniformSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, - const word& name, const word& axis, const point& start, const point& end, @@ -131,6 +132,7 @@ public: //- Construct from dictionary uniformSet ( + const word& name, const polyMesh& mesh, meshSearch& searchEngine, const dictionary& dict diff --git a/applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplot.C b/src/sampling/sampledSet/writers/gnuplot/gnuplot.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplot.C rename to src/sampling/sampledSet/writers/gnuplot/gnuplot.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplot.H b/src/sampling/sampledSet/writers/gnuplot/gnuplot.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplot.H rename to src/sampling/sampledSet/writers/gnuplot/gnuplot.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplotWriters.C b/src/sampling/sampledSet/writers/gnuplot/gnuplotWriters.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplotWriters.C rename to src/sampling/sampledSet/writers/gnuplot/gnuplotWriters.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplotWriters.H b/src/sampling/sampledSet/writers/gnuplot/gnuplotWriters.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/gnuplot/gnuplotWriters.H rename to src/sampling/sampledSet/writers/gnuplot/gnuplotWriters.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/jplot/jplot.C b/src/sampling/sampledSet/writers/jplot/jplot.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/jplot/jplot.C rename to src/sampling/sampledSet/writers/jplot/jplot.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/jplot/jplot.H b/src/sampling/sampledSet/writers/jplot/jplot.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/jplot/jplot.H rename to src/sampling/sampledSet/writers/jplot/jplot.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/jplot/jplotWriters.C b/src/sampling/sampledSet/writers/jplot/jplotWriters.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/jplot/jplotWriters.C rename to src/sampling/sampledSet/writers/jplot/jplotWriters.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/jplot/jplotWriters.H b/src/sampling/sampledSet/writers/jplot/jplotWriters.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/jplot/jplotWriters.H rename to src/sampling/sampledSet/writers/jplot/jplotWriters.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/raw/raw.C b/src/sampling/sampledSet/writers/raw/raw.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/raw/raw.C rename to src/sampling/sampledSet/writers/raw/raw.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/raw/raw.H b/src/sampling/sampledSet/writers/raw/raw.H similarity index 98% rename from applications/utilities/postProcessing/sampling/sample/writers/raw/raw.H rename to src/sampling/sampledSet/writers/raw/raw.H index 63d1ff7317bc83b421eac9e2d8e5b225c830adbf..5a1f4e2bf3f7e9d40aeeb441f8842507f3d2c197 100644 --- a/applications/utilities/postProcessing/sampling/sample/writers/raw/raw.H +++ b/src/sampling/sampledSet/writers/raw/raw.H @@ -63,6 +63,7 @@ public: //- Construct null raw(); + // Destructor virtual ~raw(); @@ -78,7 +79,7 @@ public: const wordList& ) const; - void write + virtual void write ( const coordSet&, const wordList&, diff --git a/applications/utilities/postProcessing/sampling/sample/writers/raw/rawWriters.C b/src/sampling/sampledSet/writers/raw/rawWriters.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/raw/rawWriters.C rename to src/sampling/sampledSet/writers/raw/rawWriters.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/raw/rawWriters.H b/src/sampling/sampledSet/writers/raw/rawWriters.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/raw/rawWriters.H rename to src/sampling/sampledSet/writers/raw/rawWriters.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/writer/writer.C b/src/sampling/sampledSet/writers/writer/writer.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/writer/writer.C rename to src/sampling/sampledSet/writers/writer/writer.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/writer/writer.H b/src/sampling/sampledSet/writers/writer/writer.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/writer/writer.H rename to src/sampling/sampledSet/writers/writer/writer.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/writer/writers.C b/src/sampling/sampledSet/writers/writer/writers.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/writer/writers.C rename to src/sampling/sampledSet/writers/writer/writers.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/writer/writers.H b/src/sampling/sampledSet/writers/writer/writers.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/writer/writers.H rename to src/sampling/sampledSet/writers/writer/writers.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgr.C b/src/sampling/sampledSet/writers/xmgr/xmgr.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgr.C rename to src/sampling/sampledSet/writers/xmgr/xmgr.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgr.H b/src/sampling/sampledSet/writers/xmgr/xmgr.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgr.H rename to src/sampling/sampledSet/writers/xmgr/xmgr.H diff --git a/applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgrWriters.C b/src/sampling/sampledSet/writers/xmgr/xmgrWriters.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgrWriters.C rename to src/sampling/sampledSet/writers/xmgr/xmgrWriters.C diff --git a/applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgrWriters.H b/src/sampling/sampledSet/writers/xmgr/xmgrWriters.H similarity index 100% rename from applications/utilities/postProcessing/sampling/sample/writers/xmgr/xmgrWriters.H rename to src/sampling/sampledSet/writers/xmgr/xmgrWriters.H diff --git a/src/sampling/sampledSurface/patch/sampledPatch.C b/src/sampling/sampledSurface/patch/sampledPatch.C index 854675cecd846bcb0aab649f396d9d9cc4af4da0..4d37ff370afbc91210460e240f7b08a9ddbe80e5 100644 --- a/src/sampling/sampledSurface/patch/sampledPatch.C +++ b/src/sampling/sampledSurface/patch/sampledPatch.C @@ -41,7 +41,6 @@ namespace Foam addNamedToRunTimeSelectionTable(sampledSurface, sampledPatch, word, patch); } - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::sampledPatch::createGeometry() @@ -98,79 +97,11 @@ void Foam::sampledPatch::createGeometry() } } - Pout << *this << endl; -} - - -template <class Type> -Foam::tmp<Foam::Field<Type> > -Foam::sampledPatch::sampleField -( - const GeometricField<Type, fvPatchField, volMesh>& vField -) const -{ - // One value per face - tmp<Field<Type> > tvalues(new Field<Type>(patchFaceLabels_.size())); - Field<Type>& values = tvalues(); - - if (patchIndex() != -1) - { - const Field<Type>& bField = vField.boundaryField()[patchIndex()]; - - forAll(patchFaceLabels_, elemI) - { - values[elemI] = bField[patchFaceLabels_[elemI]]; - } - } - - return tvalues; -} - - -template <class Type> -Foam::tmp<Foam::Field<Type> > -Foam::sampledPatch::interpolateField -( - const interpolation<Type>& interpolator -) const -{ - // One value per vertex - tmp<Field<Type> > tvalues(new Field<Type>(points().size())); - Field<Type>& values = tvalues(); - - if (patchIndex() != -1) + if (debug) { - const polyPatch& patch = mesh().boundaryMesh()[patchIndex()]; - const labelList& own = mesh().faceOwner(); - - boolList pointDone(points().size(), false); - - forAll(faces(), cutFaceI) - { - const face& f = faces()[cutFaceI]; - - forAll(f, faceVertI) - { - label pointI = f[faceVertI]; - - if (!pointDone[pointI]) - { - label faceI = patchFaceLabels()[cutFaceI] + patch.start(); - label cellI = own[faceI]; - - values[pointI] = interpolator.interpolate - ( - points()[pointI], - cellI, - faceI - ); - pointDone[pointI] = true; - } - } - } + print(Pout); + Pout << endl; } - - return tvalues; } @@ -178,13 +109,13 @@ Foam::sampledPatch::interpolateField Foam::sampledPatch::sampledPatch ( - const polyMesh& mesh, const word& name, + const polyMesh& mesh, const word& patchName, const bool triangulate ) : - sampledSurface(mesh, name, triangulate), + sampledSurface(name, mesh, triangulate), patchName_(patchName), patchIndex_(mesh.boundaryMesh().findPatchID(patchName_)), points_(0), @@ -197,11 +128,12 @@ Foam::sampledPatch::sampledPatch Foam::sampledPatch::sampledPatch ( + const word& name, const polyMesh& mesh, const dictionary& dict ) : - sampledSurface(mesh, dict), + sampledSurface(name, mesh, dict), patchName_(dict.lookup("patchName")), patchIndex_(mesh.boundaryMesh().findPatchID(patchName_)), points_(0), @@ -229,10 +161,6 @@ void Foam::sampledPatch::correct(const bool meshChanged) } -// -// sample volume field -// - Foam::tmp<Foam::scalarField> Foam::sampledPatch::sample ( @@ -282,10 +210,6 @@ Foam::sampledPatch::sample } -// -// interpolate -// - Foam::tmp<Foam::scalarField> Foam::sampledPatch::interpolate ( @@ -343,6 +267,5 @@ void Foam::sampledPatch::print(Ostream& os) const << " points:" << points().size(); } -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/sampling/sampledSurface/patch/sampledPatch.H b/src/sampling/sampledSurface/patch/sampledPatch.H index 3c14fa2a01d77c5fe80ad5d8ca98f6f4e2cf8d9a..e338fb83087480d1a26389b303706ed97e71e55c 100644 --- a/src/sampling/sampledSurface/patch/sampledPatch.H +++ b/src/sampling/sampledSurface/patch/sampledPatch.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - sampledPatch + Foam::sampledPatch Description @@ -84,10 +84,11 @@ class sampledPatch tmp<Field<Type> > interpolateField(const interpolation<Type>&) const; + public: //- Runtime type information - TypeName("sampledPatch"); + TypeName("sampledPatch"); // Constructors @@ -95,8 +96,8 @@ public: //- Construct from components sampledPatch ( - const polyMesh& mesh, const word& name, + const polyMesh& mesh, const word& patchName, const bool triangulate = true ); @@ -104,6 +105,7 @@ public: //- Construct from dictionary sampledPatch ( + const word& name, const polyMesh& mesh, const dictionary& dict ); @@ -210,12 +212,8 @@ public: const interpolation<tensor>& ) const; - - // Write - //- Write virtual void print(Ostream&) const; - }; @@ -225,6 +223,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "sampledPatchTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/sampling/sampledSurface/patch/sampledPatchTemplates.C b/src/sampling/sampledSurface/patch/sampledPatchTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..e0697954884246cb686c0ce0a2233c4ee27881a5 --- /dev/null +++ b/src/sampling/sampledSurface/patch/sampledPatchTemplates.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sampledPatch.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template <class Type> +Foam::tmp<Foam::Field<Type> > +Foam::sampledPatch::sampleField +( + const GeometricField<Type, fvPatchField, volMesh>& vField +) const +{ + // One value per face + tmp<Field<Type> > tvalues(new Field<Type>(patchFaceLabels_.size())); + Field<Type>& values = tvalues(); + + if (patchIndex() != -1) + { + const Field<Type>& bField = vField.boundaryField()[patchIndex()]; + + forAll(patchFaceLabels_, elemI) + { + values[elemI] = bField[patchFaceLabels_[elemI]]; + } + } + + return tvalues; +} + + +template <class Type> +Foam::tmp<Foam::Field<Type> > +Foam::sampledPatch::interpolateField +( + const interpolation<Type>& interpolator +) const +{ + // One value per vertex + tmp<Field<Type> > tvalues(new Field<Type>(points().size())); + Field<Type>& values = tvalues(); + + if (patchIndex() != -1) + { + const polyPatch& patch = mesh().boundaryMesh()[patchIndex()]; + const labelList& own = mesh().faceOwner(); + + boolList pointDone(points().size(), false); + + forAll(faces(), cutFaceI) + { + const face& f = faces()[cutFaceI]; + + forAll(f, faceVertI) + { + label pointI = f[faceVertI]; + + if (!pointDone[pointI]) + { + label faceI = patchFaceLabels()[cutFaceI] + patch.start(); + label cellI = own[faceI]; + + values[pointI] = interpolator.interpolate + ( + points()[pointI], + cellI, + faceI + ); + pointDone[pointI] = true; + } + } + } + } + + return tvalues; +} + + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/plane/sampledPlane.C b/src/sampling/sampledSurface/plane/sampledPlane.C index 00a77cd01e45e91bb3f57425a1b98cd745cf5bd1..fc68199dc313cd18583905779e8f094b3e314f9b 100644 --- a/src/sampling/sampledSurface/plane/sampledPlane.C +++ b/src/sampling/sampledSurface/plane/sampledPlane.C @@ -39,7 +39,6 @@ namespace Foam addNamedToRunTimeSelectionTable(sampledSurface, sampledPlane, word, plane); } - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::sampledPlane::createGeometry() @@ -79,56 +78,11 @@ void Foam::sampledPlane::createGeometry() } } - print(Pout); - Pout << endl; -} - - -template <class Type> -Foam::tmp<Foam::Field<Type> > -Foam::sampledPlane::sampleField -( - const GeometricField<Type, fvPatchField, volMesh>& vField -) const -{ - return tmp<Field<Type> >(new Field<Type>(vField, meshCells())); -} - - -template <class Type> -Foam::tmp<Foam::Field<Type> > -Foam::sampledPlane::interpolateField -( - const interpolation<Type>& interpolator -) const -{ - // One value per point - tmp<Field<Type> > tvalues(new Field<Type>(points().size())); - Field<Type>& values = tvalues(); - - boolList pointDone(points().size(), false); - - forAll(faces(), cutFaceI) + if (debug) { - const face& f = faces()[cutFaceI]; - - forAll(f, faceVertI) - { - label pointI = f[faceVertI]; - - if (!pointDone[pointI]) - { - values[pointI] = interpolator.interpolate - ( - points()[pointI], - meshCells()[cutFaceI] - ); - pointDone[pointI] = true; - } - } + print(Pout); + Pout << endl; } - - return tvalues; } @@ -136,14 +90,14 @@ Foam::sampledPlane::interpolateField Foam::sampledPlane::sampledPlane ( - const polyMesh& mesh, const word& name, + const polyMesh& mesh, const plane& planeDesc, const word& zoneName, const bool triangulate ) : - sampledSurface(mesh, name, triangulate), + sampledSurface(name, mesh, triangulate), cuttingPlane(planeDesc), zoneName_(zoneName), faces_(0), @@ -153,7 +107,7 @@ Foam::sampledPlane::sampledPlane if (zoneName_.size()) { zoneId = mesh.cellZones().findZoneID(zoneName_); - if (zoneId < 0) + if (debug && zoneId < 0) { Info<< "cellZone \"" << zoneName_ << "\" not found - using entire mesh" @@ -161,7 +115,6 @@ Foam::sampledPlane::sampledPlane } } - if (zoneId < 0) { reCut(mesh); @@ -171,18 +124,18 @@ Foam::sampledPlane::sampledPlane reCut(mesh, mesh.cellZones()[zoneId]); } - createGeometry(); } Foam::sampledPlane::sampledPlane ( + const word& name, const polyMesh& mesh, const dictionary& dict ) : - sampledSurface(mesh, dict), + sampledSurface(name, mesh, dict), cuttingPlane(plane(dict.lookup("basePoint"), dict.lookup("normalVector"))), zoneName_(word::null), faces_(0), @@ -207,7 +160,7 @@ Foam::sampledPlane::sampledPlane { dict.lookup("zone") >> zoneName_; zoneId = mesh.cellZones().findZoneID(zoneName_); - if (zoneId < 0) + if (debug && zoneId < 0) { Info<< "cellZone \"" << zoneName_ << "\" not found - using entire mesh" @@ -262,10 +215,6 @@ void Foam::sampledPlane::correct(const bool meshChanged) } -// -// sample volume field -// - Foam::tmp<Foam::scalarField> Foam::sampledPlane::sample ( @@ -315,10 +264,6 @@ Foam::sampledPlane::sample } -// -// interpolate -// - Foam::tmp<Foam::scalarField> Foam::sampledPlane::interpolate ( @@ -377,4 +322,5 @@ void Foam::sampledPlane::print(Ostream& os) const << " points:" << points().size(); } + // ************************************************************************* // diff --git a/src/sampling/sampledSurface/plane/sampledPlane.H b/src/sampling/sampledSurface/plane/sampledPlane.H index d5006e32a59cf98e781d23c190a59fe438f623d0..14e261cff9bf1f036adc8764837ef4b0ea7a0b20 100644 --- a/src/sampling/sampledSurface/plane/sampledPlane.H +++ b/src/sampling/sampledSurface/plane/sampledPlane.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - sampledPlane + Foam::sampledPlane Description @@ -80,10 +80,11 @@ class sampledPlane tmp<Field<Type> > interpolateField(const interpolation<Type>&) const; + public: //- Runtime type information - TypeName("sampledPlane"); + TypeName("sampledPlane"); // Constructors @@ -91,8 +92,8 @@ public: //- Construct from components sampledPlane ( - const polyMesh& mesh, const word& name, + const polyMesh& mesh, const plane& planeDesc, const word& zoneName = word::null, const bool triangulate = true @@ -101,6 +102,7 @@ public: //- Construct from dictionary sampledPlane ( + const word& name, const polyMesh& mesh, const dictionary& dict ); @@ -213,12 +215,8 @@ public: const interpolation<tensor>& ) const; - - // Write - //- Write virtual void print(Ostream&) const; - }; @@ -228,6 +226,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "sampledPlaneTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sample/combineSampleValues.H b/src/sampling/sampledSurface/plane/sampledPlaneTemplates.C similarity index 54% rename from applications/utilities/postProcessing/sampling/sample/combineSampleValues.H rename to src/sampling/sampledSurface/plane/sampledPlaneTemplates.C index 2d21264f928f47835bfa21e52e3b003e692242a4..bb094cebe1aad134817ad5893bf55fdb0c2c6f87 100644 --- a/applications/utilities/postProcessing/sampling/sample/combineSampleValues.H +++ b/src/sampling/sampledSurface/plane/sampledPlaneTemplates.C @@ -22,44 +22,58 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - Foam::combineSampleValues - -Description - Various utility functions for collection of samples on processors. - -SourceFiles - combineSampleValues.C - \*---------------------------------------------------------------------------*/ -#ifndef combineSampleValues_H -#define combineSampleValues_H - -#include "labelList.H" -#include "PtrList.H" -#include "volFieldSampler.H" +#include "sampledPlane.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Combine values from all processors. Valid result only on master processor. -template<class T> -void combineSampleValues +template <class Type> +Foam::tmp<Foam::Field<Type> > +Foam::sampledPlane::sampleField ( - const Foam::PtrList<Foam::volFieldSampler<T> >& sampledFields, - const Foam::labelListList& indexSets, - Foam::PtrList<Foam::volFieldSampler<T> >& masterFields -); + const GeometricField<Type, fvPatchField, volMesh>& vField +) const +{ + return tmp<Field<Type> >(new Field<Type>(vField, meshCells())); +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "combineSampleValues.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template <class Type> +Foam::tmp<Foam::Field<Type> > +Foam::sampledPlane::interpolateField +( + const interpolation<Type>& interpolator +) const +{ + // One value per point + tmp<Field<Type> > tvalues(new Field<Type>(points().size())); + Field<Type>& values = tvalues(); + + boolList pointDone(points().size(), false); + + forAll(faces(), cutFaceI) + { + const face& f = faces()[cutFaceI]; + + forAll(f, faceVertI) + { + label pointI = f[faceVertI]; + + if (!pointDone[pointI]) + { + values[pointI] = interpolator.interpolate + ( + points()[pointI], + meshCells()[cutFaceI] + ); + pointDone[pointI] = true; + } + } + } + + return tvalues; +} -#endif // ************************************************************************* // diff --git a/src/sampling/sampledSurface/surface/sampledSurface.C b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C similarity index 96% rename from src/sampling/sampledSurface/surface/sampledSurface.C rename to src/sampling/sampledSurface/sampledSurface/sampledSurface.C index d817651a55c337249cd929de7fd1d120577b6739..f05774d5a8cc72cb78c24bffcd3ba789cef54b32 100644 --- a/src/sampling/sampledSurface/surface/sampledSurface.C +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "sampledSurface.H" @@ -39,7 +37,9 @@ namespace Foam defineRunTimeSelectionTable(sampledSurface, word); } + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + void Foam::sampledSurface::clearGeom() const { deleteDemandDrivenData(SfPtr_); @@ -117,18 +117,23 @@ void Foam::sampledSurface::makeCf() const // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // - Foam::autoPtr<Foam::sampledSurface> Foam::sampledSurface::New ( - const word& sampleType, + const word& name, const polyMesh& mesh, const dictionary& dict ) { + word sampleType(dict.lookup("type")); + + if (debug) + { + Info<< "Selecting sampled type " << sampleType << endl; + } + wordConstructorTable::iterator cstrIter = - wordConstructorTablePtr_ - ->find(sampleType); + wordConstructorTablePtr_->find(sampleType); if (cstrIter == wordConstructorTablePtr_->end()) { @@ -145,11 +150,7 @@ Foam::sampledSurface::New return autoPtr<sampledSurface> ( - cstrIter() - ( - mesh, - dict - ) + cstrIter()(name, mesh, dict) ); } @@ -174,16 +175,15 @@ bool Foam::sampledSurface::getBool // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from mesh, name Foam::sampledSurface::sampledSurface ( - const polyMesh& mesh, const word& name, + const polyMesh& mesh, const bool triangulate ) : - mesh_(mesh), name_(name), + mesh_(mesh), triangulate_(triangulate), interpolate_(false), SfPtr_(NULL), @@ -192,15 +192,15 @@ Foam::sampledSurface::sampledSurface {} -// Construct from dictionary Foam::sampledSurface::sampledSurface ( + const word& name, const polyMesh& mesh, const dictionary& dict ) : + name_(name), mesh_(mesh), - name_(type()), triangulate_(getBool(dict, "triangulate", true)), interpolate_(getBool(dict, "interpolate", false)), SfPtr_(NULL), @@ -221,6 +221,7 @@ Foam::sampledSurface::~sampledSurface() clearGeom(); } + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // const Foam::vectorField& Foam::sampledSurface::Sf() const @@ -310,6 +311,7 @@ void Foam::sampledSurface::print(Ostream& os) const os << type(); } + // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<<(Ostream &os, const sampledSurface& s) @@ -319,4 +321,5 @@ Foam::Ostream& Foam::operator<<(Ostream &os, const sampledSurface& s) return os; } + // ************************************************************************* // diff --git a/src/sampling/sampledSurface/surface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H similarity index 87% rename from src/sampling/sampledSurface/surface/sampledSurface.H rename to src/sampling/sampledSurface/sampledSurface/sampledSurface.H index a65aa12a6eec877d8e0c6ea424c4cf32cc0499c5..f31ab2aee18ff223f558efccdc8b763bd00a460f 100644 --- a/src/sampling/sampledSurface/surface/sampledSurface.H +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - sampledSurface + Foam::sampledSurface Description @@ -60,12 +60,12 @@ class sampledSurface { // Private data - //- Reference to mesh - const polyMesh& mesh_; - //- Name of sample surface word name_; + //- Reference to mesh + const polyMesh& mesh_; + //- Make triangles or keep faces const bool triangulate_; @@ -92,6 +92,7 @@ class sampledSurface template<class Type> void checkFieldSize(const Field<Type>& field) const; + // Make geometric data void makeSf() const; @@ -121,16 +122,18 @@ class sampledSurface template<class ReturnType, class Type> tmp<Field<ReturnType> > project(const tmp<Field<Type> >&) const; + protected: // Protected static functions virtual void clearGeom() const; + public: //- Runtime type information - TypeName("sampledSurface"); + TypeName("sampledSurface"); // Declare run-time constructor selection table @@ -141,10 +144,11 @@ public: sampledSurface, word, ( + const word& name, const polyMesh& mesh, const dictionary& dict ), - (mesh, dict) + (name, mesh, dict) ); @@ -177,11 +181,11 @@ public: autoPtr<sampledSurface> operator()(Istream& is) const { - word sampleType(is); + word name(is); dictionary dict(is); rewriteDict(dict, true); - return sampledSurface::New(sampleType, mesh_, dict); + return sampledSurface::New(name, mesh_, dict); } }; @@ -191,14 +195,15 @@ public: //- Construct from mesh, name sampledSurface ( - const polyMesh& mesh, const word& name, + const polyMesh& mesh, const bool triangulate = true ); //- Construct from dictionary sampledSurface ( + const word& name, const polyMesh& mesh, const dictionary& dict ); @@ -249,7 +254,7 @@ public: return interpolate_; } - //- triangulation requested for surface + //- Triangulation requested for surface bool triangulate() const { return triangulate_; @@ -273,61 +278,62 @@ public: //- Return face centres as vectorField virtual const vectorField& Cf() const; - //- integration of a field across the surface + //- Integration of a field across the surface template<class Type> Type integrate(const Field<Type>&) const; - //- integration of a field across the surface + //- Integration of a field across the surface template<class Type> Type integrate(const tmp<Field<Type> >&) const; - //- area-averaged value of a field across the surface + //- Area-averaged value of a field across the surface template<class Type> Type average(const Field<Type>&) const; - //- area-averaged value of a field across the surface + //- Area-averaged value of a field across the surface template<class Type> Type average(const tmp<Field<Type> >&) const; - //- project field onto surface - tmp<Field<scalar> > project(const Field<scalar>&) const; - tmp<Field<scalar> > project(const Field<vector>&) const; - tmp<Field<vector> > project(const Field<sphericalTensor>&) const; - tmp<Field<vector> > project(const Field<symmTensor>&) const; - tmp<Field<vector> > project(const Field<tensor>&) const; + // Project field onto surface + + tmp<Field<scalar> > project(const Field<scalar>&) const; + tmp<Field<scalar> > project(const Field<vector>&) const; + tmp<Field<vector> > project(const Field<sphericalTensor>&) const; + tmp<Field<vector> > project(const Field<symmTensor>&) const; + tmp<Field<vector> > project(const Field<tensor>&) const; - //- sample field on surface + //- Sample field on surface virtual tmp<scalarField> sample ( const volScalarField& ) const = 0; - //- sample field on surface + //- Sample field on surface virtual tmp<vectorField> sample ( const volVectorField& ) const = 0; - //- sample field on surface + //- Sample field on surface virtual tmp<sphericalTensorField> sample ( const volSphericalTensorField& ) const = 0; - //- sample field on surface + //- Sample field on surface virtual tmp<symmTensorField> sample ( const volSymmTensorField& ) const = 0; - //- sample field on surface + //- Sample field on surface virtual tmp<tensorField> sample ( const volTensorField& ) const = 0; - //- interpolate field on surface + //- Interpolate field on surface virtual tmp<scalarField> interpolate ( const interpolation<scalar>& @@ -340,42 +346,37 @@ public: const interpolation<vector>& ) const = 0; - //- interpolate field on surface + //- Interpolate field on surface virtual tmp<sphericalTensorField> interpolate ( const interpolation<sphericalTensor>& ) const = 0; - //- interpolate field on surface + //- Interpolate field on surface virtual tmp<symmTensorField> interpolate ( const interpolation<symmTensor>& ) const = 0; - //- interpolate field on surface + //- Interpolate field on surface virtual tmp<tensorField> interpolate ( const interpolation<tensor>& ) const = 0; - - // Edit - //- Rename virtual void rename(const word& newName) { name_ = newName; } - // Write - //- Write virtual void print(Ostream&) const; - // IOstream operators - friend Ostream& operator<<(Ostream&, const sampledSurface&); + // IOstream operators + friend Ostream& operator<<(Ostream&, const sampledSurface&); }; diff --git a/src/sampling/sampledSurface/surface/sampledSurfaceTemplates.C b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C similarity index 100% rename from src/sampling/sampledSurface/surface/sampledSurfaceTemplates.C rename to src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C diff --git a/src/sampling/sampledSurface/surfaces/IOsampledSurfaces.C.save b/src/sampling/sampledSurface/sampledSurfaces/IOsampledSurfaces.C.save similarity index 100% rename from src/sampling/sampledSurface/surfaces/IOsampledSurfaces.C.save rename to src/sampling/sampledSurface/sampledSurfaces/IOsampledSurfaces.C.save diff --git a/src/sampling/sampledSurface/surfaces/IOsampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/IOsampledSurfaces.H similarity index 100% rename from src/sampling/sampledSurface/surfaces/IOsampledSurfaces.H rename to src/sampling/sampledSurface/sampledSurfaces/IOsampledSurfaces.H diff --git a/src/sampling/sampledSurface/surfaces/IOsampledSurfaces.H.save b/src/sampling/sampledSurface/sampledSurfaces/IOsampledSurfaces.H.save similarity index 100% rename from src/sampling/sampledSurface/surfaces/IOsampledSurfaces.H.save rename to src/sampling/sampledSurface/sampledSurfaces/IOsampledSurfaces.H.save diff --git a/src/sampling/sampledSurface/surfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C similarity index 91% rename from src/sampling/sampledSurface/surfaces/sampledSurfaces.C rename to src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 8d456d2c48d09f602cd303a3e257041cb01c1e4d..f469a7fd5d96abcb123c8895961fdac3c12bf169 100644 --- a/src/sampling/sampledSurface/surfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -79,8 +79,8 @@ bool Foam::sampledSurfaces::checkFieldTypes() IOobject io ( fieldNames_[fieldI], - obr_.time().timeName(), - refCast<const polyMesh>(obr_), + mesh_.time().timeName(), + mesh_, IOobject::MUST_READ, IOobject::NO_WRITE, false @@ -102,9 +102,9 @@ bool Foam::sampledSurfaces::checkFieldTypes() forAll(fieldNames_, fieldI) { objectRegistry::const_iterator iter = - obr_.find(fieldNames_[fieldI]); + mesh_.find(fieldNames_[fieldI]); - if (iter != obr_.end()) + if (iter != mesh_.objectRegistry::end()) { fieldTypes[fieldI] = iter()->type(); } @@ -129,7 +129,7 @@ bool Foam::sampledSurfaces::checkFieldTypes() { if (debug) { - Pout<< "timeName = " << obr_.time().timeName() << nl + Pout<< "timeName = " << mesh_.time().timeName() << nl << "scalarFields " << scalarFields_ << nl << "vectorFields " << vectorFields_ << nl << "sphTensorFields " << sphericalTensorFields_ << nl @@ -139,10 +139,14 @@ bool Foam::sampledSurfaces::checkFieldTypes() if (nFields > 0) { - Pout<< "Creating directory " << outputPath_/obr_.time().timeName() - << nl << endl; + if (debug) + { + Pout<< "Creating directory " + << outputPath_/mesh_.time().timeName() + << nl << endl; + } - mkDir(outputPath_/obr_.time().timeName()); + mkDir(outputPath_/mesh_.time().timeName()); } } @@ -160,9 +164,7 @@ void Foam::sampledSurfaces::mergeSurfaces() // Merge close points (1E-10 of mesh bounding box) const scalar mergeTol = 1e-10; - const polyMesh& mesh = refCast<const polyMesh>(obr_); - const boundBox& bb = mesh.globalData().bb(); - + const boundBox& bb = mesh_.globalData().bb(); scalar mergeDim = mergeTol * mag(bb.max() - bb.min()); if (Pstream::master() && debug) @@ -265,8 +267,8 @@ Foam::sampledSurfaces::sampledSurfaces : PtrList<sampledSurface>(), name_(name), - obr_(obr), - loadFromFiles_(loadFromFiles_), + mesh_(refCast<const fvMesh>(obr)), + loadFromFiles_(loadFromFiles), outputPath_(fileName::null), pMeshPtr_(NULL), pInterpPtr_(NULL), @@ -282,11 +284,11 @@ Foam::sampledSurfaces::sampledSurfaces { if (Pstream::parRun()) { - outputPath_ = obr_.time().path()/".."/name_; + outputPath_ = mesh_.time().path()/".."/name_; } else { - outputPath_ = obr_.time().path()/name_; + outputPath_ = mesh_.time().path()/name_; } read(dict); @@ -340,7 +342,7 @@ void Foam::sampledSurfaces::read(const dictionary& dict) PtrList<sampledSurface> newList ( dict.lookup("surfaces"), - sampledSurface::iNew(refCast<const polyMesh>(obr_)) + sampledSurface::iNew(mesh_) ); transfer(newList); @@ -387,4 +389,13 @@ void Foam::sampledSurfaces::movePoints(const pointField&) } +void Foam::sampledSurfaces::readUpdate(const polyMesh::readUpdateState state) +{ + if (state != polyMesh::UNCHANGED) + { + correct(); + } +} + + // ************************************************************************* // diff --git a/src/sampling/sampledSurface/surfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H similarity index 90% rename from src/sampling/sampledSurface/surfaces/sampledSurfaces.H rename to src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 38008543cad7e2871b2178560be67cf569828cb1..5ca3b85b5f25f6d820fe2d79a53498897b49790f 100644 --- a/src/sampling/sampledSurface/surfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - sampledSurfaces + Foam::sampledSurfaces Description Set of surfaces to sample. @@ -39,7 +39,7 @@ SourceFiles #include "sampledSurface.H" #include "surfaceWriter.H" -#include "volFields.H" +#include "volFieldsFwd.H" #include "volPointInterpolation.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +47,7 @@ SourceFiles namespace Foam { -class objectRegistry; +class fvMesh; class dictionary; /*---------------------------------------------------------------------------*\ @@ -67,7 +67,8 @@ class sampledSurfaces public wordList { public: - //- surface formatter + + //- Surface formatter autoPtr<surfaceWriter<Type> > formatter; //- Construct null @@ -105,9 +106,9 @@ class sampledSurfaces { wordList::operator=(fieldNames); } - }; + //- Class used for surface merging information class mergeInfo { @@ -120,8 +121,8 @@ class sampledSurfaces // Static data members - //- output verbosity - static bool verbose_; + //- output verbosity + static bool verbose_; // Private data @@ -130,8 +131,8 @@ class sampledSurfaces // Also used as the name of the sampledSurfaces directory. word name_; - //- Const reference to objectRegistry - const objectRegistry& obr_; + //- Const reference to fvMesh + const fvMesh& mesh_; //- Load fields from files (not from objectRegistry) bool loadFromFiles_; @@ -160,7 +161,7 @@ class sampledSurfaces // surfaces - //- information for merging surfaces + //- Information for merging surfaces List<mergeInfo> mergeList_; @@ -176,15 +177,12 @@ class sampledSurfaces // Private Member Functions - //- classify field types, return true if nFields > 0 + //- Classify field types, return true if nFields > 0 bool checkFieldTypes(); - //- merge points on surfaces + //- Merge points on surfaces void mergeSurfaces(); - //- Correct for mesh changes - void correct(); - //- Find the fields in the list of the given type, return count template<class Type> label grep @@ -193,7 +191,7 @@ class sampledSurfaces const wordList& fieldTypes ) const; - //- set interpolator for the field + //- Set interpolator for the field template<class Type> autoPtr<interpolation<Type> > setInterpolator ( @@ -243,7 +241,13 @@ public: // Member Functions - //- set verbosity level + //- Return name of the set of probes + virtual const word& name() const + { + return name_; + } + + //- set verbosity level void verbose(const bool verbosity = true); //- Sample and write @@ -252,11 +256,17 @@ public: //- Read the sampledSurfaces virtual void read(const dictionary&); + //- Correct for mesh changes + void correct(); + //- Update for changes of mesh virtual void updateMesh(const mapPolyMesh&); //- Update for mesh point-motion virtual void movePoints(const pointField&); + + //- Update for changes of mesh due to readUpdate + virtual void readUpdate(const polyMesh::readUpdateState state); }; diff --git a/src/sampling/sampledSurface/surfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C similarity index 88% rename from src/sampling/sampledSurface/surfaces/sampledSurfacesTemplates.C rename to src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index a0360e41ca4d9bbf93dec07658485faedc195ee4..214c9bc93ae8961a09728ada98358b7e50bfb702 100644 --- a/src/sampling/sampledSurface/surfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -28,8 +28,6 @@ License #include "volFields.H" #include "ListListOps.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class Type> @@ -70,11 +68,9 @@ Foam::sampledSurfaces::setInterpolator { if (!pMeshPtr_.valid() || !pInterpPtr_.valid()) { - const fvMesh& mesh = refCast<const fvMesh>(obr_); - // set up interpolation - pMeshPtr_.reset(new pointMesh(mesh)); - pInterpPtr_.reset(new volPointInterpolation(mesh, pMeshPtr_())); + pMeshPtr_.reset(new pointMesh(mesh_)); + pInterpPtr_.reset(new volPointInterpolation(mesh_, pMeshPtr_())); } // interpolator for this field @@ -207,13 +203,13 @@ void Foam::sampledSurfaces::sampleAndWrite IOobject ( fields[fieldI], - obr_.time().timeName(), - refCast<const polyMesh>(obr_), + mesh_.time().timeName(), + mesh_, IOobject::MUST_READ, IOobject::NO_WRITE, false ), - refCast<const fvMesh>(obr_) + mesh_ ), fields.formatter() ); @@ -221,17 +217,19 @@ void Foam::sampledSurfaces::sampleAndWrite else { objectRegistry::const_iterator iter = - obr_.find(fields[fieldI]); + mesh_.find(fields[fieldI]); if ( - iter != obr_.end() - && iter()->type() == GeometricField<Type, fvPatchField, volMesh>::typeName + iter != mesh_.objectRegistry::end() + && iter()->type() + == GeometricField<Type, fvPatchField, volMesh>::typeName ) { sampleAndWrite ( - obr_.lookupObject<GeometricField<Type, fvPatchField, volMesh> > + mesh_.lookupObject + <GeometricField<Type, fvPatchField, volMesh> > ( fields[fieldI] ), @@ -239,14 +237,9 @@ void Foam::sampledSurfaces::sampleAndWrite ); } } - } } } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/sampling/surfaceWriters/dx/dxWriters.C b/src/sampling/sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.C similarity index 83% rename from src/sampling/surfaceWriters/dx/dxWriters.C rename to src/sampling/sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.C index f0bd7ea7e0026361b4420b74385a8cbd9b80ee07..6aa644dd63a69c24ae87673c7bf3bf58c8be4bb0 100644 --- a/src/sampling/surfaceWriters/dx/dxWriters.C +++ b/src/sampling/sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.C @@ -24,20 +24,20 @@ License \*---------------------------------------------------------------------------*/ -#include "dxWriters.H" -#include "addToRunTimeSelectionTable.H" +#include "sampledSurfacesFunctionObject.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeWriters(dx); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + defineNamedTemplateTypeNameAndDebug(sampledSurfacesFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + sampledSurfacesFunctionObject, + dictionary + ); +} // ************************************************************************* // diff --git a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.H b/src/sampling/sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.H similarity index 87% rename from src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.H rename to src/sampling/sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.H index c5a0ff12bdf6b8b01527af0d449f9f61d4abb596..329111071b7bd45651fc08c621f3deaf1761e035 100644 --- a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.H +++ b/src/sampling/sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.H @@ -23,19 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Typedef - surfacesFunctionObject + Foam::sampledSurfacesFunctionObject Description FunctionObject wrapper around surfaces to allow them to be created via the functions list within controlDict. SourceFiles - surfacesFunctionObject.C + sampledSurfacesFunctionObject.C \*---------------------------------------------------------------------------*/ -#ifndef surfacesFunctionObject_H -#define surfacesFunctionObject_H +#ifndef sampledSurfacesFunctionObject_H +#define sampledSurfacesFunctionObject_H #include "sampledSurfaces.H" #include "OutputFilterFunctionObject.H" @@ -44,7 +44,8 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<sampledSurfaces> surfacesFunctionObject; + typedef OutputFilterFunctionObject<sampledSurfaces> + sampledSurfacesFunctionObject; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.C.save b/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.C.save deleted file mode 100644 index 7280175ea63b413dea4dd3cb4372e27caa9deb68..0000000000000000000000000000000000000000 --- a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.C.save +++ /dev/null @@ -1,164 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*----------------------------------------------------------------------------*/ - -#include "surfacesFunctionObject.H" -#include "addToRunTimeSelectionTable.H" -#include "IOsampledSurfaces.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(surfacesFunctionObject, 0); - - addToRunTimeSelectionTable - ( - functionObject, - surfacesFunctionObject, - dictionary - ); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::surfacesFunctionObject::extractDict() -{ - if (dict_.found("region")) - { - dict_.lookup("region") >> regionName_; - } - - if (dict_.found("dictionary")) - { - dict_.lookup("dictionary") >> dictName_; - } - - if (dict_.found("interval")) - { - dict_.lookup("interval") >> interval_; - } - - if (dict_.found("enabled")) - { - dict_.lookup("enabled") >> execution_; - } -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::surfacesFunctionObject::surfacesFunctionObject -( - const Time& t, - const dictionary& dict -) -: - functionObject(), - time_(t), - dict_(dict), - regionName_(polyMesh::defaultRegion), - dictName_(), - interval_(0), - execution_(true) -{ - extractDict(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -// any possible side-effects? -bool Foam::surfacesFunctionObject::start() -{ - extractDict(); - - if (execution_) - { - if (dictName_.size()) - { - ptr_.reset - ( - new IOsampledSurfaces - ( - time_.lookupObject<objectRegistry>(regionName_), - dictName_ - ) - ); - } - else - { - ptr_.reset - ( - new sampledSurfaces - ( - time_.lookupObject<objectRegistry>(regionName_), - dict_ - ) - ); - } - } - - return true; -} - - -bool Foam::surfacesFunctionObject::execute() -{ - if (execution_ && (interval_ <= 1 || !(time_.timeIndex() % interval_)) ) - { - ptr_->write(); - } - - return true; -} - - -void Foam::surfacesFunctionObject::on() -{ - execution_ = true; -} - - -void Foam::surfacesFunctionObject::off() -{ - execution_ = false; -} - - -bool Foam::surfacesFunctionObject::read(const dictionary& dict) -{ - if (dict_ != dict) - { - dict_ = dict; - return start(); - } - else - { - return false; - } -} - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.H.save b/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.H.save deleted file mode 100644 index 2520cc94f8c3c125628528b1b3ca7d6fbf233cfb..0000000000000000000000000000000000000000 --- a/src/sampling/sampledSurface/surfacesFunctionObject/surfacesFunctionObject.H.save +++ /dev/null @@ -1,127 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - surfacesFunctionObject - -Description - FunctionObject wrapper around surfaces to allow them to be created via the - functions list within controlDict. - -SourceFiles - surfacesFunctionObject.C - -\*---------------------------------------------------------------------------*/ - -#ifndef surfacesFunctionObject_H -#define surfacesFunctionObject_H - -#include "functionObject.H" -#include "dictionary.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class sampledSurfaces; - -/*---------------------------------------------------------------------------*\ - Class surfacesFunctionObject Declaration -\*---------------------------------------------------------------------------*/ - -class surfacesFunctionObject -: - public functionObject -{ - // Private data - - const Time& time_; - dictionary dict_; - word regionName_; - word dictName_; - - //- the execution interval (in time steps) - // a value <= 1 means execute at every time step - label interval_; - - //- Switch for the execution of the functionObjects - bool execution_; - - autoPtr<sampledSurfaces> ptr_; - - // Private Member Functions - - //- extract relevant dictionary entries - void extractDict(); - - //- Disallow default bitwise copy construct - surfacesFunctionObject(const surfacesFunctionObject&); - - //- Disallow default bitwise assignment - void operator=(const surfacesFunctionObject&); - -public: - - //- Runtime type information - TypeName("surfaces"); - - // Constructors - - //- Construct from components - surfacesFunctionObject - ( - const Time&, - const dictionary& - ); - - - // Member Functions - - //- start is called at the start of the time-loop - virtual bool start(); - - //- execute is called at each ++ or += of the time-loop - virtual bool execute(); - - //- Switch the function object on - virtual void on(); - - //- Switch the function object off - virtual void off(); - - //- Read and set the function object if its data has changed - virtual bool read(const dictionary& dict); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/sampling/surfaceWriters/dx/dx.C b/src/sampling/sampledSurface/writers/dx/dx.C similarity index 100% rename from src/sampling/surfaceWriters/dx/dx.C rename to src/sampling/sampledSurface/writers/dx/dx.C diff --git a/src/sampling/surfaceWriters/dx/dx.H b/src/sampling/sampledSurface/writers/dx/dx.H similarity index 99% rename from src/sampling/surfaceWriters/dx/dx.H rename to src/sampling/sampledSurface/writers/dx/dx.H index 4e5354b2f68865c326f7789a86b4824297ddcb7a..618dee8795696db6f27db4bf669b6db387fb726a 100644 --- a/src/sampling/surfaceWriters/dx/dx.H +++ b/src/sampling/sampledSurface/writers/dx/dx.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - dx + Foam::dx Description diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dxWriters.C b/src/sampling/sampledSurface/writers/dx/dxWriters.C similarity index 98% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dxWriters.C rename to src/sampling/sampledSurface/writers/dx/dxWriters.C index f0bd7ea7e0026361b4420b74385a8cbd9b80ee07..70da54bac8576254303737901a8dcd7a458604e1 100644 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/dx/dxWriters.C +++ b/src/sampling/sampledSurface/writers/dx/dxWriters.C @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeWriters(dx); +makeSurfaceWriters(dx); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfaceWriters/dx/dxWriters.H b/src/sampling/sampledSurface/writers/dx/dxWriters.H similarity index 100% rename from src/sampling/surfaceWriters/dx/dxWriters.H rename to src/sampling/sampledSurface/writers/dx/dxWriters.H diff --git a/src/sampling/surfaceWriters/foamFile/foamFile.C b/src/sampling/sampledSurface/writers/foamFile/foamFile.C similarity index 100% rename from src/sampling/surfaceWriters/foamFile/foamFile.C rename to src/sampling/sampledSurface/writers/foamFile/foamFile.C diff --git a/src/sampling/surfaceWriters/foamFile/foamFile.H b/src/sampling/sampledSurface/writers/foamFile/foamFile.H similarity index 100% rename from src/sampling/surfaceWriters/foamFile/foamFile.H rename to src/sampling/sampledSurface/writers/foamFile/foamFile.H diff --git a/src/sampling/surfaceWriters/foamFile/foamFileWriters.C b/src/sampling/sampledSurface/writers/foamFile/foamFileWriters.C similarity index 98% rename from src/sampling/surfaceWriters/foamFile/foamFileWriters.C rename to src/sampling/sampledSurface/writers/foamFile/foamFileWriters.C index 746b4f2ce30281277679d09465cc1a45b209999f..a39f202eaf2cd6f7cafdb6bf30574da3d93e401d 100644 --- a/src/sampling/surfaceWriters/foamFile/foamFileWriters.C +++ b/src/sampling/sampledSurface/writers/foamFile/foamFileWriters.C @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeWriters(foamFile); +makeSurfaceWriters(foamFile); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfaceWriters/foamFile/foamFileWriters.H b/src/sampling/sampledSurface/writers/foamFile/foamFileWriters.H similarity index 100% rename from src/sampling/surfaceWriters/foamFile/foamFileWriters.H rename to src/sampling/sampledSurface/writers/foamFile/foamFileWriters.H diff --git a/src/sampling/surfaceWriters/null/null.C b/src/sampling/sampledSurface/writers/null/null.C similarity index 100% rename from src/sampling/surfaceWriters/null/null.C rename to src/sampling/sampledSurface/writers/null/null.C diff --git a/src/sampling/surfaceWriters/null/null.H b/src/sampling/sampledSurface/writers/null/null.H similarity index 99% rename from src/sampling/surfaceWriters/null/null.H rename to src/sampling/sampledSurface/writers/null/null.H index 413a50b799294f76f0baf0d3c525637c16373967..146f82cd434fe4f78bd8ce6d324f2f8e874d191b 100644 --- a/src/sampling/surfaceWriters/null/null.H +++ b/src/sampling/sampledSurface/writers/null/null.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - null + Foam::null Description diff --git a/src/sampling/surfaceWriters/null/nullWriters.C b/src/sampling/sampledSurface/writers/null/nullWriters.C similarity index 98% rename from src/sampling/surfaceWriters/null/nullWriters.C rename to src/sampling/sampledSurface/writers/null/nullWriters.C index 34efcd258ee327169165fd513d00628aa66c0115..0804ba24e2cf41457f3ef067ebb05c5aed24f106 100644 --- a/src/sampling/surfaceWriters/null/nullWriters.C +++ b/src/sampling/sampledSurface/writers/null/nullWriters.C @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeWriters(null); +makeSurfaceWriters(null); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfaceWriters/null/nullWriters.H b/src/sampling/sampledSurface/writers/null/nullWriters.H similarity index 100% rename from src/sampling/surfaceWriters/null/nullWriters.H rename to src/sampling/sampledSurface/writers/null/nullWriters.H diff --git a/src/sampling/surfaceWriters/raw/raw.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C similarity index 93% rename from src/sampling/surfaceWriters/raw/raw.C rename to src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C index ec0298303793c1d27c6ee3c30ceaf1a0e4fd06e1..78df8a73a9f14ca1c17f511c2d4016d09d7d4cc7 100644 --- a/src/sampling/surfaceWriters/raw/raw.C +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "raw.H" +#include "rawSurfaceWriter.H" #include "fileName.H" #include "OFstream.H" #include "faceList.H" @@ -34,7 +34,7 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class Type> -void Foam::raw<Type>::writeGeometry +void Foam::rawSurfaceWriter<Type>::writeGeometry ( const pointField& points, const label& pointI, @@ -48,7 +48,7 @@ void Foam::raw<Type>::writeGeometry template<class Type> -void Foam::raw<Type>::writeGeometry +void Foam::rawSurfaceWriter<Type>::writeGeometry ( const pointField& points, const faceList& faces, @@ -63,7 +63,7 @@ void Foam::raw<Type>::writeGeometry // Write scalarField in raw format template<class Type> -void Foam::raw<Type>::writeData +void Foam::rawSurfaceWriter<Type>::writeData ( const fileName& fieldName, const pointField& points, @@ -108,7 +108,7 @@ void Foam::raw<Type>::writeData // Write vectorField in raw format template<class Type> -void Foam::raw<Type>::writeData +void Foam::rawSurfaceWriter<Type>::writeData ( const fileName& fieldName, const pointField& points, @@ -131,7 +131,7 @@ void Foam::raw<Type>::writeData << nl; } - os << "# x y z " + os << "# x y z " << fieldName << "_x " << fieldName << "_y " << fieldName << "_z " @@ -158,7 +158,7 @@ void Foam::raw<Type>::writeData // Write sphericalTensorField in raw format template<class Type> -void Foam::raw<Type>::writeData +void Foam::rawSurfaceWriter<Type>::writeData ( const fileName& fieldName, const pointField& points, @@ -205,7 +205,7 @@ void Foam::raw<Type>::writeData // Write symmTensorField in raw format template<class Type> -void Foam::raw<Type>::writeData +void Foam::rawSurfaceWriter<Type>::writeData ( const fileName& fieldName, const pointField& points, @@ -258,7 +258,7 @@ void Foam::raw<Type>::writeData // Write tensorField in raw format template<class Type> -void Foam::raw<Type>::writeData +void Foam::rawSurfaceWriter<Type>::writeData ( const fileName& fieldName, const pointField& points, @@ -312,7 +312,7 @@ void Foam::raw<Type>::writeData // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type> -Foam::raw<Type>::raw() +Foam::rawSurfaceWriter<Type>::rawSurfaceWriter() : surfaceWriter<Type>() {} @@ -321,14 +321,14 @@ Foam::raw<Type>::raw() // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class Type> -Foam::raw<Type>::~raw() +Foam::rawSurfaceWriter<Type>::~rawSurfaceWriter() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void Foam::raw<Type>::write +void Foam::rawSurfaceWriter<Type>::write ( const fileName& samplePath, const fileName& timeDir, diff --git a/src/sampling/surfaceWriters/raw/raw.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H similarity index 94% rename from src/sampling/surfaceWriters/raw/raw.H rename to src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H index 26c368bd36ea3ee2136126e3b882cf51de90073a..8e2f74936fedf07e388ce59fb67cb826628d0986 100644 --- a/src/sampling/surfaceWriters/raw/raw.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H @@ -23,17 +23,17 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - raw + Foam::rawSurfaceWriter Description SourceFiles - raw.C + rawSurfaceWriter.C \*---------------------------------------------------------------------------*/ -#ifndef raw_H -#define raw_H +#ifndef rawSurfaceWriter_H +#define rawSurfaceWriter_H #include "surfaceWriter.H" @@ -47,11 +47,10 @@ namespace Foam \*---------------------------------------------------------------------------*/ template<class Type> -class raw +class rawSurfaceWriter : public surfaceWriter<Type> { - // Private Member Functions void writeGeometry @@ -60,7 +59,7 @@ class raw const label& pointI, Ostream& os ) const; - + void writeGeometry ( const pointField& points, @@ -68,7 +67,7 @@ class raw const label& faceI, Ostream& os ) const; - + void writeData ( const fileName& fieldName, @@ -124,11 +123,12 @@ public: // Constructors //- Construct null - raw(); + rawSurfaceWriter(); + // Destructor - virtual ~raw(); + virtual ~rawSurfaceWriter(); // Member Functions @@ -157,7 +157,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "raw.C" +# include "rawSurfaceWriter.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFileWriters.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriters.C similarity index 95% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFileWriters.C rename to src/sampling/sampledSurface/writers/raw/rawSurfaceWriters.C index 746b4f2ce30281277679d09465cc1a45b209999f..bef2ca4091008c5de1a3a655a4d60d8aa57e4dcd 100644 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/foamFile/foamFileWriters.C +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriters.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "foamFileWriters.H" +#include "rawSurfaceWriters.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeWriters(foamFile); +makeSurfaceWriters(rawSurfaceWriter); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfaceWriters/raw/rawWriters.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriters.H similarity index 78% rename from src/sampling/surfaceWriters/raw/rawWriters.H rename to src/sampling/sampledSurface/writers/raw/rawSurfaceWriters.H index fede7a71dfca0e55de8711ed5e0d19e1ee52d49d..af54c85c78d9c68f4052c5fac29c15a44870540f 100644 --- a/src/sampling/surfaceWriters/raw/rawWriters.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriters.H @@ -23,19 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - rawWriters + rawSurfaceWriters Description SourceFiles - rawWriters.C + rawSurfaceWriters.C \*---------------------------------------------------------------------------*/ -#ifndef rawWriters_H -#define rawWriters_H +#ifndef rawSurfaceWriters_H +#define rawSurfaceWriters_H -#include "raw.H" +#include "rawSurfaceWriter.H" #include "surfaceWriters.H" #include "fieldTypes.H" @@ -46,11 +46,11 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -typedef raw<scalar> rawScalarWriter; -typedef raw<vector> rawVectorWriter; -typedef raw<sphericalTensor> rawSphericalTensorWriter; -typedef raw<symmTensor> rawSymmTensorWriter; -typedef raw<tensor> rawTensorWriter; +typedef rawSurfaceWriter<scalar> rawSurfaceWriterScalarWriter; +typedef rawSurfaceWriter<vector> rawSurfaceWriterVectorWriter; +typedef rawSurfaceWriter<sphericalTensor> rawSurfaceWriterSphericalTensorWriter; +typedef rawSurfaceWriter<symmTensor> rawSurfaceWriterSymmTensorWriter; +typedef rawSurfaceWriter<tensor> rawSurfaceWriterTensorWriter; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfaceWriters/stl/stl.C b/src/sampling/sampledSurface/writers/stl/stl.C similarity index 100% rename from src/sampling/surfaceWriters/stl/stl.C rename to src/sampling/sampledSurface/writers/stl/stl.C diff --git a/src/sampling/surfaceWriters/stl/stl.H b/src/sampling/sampledSurface/writers/stl/stl.H similarity index 99% rename from src/sampling/surfaceWriters/stl/stl.H rename to src/sampling/sampledSurface/writers/stl/stl.H index 6f516e802657d403d46deaa41deebd1e93e94d9d..5cdfe4ec04374468dad7474d2ea8fa938d1e08f2 100644 --- a/src/sampling/surfaceWriters/stl/stl.H +++ b/src/sampling/sampledSurface/writers/stl/stl.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - stl + Foam::stl Description diff --git a/src/sampling/surfaceWriters/stl/stlWriters.C b/src/sampling/sampledSurface/writers/stl/stlWriters.C similarity index 98% rename from src/sampling/surfaceWriters/stl/stlWriters.C rename to src/sampling/sampledSurface/writers/stl/stlWriters.C index 4bccc9da5c85e93d1b965add7b7bf24d4f3d686b..ce50e874fc68b87d903fe1740e12a55aa98214d5 100644 --- a/src/sampling/surfaceWriters/stl/stlWriters.C +++ b/src/sampling/sampledSurface/writers/stl/stlWriters.C @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeWriters(stl); +makeSurfaceWriters(stl); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfaceWriters/stl/stlWriters.H b/src/sampling/sampledSurface/writers/stl/stlWriters.H similarity index 100% rename from src/sampling/surfaceWriters/stl/stlWriters.H rename to src/sampling/sampledSurface/writers/stl/stlWriters.H diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriter.C b/src/sampling/sampledSurface/writers/surfaceWriter.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriter.C rename to src/sampling/sampledSurface/writers/surfaceWriter.C diff --git a/src/sampling/surfaceWriters/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H similarity index 67% rename from src/sampling/surfaceWriters/surfaceWriter.H rename to src/sampling/sampledSurface/writers/surfaceWriter.H index 2cfd1b76f24b958ced159e6c9951b90aed2d004d..c8f03c68f656085ff89f40b7e42516ea5034b8d4 100644 --- a/src/sampling/surfaceWriters/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - surfaceWriter + Foam::surfaceWriter Description @@ -118,38 +118,38 @@ public: #endif // Only used internally -#define makeTypeWritersTypeName(type) \ - \ +#define makeTypeSurfaceWritersTypeName(type) \ + \ defineNamedTemplateTypeNameAndDebug(type, 0); // Used externally sometimes -#define makeWritersTypeName(typeWriter) \ - \ -makeTypeWritersTypeName(typeWriter##ScalarWriter); \ -makeTypeWritersTypeName(typeWriter##VectorWriter); \ -makeTypeWritersTypeName(typeWriter##SphericalTensorWriter); \ -makeTypeWritersTypeName(typeWriter##SymmTensorWriter); \ -makeTypeWritersTypeName(typeWriter##TensorWriter); +#define makeSurfaceWritersTypeName(typeWriter) \ + \ +makeTypeSurfaceWritersTypeName(typeWriter##ScalarWriter); \ +makeTypeSurfaceWritersTypeName(typeWriter##VectorWriter); \ +makeTypeSurfaceWritersTypeName(typeWriter##SphericalTensorWriter); \ +makeTypeSurfaceWritersTypeName(typeWriter##SymmTensorWriter); \ +makeTypeSurfaceWritersTypeName(typeWriter##TensorWriter); // Define type info for single template instantiation (e.g. vector) -#define makeWriterTypes(WriterType, type) \ - \ -defineNamedTemplateTypeNameAndDebug(type, 0); \ - \ -addToRunTimeSelectionTable \ -( \ - WriterType, type, word \ +#define makeSurfaceWriterTypes(WriterType, type) \ + \ +defineNamedTemplateTypeNameAndDebug(type, 0); \ + \ +addToRunTimeSelectionTable \ +( \ + WriterType, type, word \ ); // Define type info info for scalar, vector etc. instantiations -#define makeWriters(typeWriter) \ - \ -makeWriterTypes(scalarWriter, typeWriter##ScalarWriter); \ -makeWriterTypes(vectorWriter, typeWriter##VectorWriter); \ -makeWriterTypes(sphericalTensorWriter, typeWriter##SphericalTensorWriter); \ -makeWriterTypes(symmTensorWriter, typeWriter##SymmTensorWriter);\ -makeWriterTypes(tensorWriter, typeWriter##TensorWriter); +#define makeSurfaceWriters(typeWriter) \ + \ +makeSurfaceWriterTypes(scalarWriter, typeWriter##ScalarWriter); \ +makeSurfaceWriterTypes(vectorWriter, typeWriter##VectorWriter); \ +makeSurfaceWriterTypes(sphericalTensorWriter, typeWriter##SphericalTensorWriter);\ +makeSurfaceWriterTypes(symmTensorWriter, typeWriter##SymmTensorWriter); \ +makeSurfaceWriterTypes(tensorWriter, typeWriter##TensorWriter); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriters.C b/src/sampling/sampledSurface/writers/surfaceWriters.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/surfaceWriter/surfaceWriters.C rename to src/sampling/sampledSurface/writers/surfaceWriters.C diff --git a/src/sampling/surfaceWriters/surfaceWriters.H b/src/sampling/sampledSurface/writers/surfaceWriters.H similarity index 100% rename from src/sampling/surfaceWriters/surfaceWriters.H rename to src/sampling/sampledSurface/writers/surfaceWriters.H diff --git a/src/sampling/surfaceWriters/vtk/vtk.C b/src/sampling/sampledSurface/writers/vtk/vtk.C similarity index 100% rename from src/sampling/surfaceWriters/vtk/vtk.C rename to src/sampling/sampledSurface/writers/vtk/vtk.C diff --git a/src/sampling/surfaceWriters/vtk/vtk.H b/src/sampling/sampledSurface/writers/vtk/vtk.H similarity index 99% rename from src/sampling/surfaceWriters/vtk/vtk.H rename to src/sampling/sampledSurface/writers/vtk/vtk.H index a0f840a1947b861acc1b3aa05872b7412fe56ba0..ec64a104ef134e80e2999637fe5061c27a11dd93 100644 --- a/src/sampling/surfaceWriters/vtk/vtk.H +++ b/src/sampling/sampledSurface/writers/vtk/vtk.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - vtk + Foam::vtk Description @@ -51,7 +51,6 @@ class vtk : public surfaceWriter<Type> { - // Private Member Functions void writeGeometry @@ -113,6 +112,7 @@ public: //- Construct null vtk(); + // Destructor virtual ~vtk(); diff --git a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtkWriters.C b/src/sampling/sampledSurface/writers/vtk/vtkWriters.C similarity index 98% rename from applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtkWriters.C rename to src/sampling/sampledSurface/writers/vtk/vtkWriters.C index 22936eff257d0920984aa35da85b7b18d184030c..d6ab200abda3b3a6e46d16858a4b356ea3893aa0 100644 --- a/applications/utilities/postProcessing/sampling/sampleSurface/surfaceWriters/vtk/vtkWriters.C +++ b/src/sampling/sampledSurface/writers/vtk/vtkWriters.C @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeWriters(vtk); +makeSurfaceWriters(vtk); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfaceWriters/vtk/vtkWriters.H b/src/sampling/sampledSurface/writers/vtk/vtkWriters.H similarity index 100% rename from src/sampling/surfaceWriters/vtk/vtkWriters.H rename to src/sampling/sampledSurface/writers/vtk/vtkWriters.H diff --git a/src/sampling/surfaceWriters/raw/rawWriters.C b/src/sampling/surfaceWriters/raw/rawWriters.C deleted file mode 100644 index ecf4146d17fb00164cdf4306316e725a2a0d6a89..0000000000000000000000000000000000000000 --- a/src/sampling/surfaceWriters/raw/rawWriters.C +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "rawWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeWriters(raw); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/surfaceWriters/surfaceWriter.C b/src/sampling/surfaceWriters/surfaceWriter.C deleted file mode 100644 index 9ba9ac6b995dbed628b64c2d4836e6b53f333b61..0000000000000000000000000000000000000000 --- a/src/sampling/surfaceWriters/surfaceWriter.C +++ /dev/null @@ -1,78 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "surfaceWriter.H" -#include "HashTable.H" -#include "word.H" -#include "fileName.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -template<class Type> -autoPtr<surfaceWriter<Type> > surfaceWriter<Type>::New(const word& writeType) -{ - typename wordConstructorTable::iterator cstrIter = - wordConstructorTablePtr_ - ->find(writeType); - - if (cstrIter == wordConstructorTablePtr_->end()) - { - FatalErrorIn - ( - "surfaceWriter::New(const word&)" - ) << "Unknown write type " << writeType - << endl << endl - << "Valid write types : " << endl - << wordConstructorTablePtr_->toc() - << exit(FatalError); - } - - return autoPtr<surfaceWriter<Type> >(cstrIter()()); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -surfaceWriter<Type>::surfaceWriter() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -surfaceWriter<Type>::~surfaceWriter() -{} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/surfaceWriters/surfaceWriters.C b/src/sampling/surfaceWriters/surfaceWriters.C deleted file mode 100644 index bd1e73ee0ecf481f99523018aed23831d05ee71e..0000000000000000000000000000000000000000 --- a/src/sampling/surfaceWriters/surfaceWriters.C +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "surfaceWriters.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineNamedTemplateTypeNameAndDebug(scalarWriter, 0); -defineTemplateRunTimeSelectionTable(scalarWriter, word); - -defineNamedTemplateTypeNameAndDebug(vectorWriter, 0); -defineTemplateRunTimeSelectionTable(vectorWriter, word); - -defineNamedTemplateTypeNameAndDebug(sphericalTensorWriter, 0); -defineTemplateRunTimeSelectionTable(sphericalTensorWriter, word); - -defineNamedTemplateTypeNameAndDebug(symmTensorWriter, 0); -defineTemplateRunTimeSelectionTable(symmTensorWriter, word); - -defineNamedTemplateTypeNameAndDebug(tensorWriter, 0); -defineTemplateRunTimeSelectionTable(tensorWriter, word); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/surfaceWriters/vtk/vtkWriters.C b/src/sampling/surfaceWriters/vtk/vtkWriters.C deleted file mode 100644 index 22936eff257d0920984aa35da85b7b18d184030c..0000000000000000000000000000000000000000 --- a/src/sampling/surfaceWriters/vtk/vtkWriters.C +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "vtkWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeWriters(vtk); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H index 31730fb9e3694059174b8912d5169bc39355c306..f715d23a55e246bfcc3ff548ebe356605fa62800 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H @@ -207,12 +207,12 @@ public: inline scalar Kc(const scalar T) const; //- Equilibrium constant [] i.t.o. mole-fractions - // For low pressures (where the gas mixture is near perfect) + // For low pressures (where the gas mixture is near perfect) // Kx = Kp(pstd/p)^nui inline scalar Kx(const scalar T, const scalar p) const; //- Equilibrium constant [] i.t.o. number of moles - // For low pressures (where the gas mixture is near perfect) + // For low pressures (where the gas mixture is near perfect) // Kn = Kp(n*pstd/p)^nui where n = number of moles in mixture inline scalar Kn ( diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C index 46f2bf65f544e5605b10c1548459e9c707552cce..11865b663d32bdbbbc55ea333d8637bfea9a8d37 100644 --- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C +++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C @@ -119,7 +119,7 @@ tmp<volScalarField> twoPhaseMixture::mu() const { volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1)); - return tmp<volScalarField> + return tmp<volScalarField> ( new volScalarField ( @@ -136,7 +136,7 @@ tmp<surfaceScalarField> twoPhaseMixture::muf() const surfaceScalarField alpha1f = min(max(fvc::interpolate(alpha1_), scalar(0)), scalar(1)); - return tmp<surfaceScalarField> + return tmp<surfaceScalarField> ( new surfaceScalarField ( @@ -150,10 +150,10 @@ tmp<surfaceScalarField> twoPhaseMixture::muf() const tmp<surfaceScalarField> twoPhaseMixture::nuf() const { - surfaceScalarField alpha1f = + surfaceScalarField alpha1f = min(max(fvc::interpolate(alpha1_), scalar(0)), scalar(1)); - return tmp<surfaceScalarField> + return tmp<surfaceScalarField> ( new surfaceScalarField ( @@ -171,7 +171,11 @@ bool twoPhaseMixture::read() { if (transportModel::read()) { - if (nuModel1_().read(*this) && nuModel2_().read(*this)) + if + ( + nuModel1_().read(subDict(phase1Name_)) + && nuModel2_().read(subDict(phase2Name_)) + ) { nuModel1_->viscosityProperties().lookup("rho") >> rho1_; nuModel2_->viscosityProperties().lookup("rho") >> rho2_; diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.H b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.H index a693847ad2d7f53a8298135127b9d0db4d852053..b6d903f5ddfd8e5aa287b26f314bf1ff1241b437 100644 --- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.H +++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.H @@ -54,7 +54,9 @@ class twoPhaseMixture : public transportModel { - // Private data +protected: + + // Protected data word phase1Name_; word phase2Name_; @@ -141,7 +143,7 @@ public: tmp<surfaceScalarField> muf() const; //- Return the kinematic laminar viscosity - tmp<volScalarField> nu() const + virtual tmp<volScalarField> nu() const { return nu_; } @@ -149,14 +151,14 @@ public: //- Return the face-interpolated dynamic laminar viscosity tmp<surfaceScalarField> nuf() const; - //- Correct the laminar viscosity - void correct() + //- Correct the laminar viscosity + virtual void correct() { calcNu(); } //- Read base transportProperties dictionary - bool read(); + virtual bool read(); };