mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: patch boundarySlice() for extraction from a flat boundary list
- remove redundant raw patch slice and non-const patchSlice, which were only used internally by finiteArea. STYLE: noexcept on more patch methods
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
|
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -454,13 +454,13 @@ public:
|
|||||||
virtual const pointField& oldCellCentres() const;
|
virtual const pointField& oldCellCentres() const;
|
||||||
|
|
||||||
//- Return boundary mesh
|
//- Return boundary mesh
|
||||||
const polyBoundaryMesh& boundaryMesh() const
|
const polyBoundaryMesh& boundaryMesh() const noexcept
|
||||||
{
|
{
|
||||||
return boundary_;
|
return boundary_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return mesh bounding box
|
//- Return mesh bounding box
|
||||||
const boundBox& bounds() const
|
const boundBox& bounds() const noexcept
|
||||||
{
|
{
|
||||||
return bounds_;
|
return bounds_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -307,13 +307,14 @@ Foam::wordList Foam::polyPatch::constraintTypes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::polyPatch::offset() const
|
Foam::label Foam::polyPatch::offset() const noexcept
|
||||||
{
|
{
|
||||||
return start_ - boundaryMesh().start();
|
// Same as start_ - polyMesh::nInternalFaces()
|
||||||
|
return start_ - boundaryMesh_.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::polyBoundaryMesh& Foam::polyPatch::boundaryMesh() const
|
const Foam::polyBoundaryMesh& Foam::polyPatch::boundaryMesh() const noexcept
|
||||||
{
|
{
|
||||||
return boundaryMesh_;
|
return boundaryMesh_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -359,10 +359,10 @@ public:
|
|||||||
|
|
||||||
//- The offset where this patch starts in the boundary face list
|
//- The offset where this patch starts in the boundary face list
|
||||||
// The value is the same as patch.start() - mesh.nInternalFaces()
|
// The value is the same as patch.start() - mesh.nInternalFaces()
|
||||||
label offset() const;
|
label offset() const noexcept;
|
||||||
|
|
||||||
//- Return start label of this patch in the polyMesh face list
|
//- Return start label of this patch in the polyMesh face list
|
||||||
label start() const
|
label start() const noexcept
|
||||||
{
|
{
|
||||||
return start_;
|
return start_;
|
||||||
}
|
}
|
||||||
@ -374,7 +374,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return boundaryMesh reference
|
//- Return boundaryMesh reference
|
||||||
const polyBoundaryMesh& boundaryMesh() const;
|
const polyBoundaryMesh& boundaryMesh() const noexcept;
|
||||||
|
|
||||||
//- Return true if this patch is geometrically coupled (i.e. faces and
|
//- Return true if this patch is geometrically coupled (i.e. faces and
|
||||||
// points correspondence)
|
// points correspondence)
|
||||||
@ -399,18 +399,30 @@ public:
|
|||||||
return UIndirectList<T>(internalValues, faceCells());
|
return UIndirectList<T>(internalValues, faceCells());
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Slice List to patch, using the number of patch faces
|
//- This patch slice from the complete list, which has size
|
||||||
|
//- mesh::nFaces(), using the number of patch faces.
|
||||||
template<class T>
|
template<class T>
|
||||||
const typename List<T>::subList patchSlice(const UList<T>& l) const
|
const typename List<T>::subList
|
||||||
|
patchSlice(const UList<T>& values) const
|
||||||
{
|
{
|
||||||
return typename List<T>::subList(l, this->size(), start_);
|
return typename List<T>::subList(values, this->size(), start_);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Slice Field to patch, using the number of patch faces
|
//- This patch slice from the list of boundary values, which has size
|
||||||
|
//- mesh::nBoundaryFaces(), using the number of patch faces.
|
||||||
template<class T>
|
template<class T>
|
||||||
const typename Field<T>::subField patchSlice(const Field<T>& l) const
|
const typename List<T>::subList
|
||||||
|
boundarySlice(const List<T>& values) const
|
||||||
{
|
{
|
||||||
return typename Field<T>::subField(l, this->size(), start_);
|
return typename List<T>::subList(values, this->size(), offset());
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Slice Field to patch, using the number of patch faces.
|
||||||
|
template<class T>
|
||||||
|
const typename Field<T>::subField
|
||||||
|
patchSlice(const Field<T>& values) const
|
||||||
|
{
|
||||||
|
return typename Field<T>::subField(values, this->size(), start_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -194,6 +194,17 @@ const Foam::faBoundaryMesh& Foam::faPatch::boundaryMesh() const noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::faPatch::offset() const
|
||||||
|
{
|
||||||
|
return max
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
boundaryMesh().mesh().patchStarts()[index()]
|
||||||
|
- boundaryMesh().mesh().nInternalEdges()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::faPatch::start() const
|
Foam::label Foam::faPatch::start() const
|
||||||
{
|
{
|
||||||
return boundaryMesh().mesh().patchStarts()[index()];
|
return boundaryMesh().mesh().patchStarts()[index()];
|
||||||
|
|||||||
@ -305,6 +305,10 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- The offset where this patch starts in the boundary edge list.
|
||||||
|
// The value is the same as patch.start() - mesh.nInternalEdges()
|
||||||
|
label offset() const;
|
||||||
|
|
||||||
//- Patch start in edge list
|
//- Patch start in edge list
|
||||||
label start() const;
|
label start() const;
|
||||||
|
|
||||||
@ -320,18 +324,26 @@ public:
|
|||||||
return edgei - start();
|
return edgei - start();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Slice List to patch, using the virtual patch size
|
//- This patch slice from the complete list of values, which has
|
||||||
|
//- size mesh::nEdges(), using the virtual patch size.
|
||||||
template<class T>
|
template<class T>
|
||||||
typename List<T>::subList patchSlice(const List<T>& l) const
|
const typename List<T>::subList patchSlice(const List<T>& values) const
|
||||||
{
|
{
|
||||||
return typename List<T>::subList(l, size(), start());
|
return typename List<T>::subList(values, size(), start());
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Slice List to patch, using the number of patch edges
|
//- This patch slice from the list of boundary values, which has
|
||||||
|
//- size mesh::nBoundaryEdges(), using the virtual patch size.
|
||||||
template<class T>
|
template<class T>
|
||||||
typename List<T>::subList patchRawSlice(const List<T>& l) const
|
const typename List<T>::subList
|
||||||
|
boundarySlice(const List<T>& values) const
|
||||||
{
|
{
|
||||||
return typename List<T>::subList(l, nEdges(), start());
|
return typename List<T>::subList
|
||||||
|
(
|
||||||
|
values,
|
||||||
|
size(),
|
||||||
|
offset()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,13 +35,22 @@ Foam::slicedFvPatchField<Type>::slicedFvPatchField
|
|||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<Type, volMesh>& iF,
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
const Field<Type>& completeField
|
const Field<Type>& completeOrBoundaryField,
|
||||||
|
const bool isBoundaryOnly
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvPatchField<Type>(p, iF, Field<Type>())
|
fvPatchField<Type>(p, iF, Field<Type>())
|
||||||
{
|
{
|
||||||
// Set fvPatchField to a slice of the given complete field
|
if (isBoundaryOnly)
|
||||||
UList<Type>::shallowCopy(p.patchSlice(completeField));
|
{
|
||||||
|
// Set to a slice of the boundary field
|
||||||
|
UList<Type>::shallowCopy(p.boundarySlice(completeOrBoundaryField));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set to a slice of the complete field
|
||||||
|
UList<Type>::shallowCopy(p.patchSlice(completeOrBoundaryField));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,8 +73,11 @@ Foam::slicedFvPatchField<Type>::slicedFvPatchField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvPatchField<Type>(p, iF, dict, false)
|
fvPatchField<Type>(p, iF) // bypass dictionary constructor
|
||||||
{
|
{
|
||||||
|
fvPatchFieldBase::readDict(dict);
|
||||||
|
// Read "value" if present...
|
||||||
|
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,10 +154,12 @@ Foam::slicedFvPatchField<Type>::clone
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::slicedFvPatchField<Type>::~slicedFvPatchField()
|
Foam::slicedFvPatchField<Type>::~slicedFvPatchField()
|
||||||
{
|
{
|
||||||
// Set fvPatchField to nullptr to avoid deletion of underlying field
|
// Set to nullptr to avoid deletion of underlying field
|
||||||
UList<Type>::shallowCopy(UList<Type>());
|
UList<Type>::shallowCopy(UList<Type>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -47,10 +47,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef slicedFvPatchField_H
|
#ifndef Foam_slicedFvPatchField_H
|
||||||
#define slicedFvPatchField_H
|
#define Foam_slicedFvPatchField_H
|
||||||
|
|
||||||
#include "fvPatchField.H"
|
#include "fvPatchField.H"
|
||||||
|
#include "processorFvPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class slicedFvPatch Declaration
|
Class slicedFvPatchField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -66,9 +67,12 @@ class slicedFvPatchField
|
|||||||
:
|
:
|
||||||
public fvPatchField<Type>
|
public fvPatchField<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- The mesh processor patch type
|
||||||
|
typedef processorFvPatch processorPatchType;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("sliced");
|
TypeName("sliced");
|
||||||
|
|
||||||
@ -80,7 +84,8 @@ public:
|
|||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<Type, volMesh>&,
|
const DimensionedField<Type, volMesh>&,
|
||||||
const Field<Type>&
|
const Field<Type>& completeOrBoundaryField,
|
||||||
|
const bool isBoundaryOnly = false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from patch and internal field. Assign value later.
|
//- Construct from patch and internal field. Assign value later.
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,13 +35,22 @@ Foam::slicedFvsPatchField<Type>::slicedFvsPatchField
|
|||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<Type, surfaceMesh>& iF,
|
const DimensionedField<Type, surfaceMesh>& iF,
|
||||||
const Field<Type>& completeField
|
const Field<Type>& completeOrBoundaryField,
|
||||||
|
const bool isBoundaryOnly
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvsPatchField<Type>(p, iF, Field<Type>())
|
fvsPatchField<Type>(p, iF, Field<Type>())
|
||||||
{
|
{
|
||||||
// Set fvsPatchField to a slice of the given complete field
|
if (isBoundaryOnly)
|
||||||
UList<Type>::shallowCopy(p.patchSlice(completeField));
|
{
|
||||||
|
// Set to a slice of the boundary field
|
||||||
|
UList<Type>::shallowCopy(p.boundarySlice(completeOrBoundaryField));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set to a slice of the complete field
|
||||||
|
UList<Type>::shallowCopy(p.patchSlice(completeOrBoundaryField));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,8 +73,11 @@ Foam::slicedFvsPatchField<Type>::slicedFvsPatchField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvsPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
|
fvsPatchField<Type>(p, iF) // bypass dictionary constructor
|
||||||
{
|
{
|
||||||
|
fvsPatchFieldBase::readDict(dict);
|
||||||
|
// Read "value" if present...
|
||||||
|
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,10 +154,12 @@ Foam::slicedFvsPatchField<Type>::clone
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::slicedFvsPatchField<Type>::~slicedFvsPatchField()
|
Foam::slicedFvsPatchField<Type>::~slicedFvsPatchField()
|
||||||
{
|
{
|
||||||
// Set fvsPatchField to nullptr to avoid deletion of underlying field
|
// Set to nullptr to avoid deletion of underlying field
|
||||||
UList<Type>::shallowCopy(UList<Type>());
|
UList<Type>::shallowCopy(UList<Type>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,10 +41,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef slicedFvsPatchField_H
|
#ifndef Foam_slicedFvsPatchField_H
|
||||||
#define slicedFvsPatchField_H
|
#define Foam_slicedFvsPatchField_H
|
||||||
|
|
||||||
#include "fvsPatchField.H"
|
#include "fvsPatchField.H"
|
||||||
|
#include "processorFvPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class slicedFvsPatch Declaration
|
Class slicedFvsPatchField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -59,9 +61,12 @@ class slicedFvsPatchField
|
|||||||
:
|
:
|
||||||
public fvsPatchField<Type>
|
public fvsPatchField<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- The mesh processor patch type
|
||||||
|
typedef processorFvPatch processorPatchType;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("sliced");
|
TypeName("sliced");
|
||||||
|
|
||||||
@ -73,7 +78,8 @@ public:
|
|||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<Type, surfaceMesh>&,
|
const DimensionedField<Type, surfaceMesh>&,
|
||||||
const Field<Type>&
|
const Field<Type>& completeOrBoundaryField,
|
||||||
|
const bool isBoundaryOnly = false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Construct from patch and internal field
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017,2022 OpenFOAM Foundation
|
Copyright (C) 2011-2017,2022 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -201,7 +201,7 @@ void Foam::fvMesh::storeOldVol(const scalarField& V)
|
|||||||
scalarField& V0 = *V0Ptr_;
|
scalarField& V0 = *V0Ptr_;
|
||||||
// Note: V0 now sized with current mesh, not with (potentially
|
// Note: V0 now sized with current mesh, not with (potentially
|
||||||
// different size) V.
|
// different size) V.
|
||||||
V0.setSize(V.size());
|
V0.resize_nocopy(V.size());
|
||||||
V0 = V;
|
V0 = V;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,7 +665,6 @@ void Foam::fvMesh::removeFvBoundary()
|
|||||||
|
|
||||||
// Remove fvBoundaryMesh data first.
|
// Remove fvBoundaryMesh data first.
|
||||||
boundary_.clear();
|
boundary_.clear();
|
||||||
boundary_.setSize(0);
|
|
||||||
polyMesh::removeBoundary();
|
polyMesh::removeBoundary();
|
||||||
|
|
||||||
clearOut();
|
clearOut();
|
||||||
@ -709,12 +708,6 @@ Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::fvBoundaryMesh& Foam::fvMesh::boundary() const
|
|
||||||
{
|
|
||||||
return boundary_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::lduAddressing& Foam::fvMesh::lduAddr() const
|
const Foam::lduAddressing& Foam::fvMesh::lduAddr() const
|
||||||
{
|
{
|
||||||
if (!lduPtr_)
|
if (!lduPtr_)
|
||||||
@ -814,7 +807,7 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
|
|||||||
scalarField& V0 = *V0Ptr_;
|
scalarField& V0 = *V0Ptr_;
|
||||||
|
|
||||||
scalarField savedV0(V0);
|
scalarField savedV0(V0);
|
||||||
V0.setSize(nCells());
|
V0.resize_nocopy(nCells());
|
||||||
|
|
||||||
forAll(V0, i)
|
forAll(V0, i)
|
||||||
{
|
{
|
||||||
@ -856,7 +849,7 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
|
|||||||
scalarField& V00 = *V00Ptr_;
|
scalarField& V00 = *V00Ptr_;
|
||||||
|
|
||||||
scalarField savedV00(V00);
|
scalarField savedV00(V00);
|
||||||
V00.setSize(nCells());
|
V00.resize_nocopy(nCells());
|
||||||
|
|
||||||
forAll(V00, i)
|
forAll(V00, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017,2022 OpenFOAM Foundation
|
Copyright (C) 2011-2017,2022 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -97,6 +97,7 @@ protected:
|
|||||||
//- Boundary mesh
|
//- Boundary mesh
|
||||||
fvBoundaryMesh boundary_;
|
fvBoundaryMesh boundary_;
|
||||||
|
|
||||||
|
|
||||||
// Demand-driven data
|
// Demand-driven data
|
||||||
|
|
||||||
mutable fvMeshLduAddressing* lduPtr_;
|
mutable fvMeshLduAddressing* lduPtr_;
|
||||||
@ -314,7 +315,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return reference to boundary mesh
|
//- Return reference to boundary mesh
|
||||||
const fvBoundaryMesh& boundary() const;
|
const fvBoundaryMesh& boundary() const noexcept
|
||||||
|
{
|
||||||
|
return boundary_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return ldu addressing
|
//- Return ldu addressing
|
||||||
virtual const lduAddressing& lduAddr() const;
|
virtual const lduAddressing& lduAddr() const;
|
||||||
|
|||||||
@ -166,78 +166,79 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the polyPatch
|
//- Return the polyPatch
|
||||||
const polyPatch& patch() const noexcept
|
const polyPatch& patch() const noexcept
|
||||||
{
|
{
|
||||||
return polyPatch_;
|
return polyPatch_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return name
|
//- Return name
|
||||||
virtual const word& name() const
|
virtual const word& name() const
|
||||||
{
|
{
|
||||||
return polyPatch_.name();
|
return polyPatch_.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return start label of this patch in the polyMesh face list
|
//- The index of this patch in the boundary mesh
|
||||||
virtual label start() const
|
label index() const noexcept
|
||||||
{
|
{
|
||||||
return polyPatch_.start();
|
return polyPatch_.index();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return size
|
//- The patch start within the polyMesh face list
|
||||||
virtual label size() const
|
label start() const noexcept
|
||||||
{
|
{
|
||||||
return polyPatch_.size();
|
return polyPatch_.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if this patch is coupled
|
//- Patch size is the number of faces, but can be overloaded
|
||||||
virtual bool coupled() const
|
virtual label size() const
|
||||||
{
|
{
|
||||||
return polyPatch_.coupled();
|
return polyPatch_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the given type is a constraint type
|
//- Return true if this patch is coupled
|
||||||
static bool constraintType(const word& patchType);
|
virtual bool coupled() const
|
||||||
|
{
|
||||||
|
return polyPatch_.coupled();
|
||||||
|
}
|
||||||
|
|
||||||
//- Return a list of all the constraint patch types
|
//- Return true if the given type is a constraint type
|
||||||
static wordList constraintTypes();
|
static bool constraintType(const word& patchType);
|
||||||
|
|
||||||
//- Return the index of this patch in the fvBoundaryMesh
|
//- Return a list of all the constraint patch types
|
||||||
label index() const noexcept
|
static wordList constraintTypes();
|
||||||
{
|
|
||||||
return polyPatch_.index();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return boundaryMesh reference
|
//- Return boundaryMesh reference
|
||||||
const fvBoundaryMesh& boundaryMesh() const noexcept
|
const fvBoundaryMesh& boundaryMesh() const noexcept
|
||||||
{
|
{
|
||||||
return boundaryMesh_;
|
return boundaryMesh_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Slice List to patch, using the virtual patch size
|
//- This patch slice from the complete list, which has size
|
||||||
template<class T>
|
//- mesh::nFaces(), using the virtual patch size.
|
||||||
const typename List<T>::subList patchSlice(const List<T>& l) const
|
template<class T>
|
||||||
{
|
const typename List<T>::subList
|
||||||
return typename List<T>::subList(l, size(), start());
|
patchSlice(const List<T>& values) const
|
||||||
}
|
{
|
||||||
|
return typename List<T>::subList(values, size(), start());
|
||||||
|
}
|
||||||
|
|
||||||
//- Slice List to patch, using the underlying polyPatch information
|
//- This patch slice from the list of boundary values, which has size
|
||||||
template<class T>
|
//- mesh::nBoundaryFaces(), using the virtual patch size.
|
||||||
const typename List<T>::subList patchRawSlice
|
template<class T>
|
||||||
|
const typename List<T>::subList
|
||||||
|
boundarySlice(const List<T>& values) const
|
||||||
|
{
|
||||||
|
return typename List<T>::subList
|
||||||
(
|
(
|
||||||
const List<T>& l
|
values,
|
||||||
) const
|
size(),
|
||||||
{
|
polyPatch_.offset()
|
||||||
return typename List<T>::subList
|
);
|
||||||
(
|
}
|
||||||
l,
|
|
||||||
polyPatch_.size(),
|
|
||||||
polyPatch_.start()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return faceCells
|
//- Return faceCells
|
||||||
virtual const labelUList& faceCells() const;
|
virtual const labelUList& faceCells() const;
|
||||||
|
|
||||||
|
|
||||||
// Access functions for geometrical data
|
// Access functions for geometrical data
|
||||||
|
|||||||
Reference in New Issue
Block a user