diff --git a/src/sampling/surfMeshSample/surfMeshSample/surfMeshSample.C b/src/sampling/surfMeshSample/surfMeshSample/surfMeshSample.C index e22356a7fe..616de169fe 100644 --- a/src/sampling/surfMeshSample/surfMeshSample/surfMeshSample.C +++ b/src/sampling/surfMeshSample/surfMeshSample/surfMeshSample.C @@ -56,7 +56,6 @@ Foam::surfMeshSample::getOrCreateSurfMesh() const meshedSurface(), // Create as empty surface name() ); - ptr->setWriteOption(IOobject::NO_WRITE); mesh().objectRegistry::store(ptr); } diff --git a/src/surfMesh/surfMesh/surfMesh.C b/src/surfMesh/surfMesh/surfMesh.C index b3558c6348..355aa4f474 100644 --- a/src/surfMesh/surfMesh/surfMesh.C +++ b/src/surfMesh/surfMesh/surfMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,7 +35,7 @@ License namespace Foam { - defineTypeNameAndDebug(surfMesh, 0); + defineTypeNameAndDebug(surfMesh, 0); } Foam::word Foam::surfMesh::meshSubDir = "surfMesh"; @@ -56,8 +56,8 @@ Foam::word Foam::surfMesh::meshSubDir = "surfMesh"; // zoneName = "zone0"; // } // -// // set single default zone -// zones.setSize(1); +// // Set single default zone +// zones.resize(1); // zones[0] = surfZone // ( // zoneName, @@ -130,7 +130,7 @@ Foam::surfMesh::surfMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ), IOobject ( @@ -139,7 +139,7 @@ Foam::surfMesh::surfMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ), IOobject ( @@ -148,21 +148,18 @@ Foam::surfMesh::surfMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ) ), MeshReference(this->storedIOFaces(), this->storedIOPoints()) { - if (debug) - { - Info<<"IOobject: " << io.path() << nl - <<" name: " << io.name() - <<" instance: " << io.instance() - <<" local: " << io.local() - <<" dbDir: " << io.db().dbDir() << endl; - Info<<"creating surfMesh at instance " << instance() << endl; - Info<<"timeName: " << instance() << endl; - } + DebugInfo + <<"IOobject: " << io.path() << nl + <<" name: " << io.name() + <<" instance: " << io.instance() + <<" local: " << io.local() + <<" dbDir: " << io.db().dbDir() << nl + <<"creating surfMesh at instance " << instance() << endl; copyContents(surf); } @@ -184,8 +181,8 @@ Foam::surfMesh::surfMesh instance(), meshSubDir, *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE + io.readOpt(), + io.writeOpt() ), IOobject ( @@ -193,8 +190,8 @@ Foam::surfMesh::surfMesh instance(), meshSubDir, *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE + io.readOpt(), + io.writeOpt() ), IOobject ( @@ -202,22 +199,20 @@ Foam::surfMesh::surfMesh instance(), meshSubDir, *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE + io.readOpt(), + io.writeOpt() ) ), MeshReference(this->storedIOFaces(), this->storedIOPoints()) { - if (debug) - { - Info<<"IOobject: " << io.path() << nl - <<" name: " << io.name() - <<" instance: " << io.instance() - <<" local: " << io.local() - <<" dbDir: " << io.db().dbDir() << endl; - Info<<"creating surfMesh at instance " << instance() << endl; - Info<<"timeName: " << instance() << endl; - } + DebugInfo + <<"IOobject: " << io.path() << nl + <<" name: " << io.name() + <<" instance: " << io.instance() + <<" local: " << io.local() + <<" dbDir: " << io.db().dbDir() << nl + <<"creating surfMesh at instance " << instance() << nl + <<"timeName: " << instance() << endl; transfer(surf); } @@ -435,6 +430,7 @@ void Foam::surfMesh::removeFiles(const fileName& instanceDir) const rm(meshFilesPath/"surfZones"); } + void Foam::surfMesh::removeFiles() const { removeFiles(instance()); diff --git a/src/surfMesh/surfMesh/surfMesh.H b/src/surfMesh/surfMesh/surfMesh.H index b00035d4b3..49019bbd50 100644 --- a/src/surfMesh/surfMesh/surfMesh.H +++ b/src/surfMesh/surfMesh/surfMesh.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -156,15 +156,13 @@ public: // Constructors - //- Read construct from IOobject + //- Read construct from IOobject. + // Writing = NO_WRITE explicit surfMesh(const IOobject& io); //- Read construct from IOobject, with alternative surface name - surfMesh - ( - const IOobject& io, - const word& surfName - ); + // Writing = NO_WRITE + surfMesh(const IOobject& io, const word& surfName); //- Copy construct from MeshedSurface surfMesh diff --git a/src/surfMesh/surfMesh/surfMeshClear.C b/src/surfMesh/surfMesh/surfMeshClear.C index 39bef03a02..deddca2664 100644 --- a/src/surfMesh/surfMesh/surfMeshClear.C +++ b/src/surfMesh/surfMesh/surfMeshClear.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,10 +31,7 @@ License void Foam::surfMesh::removeZones() { - if (debug) - { - InfoInFunction << "Removing surface zones." << endl; - } + DebugInFunction << "Removing surface zones." << endl; // Remove the surface zones storedZones().clear(); @@ -47,10 +44,7 @@ void Foam::surfMesh::removeZones() void Foam::surfMesh::clearGeom() { - if (debug) - { - InfoInFunction << "Clearing geometric data" << endl; - } + DebugInFunction << "Clearing geometric data" << endl; MeshReference::clearGeom(); } @@ -58,10 +52,7 @@ void Foam::surfMesh::clearGeom() void Foam::surfMesh::clearAddressing() { - if (debug) - { - InfoInFunction << "clearing topology" << endl; - } + DebugInFunction << "clearing topology" << endl; MeshReference::clearPatchMeshAddr(); } diff --git a/src/surfMesh/surfMesh/surfMeshIO.C b/src/surfMesh/surfMesh/surfMeshIO.C index d3a8a39e6d..661d0ca5a0 100644 --- a/src/surfMesh/surfMesh/surfMeshIO.C +++ b/src/surfMesh/surfMesh/surfMeshIO.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,12 +31,10 @@ License void Foam::surfMesh::setInstance ( const fileName& inst, - IOobject::writeOption wOpt) + IOobject::writeOption wOpt +) { - if (debug) - { - InfoInFunction << "Resetting file instance to " << inst << endl; - } + DebugInFunction << "Resetting file instance to " << inst << endl; instance() = inst; Allocator::setInstance(inst); @@ -54,30 +52,23 @@ void Foam::surfMesh::setWriteOption(IOobject::writeOption wOpt) Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate() { - if (debug) - { - InfoInFunction << "Updating mesh based on saved data." << endl; - } + DebugInFunction << "Updating mesh based on saved data." << endl; // Find point and face instances fileName pointsInst(time().findInstance(meshDir(), "points")); fileName facesInst(time().findInstance(meshDir(), "faces")); - if (debug) - { - Info<< "Points instance: old = " << pointsInstance() - << " new = " << pointsInst << nl - << "Faces instance: old = " << facesInstance() - << " new = " << facesInst << endl; - } + DebugInFunction + << "Points instance: old = " << pointsInstance() + << " new = " << pointsInst << nl + << "Faces instance: old = " << facesInstance() + << " new = " << facesInst << endl; if (facesInst != facesInstance()) { // Topological change - if (debug) - { - Info<< "Topological change" << endl; - } + DebugInfo + << "Topological change" << endl; clearOut(); @@ -167,10 +158,7 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate() else if (pointsInst != pointsInstance()) { // Points moved - if (debug) - { - Info<< "Point motion" << endl; - } + DebugInfo << "Point motion" << endl; clearOut(); storedIOPoints().instance() = pointsInst; @@ -193,10 +181,7 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate() } else { - if (debug) - { - Info<< "No change" << endl; - } + DebugInfo << "No change" << endl; } return surfMesh::UNCHANGED; diff --git a/src/surfMesh/surfaceRegistry/surfaceRegistry.C b/src/surfMesh/surfaceRegistry/surfaceRegistry.C index 49de22257f..fb61e9c4ba 100644 --- a/src/surfMesh/surfaceRegistry/surfaceRegistry.C +++ b/src/surfMesh/surfaceRegistry/surfaceRegistry.C @@ -50,7 +50,7 @@ Foam::surfaceRegistry::surfaceRegistry ( IOobject ( - ( surfName.size() ? surfName : defaultName ), + (surfName.size() ? surfName : defaultName), obr.time().timeName(), prefix, obr,