diff --git a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C index c76e466f83..cc1981e1d5 100644 --- a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C +++ b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C @@ -33,6 +33,9 @@ Description Provide an edgeMesh file containing points that are not to be moved during smoothing in order to preserve features. + lambda/mu smoothing: G. Taubin, IBM Research report Rc-19923 (02/01/95) + "A signal processing approach to fair surface design" + \*---------------------------------------------------------------------------*/ #include "argList.H" diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C index 3feefdaf40..1a09b7f473 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,10 +104,10 @@ Foam::OFstream::OFstream { if (debug) { - Info<< "IFstream::IFstream(const fileName&," - "streamFormat format=ASCII," - "versionNumber version=currentVersion) : " - "could not open file for input\n" + Info<< "OFstream::OFstream(const fileName&," + "streamFormat, versionNumber, compressionType) : " + "could not open file " << pathname + << "for input\n" "in stream " << info() << Foam::endl; } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C index a1db6529f1..dfb60891d6 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C @@ -145,4 +145,19 @@ void Foam::PstreamBuffers::finishedSends(labelListList& sizes, const bool block) } +void Foam::PstreamBuffers::clear() +{ + forAll(sendBuf_, i) + { + sendBuf_[i].clear(); + } + forAll(recvBuf_, i) + { + recvBuf_[i].clear(); + } + recvBufPos_ = 0; + finishedSendsCalled_ = false; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H index 52b9960bde..8d5998fe82 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H @@ -112,8 +112,6 @@ class PstreamBuffers bool finishedSendsCalled_; - // Private Member Functions - public: // Static data @@ -155,6 +153,9 @@ public: // non-blocking. void finishedSends(labelListList& sizes, const bool block = true); + //- Clear storage and reset + void clear(); + }; diff --git a/src/edgeMesh/Make/files b/src/edgeMesh/Make/files index ed4cec5d95..0438dd204e 100644 --- a/src/edgeMesh/Make/files +++ b/src/edgeMesh/Make/files @@ -35,8 +35,6 @@ eem = $(em)/extendedEdgeMesh $(eem)/extendedEdgeMesh.C $(eem)/extendedEdgeMeshNew.C -$(eem)/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.C -$(eem)/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormatRunTime.C $(eem)/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormat.C $(eem)/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormatRunTime.C diff --git a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C b/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C index 999d2f0651..5ac41224e3 100644 --- a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C +++ b/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C @@ -30,6 +30,7 @@ License #include "Time.H" #include "OBJstream.H" #include "DynamicField.H" +#include "edgeMeshFormatsCore.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -104,6 +105,68 @@ Foam::label Foam::extendedEdgeMesh::nPointTypes = 4; Foam::label Foam::extendedEdgeMesh::nEdgeTypes = 5; +Foam::wordHashSet Foam::extendedEdgeMesh::readTypes() +{ + return wordHashSet(*fileExtensionConstructorTablePtr_); +} + + +Foam::wordHashSet Foam::extendedEdgeMesh::writeTypes() +{ + return wordHashSet(*writefileExtensionMemberFunctionTablePtr_); +} + + + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +bool Foam::extendedEdgeMesh::canReadType +( + const word& ext, + const bool verbose +) +{ + return edgeMeshFormatsCore::checkSupport + ( + readTypes(), + ext, + verbose, + "reading" + ); +} + + +bool Foam::extendedEdgeMesh::canWriteType +( + const word& ext, + const bool verbose +) +{ + return edgeMeshFormatsCore::checkSupport + ( + writeTypes(), + ext, + verbose, + "writing" + ); +} + + +bool Foam::extendedEdgeMesh::canRead +( + const fileName& name, + const bool verbose +) +{ + word ext = name.ext(); + if (ext == "gz") + { + ext = name.lessExt().ext(); + } + return canReadType(ext, verbose); +} + + // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // Foam::extendedEdgeMesh::pointStatus diff --git a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H b/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H index 2648321888..58e2ba8cab 100644 --- a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H +++ b/src/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H @@ -225,6 +225,18 @@ public: //- Number of possible feature edge types (i.e. number of slices) static label nEdgeTypes; + //- Can we read this file format? + static bool canRead(const fileName&, const bool verbose=false); + + //- Can we read this file format? + static bool canReadType(const word& ext, const bool verbose=false); + + //- Can we write this file format type? + static bool canWriteType(const word& ext, const bool verbose=false); + + static wordHashSet readTypes(); + static wordHashSet writeTypes(); + // Constructors diff --git a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.C b/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.C deleted file mode 100644 index d63ad27ed9..0000000000 --- a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.C +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "OBJextendedEdgeFormat.H" -#include "OBJedgeFormat.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::fileFormats::OBJextendedEdgeFormat::OBJextendedEdgeFormat -( - const fileName& filename -) -{ - read(filename); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::fileFormats::OBJextendedEdgeFormat::read(const fileName& filename) -{ - edgeMesh em(filename); - - clear(); - - // Note: should transfer here instead - storedPoints() = em.points(); - storedEdges() = em.edges(); - - return true; -} - - -void Foam::fileFormats::OBJextendedEdgeFormat::write -( - const fileName& filename, - const extendedEdgeMesh& mesh -) -{ - OBJedgeFormat::write(filename, mesh); -} - - -// ************************************************************************* // diff --git a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.H b/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.H deleted file mode 100644 index a65409f446..0000000000 --- a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.H +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::fileFormats::OBJextendedEdgeFormat - -Description - Provide a means of reading/writing Alias/Wavefront OBJ format. - - Does not handle negative vertex indices. - -SourceFiles - OBJextendedEdgeFormat.C - -\*---------------------------------------------------------------------------*/ - -#ifndef OBJextendedEdgeFormat_H -#define OBJextendedEdgeFormat_H - -#include "extendedEdgeMesh.H" -//#include "IFstream.H" -//#include "Ostream.H" -#include "OFstream.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace fileFormats -{ - -/*---------------------------------------------------------------------------*\ - Class OBJextendedEdgeFormat Declaration -\*---------------------------------------------------------------------------*/ - -class OBJextendedEdgeFormat -: - public extendedEdgeMesh -{ - // Private Member Functions - - //- Disallow default bitwise copy construct - OBJextendedEdgeFormat(const OBJextendedEdgeFormat&); - - //- Disallow default bitwise assignment - void operator=(const OBJextendedEdgeFormat&); - - -public: - - // Constructors - - //- Construct from file name - OBJextendedEdgeFormat(const fileName&); - - -// // Selectors -// -// //- Read file and return surface -// static autoPtr New(const fileName& name) -// { -// return autoPtr -// ( -// new OBJextendedEdgeFormat(name) -// ); -// } -// - - //- Destructor - virtual ~OBJextendedEdgeFormat() - {} - - - // Member Functions - - //- Write surface mesh components by proxy - static void write(const fileName&, const extendedEdgeMesh&); - - //- Read from file - virtual bool read(const fileName&); - - //- Write object file - virtual void write(const fileName& name) const - { - write(name, *this); - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fileFormats -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormatRunTime.C b/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormatRunTime.C deleted file mode 100644 index c88513a104..0000000000 --- a/src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormatRunTime.C +++ /dev/null @@ -1,60 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "OBJextendedEdgeFormat.H" - -#include "addToRunTimeSelectionTable.H" -#include "addToMemberFunctionSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace fileFormats -{ - -// read extendedEdgeMesh -addNamedToRunTimeSelectionTable -( - extendedEdgeMesh, - OBJextendedEdgeFormat, - fileExtension, - obj -); - -//// write extendedEdgeMesh -//addNamedToMemberFunctionSelectionTable -//( -// extendedEdgeMesh, -// OBJextendedEdgeFormat, -// write, -// fileExtension, -// obj -//); - -} -} - -// ************************************************************************* // diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index c0e43c1686..3773de6606 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -219,22 +219,33 @@ void Foam::Cloud::move(TrackData& td, const scalar trackTime) // Reset nTrackingRescues nTrackingRescues_ = 0; + + // List of lists of particles to be transfered for all of the + // neighbour processors + List > particleTransferLists + ( + neighbourProcs.size() + ); + + // List of destination processorPatches indices for all of the + // neighbour processors + List > patchIndexTransferLists + ( + neighbourProcs.size() + ); + + // Allocate transfer buffers + PstreamBuffers pBufs(Pstream::nonBlocking); + + // While there are particles to transfer while (true) { - // List of lists of particles to be transfered for all of the - // neighbour processors - List > particleTransferLists - ( - neighbourProcs.size() - ); - - // List of destination processorPatches indices for all of the - // neighbour processors - List > patchIndexTransferLists - ( - neighbourProcs.size() - ); + particleTransferLists = IDLList(); + forAll(patchIndexTransferLists, i) + { + patchIndexTransferLists[i].clear(); + } // Loop over all particles forAllIter(typename Cloud, *this, pIter) @@ -288,8 +299,9 @@ void Foam::Cloud::move(TrackData& td, const scalar trackTime) break; } - // Allocate transfer buffers - PstreamBuffers pBufs(Pstream::nonBlocking); + + // Clear transfer buffers + pBufs.clear(); // Stream into send buffers forAll(particleTransferLists, i) @@ -308,12 +320,12 @@ void Foam::Cloud::move(TrackData& td, const scalar trackTime) } } - // Set up transfers when in non-blocking mode. Returns sizes (in bytes) - // to be sent/received. - labelListList allNTrans(Pstream::nProcs()); + // Start sending. Sets number of bytes transferred + labelListList allNTrans(Pstream::nProcs()); pBufs.finishedSends(allNTrans); + bool transfered = false; forAll(allNTrans, i) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index 496f980a11..4e0f1d160b 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -310,14 +310,13 @@ class autoSnapDriver //- Find point on nearest feature edge (within searchDist). // Return point and feature // and store feature-edge to mesh-point and vice versa - pointIndexHit findNearFeatureEdge + Tuple2 findNearFeatureEdge ( const indirectPrimitivePatch& pp, const scalarField& snapDist, const label pointI, const point& estimatedPt, - label& featI, List > >&, List > >&, vectorField&, @@ -330,7 +329,7 @@ class autoSnapDriver // If another mesh point already referring to this feature // point and further away, reset that one to a near feature // edge (using findNearFeatureEdge above) - labelPair findNearFeaturePoint + Tuple2 findNearFeaturePoint ( const indirectPrimitivePatch& pp, const scalarField& snapDist, diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C index 67fee3ef96..03615a76bd 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C @@ -170,7 +170,7 @@ void Foam::autoSnapDriver::smoothAndConstrain if (isMasterEdge[meshEdges[edgeI]]) { - label nbrPointI = edges[pEdges[i]].otherVertex(pointI); + label nbrPointI = edges[edgeI].otherVertex(pointI); if (constraints[nbrPointI].first() >= nConstraints) { dispSum[pointI] += disp[nbrPointI]; @@ -213,80 +213,6 @@ void Foam::autoSnapDriver::smoothAndConstrain } } } -//XXXXXX -//TODO: make proper parallel so coupled edges don't have double influence -//void Foam::autoSnapDriver::smoothAndConstrain2 -//( -// const bool applyConstraints, -// const indirectPrimitivePatch& pp, -// const List& constraints, -// vectorField& disp -//) const -//{ -// const fvMesh& mesh = meshRefiner_.mesh(); -// -// for (label avgIter = 0; avgIter < 20; avgIter++) -// { -// vectorField dispSum(pp.nPoints(), vector::zero); -// labelList dispCount(pp.nPoints(), 0); -// -// const labelListList& pointEdges = pp.pointEdges(); -// const edgeList& edges = pp.edges(); -// -// forAll(pointEdges, pointI) -// { -// const labelList& pEdges = pointEdges[pointI]; -// -// forAll(pEdges, i) -// { -// label nbrPointI = edges[pEdges[i]].otherVertex(pointI); -// dispSum[pointI] += disp[nbrPointI]; -// dispCount[pointI]++; -// } -// } -// -// syncTools::syncPointList -// ( -// mesh, -// pp.meshPoints(), -// dispSum, -// plusEqOp(), -// vector::zero, -// mapDistribute::transform() -// ); -// syncTools::syncPointList -// ( -// mesh, -// pp.meshPoints(), -// dispCount, -// plusEqOp