/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023-2026 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::GeometricFieldSources
Description
Part of a geometric field used for setting the values associated with
optional sources
SourceFiles
GeometricFieldSources.C
\*---------------------------------------------------------------------------*/
#ifndef GeometricFieldSources_H
#define GeometricFieldSources_H
#include "dimensionedTypes.H"
#include "DimensionedField.H"
#include "HashPtrTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class dictionary;
/*---------------------------------------------------------------------------*\
Class GeometricFieldSources Declaration
\*---------------------------------------------------------------------------*/
template class PrimitiveField>
class GeometricFieldSources
:
private HashPtrTable>
{
public:
// Public Typedefs
//- Type of the internal field from which this GeometricField is derived
typedef DimensionedField Internal;
//- Type of the field source of which this field sources is composed
typedef typename GeoMesh::template FieldSource Source;
private:
// Private Data
//- Cached IO error location for delayed error messages
IOerrorLocation errorLocation_;
public:
//- Declare friendship with other geometric field sources
template class PrimitiveField2>
friend class GeometricFieldSources;
// Constructors
//- Construct null
GeometricFieldSources();
//- Construct from a table of field sources
GeometricFieldSources(const Internal&, const HashPtrTable&);
//- Construct as copy setting the reference to the internal field
GeometricFieldSources(const Internal&, const GeometricFieldSources&);
//- Construct as copy setting the reference to the internal field
template class PrimitiveField2>
explicit GeometricFieldSources
(
const Internal&,
const GeometricFieldSources&
);
//- Construct from dictionary
GeometricFieldSources(const Internal&, const dictionary&);
//- Construct from types and an error location
GeometricFieldSources
(
const Internal&,
const HashTable&,
const IOerrorLocation&
);
//- Copy constructor deleted
// as it would not set the internalField reference correctly
GeometricFieldSources(const GeometricFieldSources&) = delete;
//- Move constructor deleted
// as it would not set the internalField reference correctly
GeometricFieldSources(GeometricFieldSources&&) = delete;
//- Destructor
~GeometricFieldSources();
// Member Functions
//- Access the underlying field table
const HashPtrTable& table() const;
//- Access the underlying field table
HashPtrTable& table();
//- Access the error location
const IOerrorLocation& errorLocation() const;
//- Inherit empty test
using HashPtrTable::empty;
//- Return a map from the source name to the field source type
HashTable types() const;
//- Read the sources
void readField(const Internal& field, const dictionary& dict);
//- Reset the boundary field contents to the given field
// Used for mesh to mesh mapping
void reset(const Internal&, const GeometricFieldSources&);
//- Write sources as dictionary entry
void writeEntry(const word& keyword, Ostream& os) const;
// Member operators
//- Find and return a field source
const Source& operator[](const word& sourceName) const;
};
template class PrimitiveField>
Ostream& operator<<
(
Ostream&,
const GeometricFieldSources&
);
/*---------------------------------------------------------------------------*\
Class NoFieldSource Declaration
\*---------------------------------------------------------------------------*/
template
class NoFieldSource
{
public:
// Constructors
//- Construct null
NoFieldSource()
{}
//- Construct from internal field
template
NoFieldSource(const InternalField&)
{}
//- Dummy clone
template
autoPtr> clone(const InternalField&) const
{
return autoPtr>(new NoFieldSource());
}
// Selectors
//- Dummy selector
template
static autoPtr> New
(
const word&,
const InternalField&
)
{
return autoPtr>(new NoFieldSource());
}
//- Dummy selector
template
static autoPtr> New
(
const InternalField&,
const dictionary&
)
{
return autoPtr>(new NoFieldSource());
}
// Member Functions
//- Dummy return of the internal field reference
const nil internalField() const
{
return nil();
}
};
template
Ostream& operator<<(Ostream& os, const NoFieldSource&)
{
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "GeometricFieldSources.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //