diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index b775d5deee..05a695ab7e 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -699,145 +699,6 @@ Foam::GeometricField::clone() const } -template class PatchField, class GeoMesh> -Foam::tmp> -Foam::GeometricField::New -( - const word& name, - const Mesh& mesh, - const dimensionSet& ds, - const word& patchFieldType -) -{ - return tmp>::New - ( - IOobject - ( - name, - mesh.thisDb().time().timeName(), - mesh.thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - ds, - patchFieldType - ); -} - - -template class PatchField, class GeoMesh> -Foam::tmp> -Foam::GeometricField::New -( - const word& name, - const Mesh& mesh, - const dimensioned& dt, - const word& patchFieldType -) -{ - return tmp>::New - ( - IOobject - ( - name, - mesh.thisDb().time().timeName(), - mesh.thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - dt, - patchFieldType - ); -} - - -template class PatchField, class GeoMesh> -Foam::tmp> -Foam::GeometricField::New -( - const word& name, - const Mesh& mesh, - const dimensioned& dt, - const wordList& patchFieldTypes, - const wordList& actualPatchTypes -) -{ - return tmp>::New - ( - IOobject - ( - name, - mesh.thisDb().time().timeName(), - mesh.thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - dt, - patchFieldTypes, - actualPatchTypes - ); -} - - -template class PatchField, class GeoMesh> -Foam::tmp> -Foam::GeometricField::New -( - const word& newName, - const tmp>& tgf -) -{ - return tmp>::New - ( - IOobject - ( - newName, - tgf().instance(), - tgf().local(), - tgf().db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - tgf - ); -} - - -template class PatchField, class GeoMesh> -Foam::tmp> -Foam::GeometricField::New -( - const word& newName, - const tmp>& tgf, - const wordList& patchFieldTypes, - const wordList& actualPatchTypes -) -{ - return tmp>::New - ( - IOobject - ( - newName, - tgf().instance(), - tgf().local(), - tgf().db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - tgf, - patchFieldTypes, - actualPatchTypes - ); -} - // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * * // template class PatchField, class GeoMesh> @@ -1479,6 +1340,7 @@ Foam::Ostream& Foam::operator<< // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "GeometricFieldNew.C" #include "GeometricBoundaryField.C" #include "GeometricFieldFunctions.C" diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 6983da3b0b..21891cbc3d 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -462,6 +462,9 @@ public: //- Clone tmp> clone() const; + + // Static Constructors + //- Return tmp field from name, mesh, dimensions and patch type. // The field is NO_READ, NO_WRITE, unregistered and uses the // current timeName from the mesh registry @@ -473,6 +476,32 @@ public: const word& patchFieldType = PatchField::calculatedType() ); + //- Return tmp field from name, mesh, dimensions, + //- copy of internal field, with specified patch type. + // The field is NO_READ, NO_WRITE, unregistered and uses the + // current timeName from the mesh registry + static tmp> New + ( + const word& name, + const Mesh& mesh, + const dimensionSet& ds, + const Field& iField, + const word& patchFieldType = PatchField::calculatedType() + ); + + //- Return tmp field from name, mesh, dimensions, + //- moved internal field contents, with specified patch type. + // The field is NO_READ, NO_WRITE, unregistered and uses the + // current timeName from the mesh registry + static tmp> New + ( + const word& name, + const Mesh& mesh, + const dimensionSet& ds, + Field&& iField, + const word& patchFieldType = PatchField::calculatedType() + ); + //- Return tmp field from name, mesh, dimensioned\ //- and patch type. // The field is NO_READ, NO_WRITE, unregistered and uses the diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldNew.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldNew.C new file mode 100644 index 0000000000..7d8c91d0a5 --- /dev/null +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldNew.C @@ -0,0 +1,231 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2019 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +template class PatchField, class GeoMesh> +Foam::tmp> +Foam::GeometricField::New +( + const word& name, + const Mesh& mesh, + const dimensionSet& ds, + const word& patchFieldType +) +{ + return tmp>::New + ( + IOobject + ( + name, + mesh.thisDb().time().timeName(), + mesh.thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + ds, + patchFieldType + ); +} + + +template class PatchField, class GeoMesh> +Foam::tmp> +Foam::GeometricField::New +( + const word& name, + const Mesh& mesh, + const dimensionSet& ds, + const Field& iField, + const word& patchFieldType +) +{ + return tmp>::New + ( + IOobject + ( + name, + mesh.thisDb().time().timeName(), + mesh.thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + ds, + iField, + patchFieldType + ); +} + + +template class PatchField, class GeoMesh> +Foam::tmp> +Foam::GeometricField::New +( + const word& name, + const Mesh& mesh, + const dimensionSet& ds, + Field&& iField, + const word& patchFieldType +) +{ + return tmp>::New + ( + IOobject + ( + name, + mesh.thisDb().time().timeName(), + mesh.thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + ds, + std::move(iField), + patchFieldType + ); +} + + +template class PatchField, class GeoMesh> +Foam::tmp> +Foam::GeometricField::New +( + const word& name, + const Mesh& mesh, + const dimensioned& dt, + const word& patchFieldType +) +{ + return tmp>::New + ( + IOobject + ( + name, + mesh.thisDb().time().timeName(), + mesh.thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + dt, + patchFieldType + ); +} + + +template class PatchField, class GeoMesh> +Foam::tmp> +Foam::GeometricField::New +( + const word& name, + const Mesh& mesh, + const dimensioned& dt, + const wordList& patchFieldTypes, + const wordList& actualPatchTypes +) +{ + return tmp>::New + ( + IOobject + ( + name, + mesh.thisDb().time().timeName(), + mesh.thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + dt, + patchFieldTypes, + actualPatchTypes + ); +} + + +template class PatchField, class GeoMesh> +Foam::tmp> +Foam::GeometricField::New +( + const word& newName, + const tmp>& tgf +) +{ + return tmp>::New + ( + IOobject + ( + newName, + tgf().instance(), + tgf().local(), + tgf().db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + tgf + ); +} + + +template class PatchField, class GeoMesh> +Foam::tmp> +Foam::GeometricField::New +( + const word& newName, + const tmp>& tgf, + const wordList& patchFieldTypes, + const wordList& actualPatchTypes +) +{ + return tmp>::New + ( + IOobject + ( + newName, + tgf().instance(), + tgf().local(), + tgf().db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + tgf, + patchFieldTypes, + actualPatchTypes + ); +} + + +// ************************************************************************* //