Skip to content
Snippets Groups Projects
Commit 06df44a5 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

COMP: protect against null tmp field (freestream BC)

parent b519a8e1
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField ...@@ -38,7 +38,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
) )
: :
inletOutletFvPatchField<Type>(p, iF), inletOutletFvPatchField<Type>(p, iF),
freestreamBCPtr_() freestreamBCPtr_(nullptr)
{} {}
...@@ -51,7 +51,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField ...@@ -51,7 +51,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
) )
: :
inletOutletFvPatchField<Type>(p, iF), inletOutletFvPatchField<Type>(p, iF),
freestreamBCPtr_() freestreamBCPtr_(nullptr)
{ {
fvPatchFieldBase::readDict(dict); fvPatchFieldBase::readDict(dict);
...@@ -93,7 +93,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField ...@@ -93,7 +93,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
) )
: :
inletOutletFvPatchField<Type>(ptf, p, iF, mapper), inletOutletFvPatchField<Type>(ptf, p, iF, mapper),
freestreamBCPtr_() freestreamBCPtr_(nullptr)
{ {
if (ptf.freestreamBCPtr_) if (ptf.freestreamBCPtr_)
{ {
...@@ -110,7 +110,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField ...@@ -110,7 +110,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
) )
: :
inletOutletFvPatchField<Type>(ptf), inletOutletFvPatchField<Type>(ptf),
freestreamBCPtr_() freestreamBCPtr_(nullptr)
{ {
if (ptf.freestreamBCPtr_) if (ptf.freestreamBCPtr_)
{ {
...@@ -127,7 +127,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField ...@@ -127,7 +127,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
) )
: :
inletOutletFvPatchField<Type>(ptf, iF), inletOutletFvPatchField<Type>(ptf, iF),
freestreamBCPtr_() freestreamBCPtr_(nullptr)
{ {
if (ptf.freestreamBCPtr_) if (ptf.freestreamBCPtr_)
{ {
...@@ -160,7 +160,7 @@ void Foam::freestreamFvPatchField<Type>::rmap ...@@ -160,7 +160,7 @@ void Foam::freestreamFvPatchField<Type>::rmap
const auto& fsptf = refCast<const freestreamFvPatchField<Type>>(ptf); const auto& fsptf = refCast<const freestreamFvPatchField<Type>>(ptf);
if (fsptf.freestreamBCPtr_) if (freestreamBCPtr_ && fsptf.freestreamBCPtr_)
{ {
freestreamBCPtr_->rmap(fsptf.freestreamBCPtr_(), addr); freestreamBCPtr_->rmap(fsptf.freestreamBCPtr_(), addr);
} }
......
...@@ -83,8 +83,8 @@ SourceFiles ...@@ -83,8 +83,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef freestreamFvPatchField_H #ifndef Foam_freestreamFvPatchField_H
#define freestreamFvPatchField_H #define Foam_freestreamFvPatchField_H
#include "inletOutletFvPatchField.H" #include "inletOutletFvPatchField.H"
...@@ -102,7 +102,7 @@ class freestreamFvPatchField ...@@ -102,7 +102,7 @@ class freestreamFvPatchField
: :
public inletOutletFvPatchField<Type> public inletOutletFvPatchField<Type>
{ {
// Private data // Private Data
//- BC to supply the freestream value //- BC to supply the freestream value
tmp<fvPatchField<Type>> freestreamBCPtr_; tmp<fvPatchField<Type>> freestreamBCPtr_;
...@@ -175,7 +175,13 @@ public: ...@@ -175,7 +175,13 @@ public:
} }
// Member functions // Member Functions
// Access
const Field<Type>& freestreamValue() const { return this->refValue(); }
Field<Type>& freestreamValue() { return this->refValue(); }
// Mapping functions // Mapping functions
...@@ -193,19 +199,6 @@ public: ...@@ -193,19 +199,6 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
// Return defining fields
const Field<Type>& freestreamValue() const
{
return this->refValue();
}
Field<Type>& freestreamValue()
{
return this->refValue();
}
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment