mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: FaceCellWave,PointEdgeWave : contiguous underlying data type
This commit is contained in:
@ -25,11 +25,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "directionInfo.H"
|
||||
//#include "hexMatcher.H"
|
||||
//#include "meshTools.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Find edge among edgeLabels that uses v0 and v1
|
||||
@ -209,13 +206,44 @@ Foam::Ostream& Foam::operator<<
|
||||
const Foam::directionInfo& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.index_ << wDist.n_;
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << wDist.index_ << wDist.n_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&wDist.index_),
|
||||
sizeof(directionInfo)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const directionInfo&)");
|
||||
return os;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::directionInfo& wDist)
|
||||
{
|
||||
return is >> wDist.index_ >> wDist.n_;
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
is >> wDist.index_ >> wDist.n_;
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&wDist.index_),
|
||||
sizeof(directionInfo)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, directionInfo&)");
|
||||
return is;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -251,6 +251,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with directionInfo type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<directionInfo>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -33,12 +33,42 @@ Foam::Ostream& Foam::operator<<
|
||||
const Foam::wallNormalInfo& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.normal();
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << wDist.normal();
|
||||
}
|
||||
else
|
||||
{
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&wDist.normal_),
|
||||
sizeof(vector)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const wallNormalInfo&)");
|
||||
return os;
|
||||
}
|
||||
|
||||
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist)
|
||||
{
|
||||
return is >> wDist.normal_;
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
is >> wDist.normal_;
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&wDist.normal_),
|
||||
sizeof(vector)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, wallNormalInfo&)");
|
||||
return is;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -191,6 +191,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with wallNormalInfo type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<wallNormalInfo>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -33,13 +33,43 @@ Foam::Ostream& Foam::operator<<
|
||||
const Foam::refinementData& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.refinementCount_ << token::SPACE << wDist.count_;
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << wDist.refinementCount_ << token::SPACE << wDist.count_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&wDist.refinementCount_),
|
||||
sizeof(refinementData)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const refinementData&)");
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::refinementData& wDist)
|
||||
{
|
||||
return is >> wDist.refinementCount_ >> wDist.count_;
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
is >> wDist.refinementCount_ >> wDist.count_;
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&wDist.refinementCount_),
|
||||
sizeof(refinementData)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, refinementData&)");
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -208,6 +208,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with refinementData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<refinementData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -242,6 +242,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with refinementDistanceData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<refinementDistanceData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -219,6 +219,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with smoothData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<smoothData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -210,6 +210,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with sweepData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<sweepData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -144,6 +144,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with pointEdgePoint type as contiguous as underlying type
|
||||
template<>
|
||||
inline bool contiguous<wallPointYPlus>()
|
||||
{
|
||||
return contiguous<wallPointData<scalar> >();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
@ -218,6 +218,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with pointEdgeStructuredWalk type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<pointEdgeStructuredWalk>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -40,9 +40,6 @@ SourceFiles
|
||||
#define pointData_H
|
||||
|
||||
#include "pointEdgePoint.H"
|
||||
//#include "point.H"
|
||||
//#include "label.H"
|
||||
//#include "tensor.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -158,6 +155,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with pointData as contiguous as pointEdgePoint
|
||||
template<>
|
||||
inline bool contiguous<pointData>()
|
||||
{
|
||||
return contiguous<pointEdgePoint>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -226,6 +226,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with pointEdgePoint type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<pointEdgePoint>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -201,6 +201,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with cellInfo type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<cellInfo>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -223,6 +223,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with wallPoint type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<wallPoint>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -160,6 +160,46 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with wallPointData type are contiguous. List the usual
|
||||
// ones.
|
||||
|
||||
template <>
|
||||
inline bool contiguous<wallPointData<bool> >()
|
||||
{
|
||||
return contiguous<wallPoint>();
|
||||
}
|
||||
template <>
|
||||
inline bool contiguous<wallPointData<label> >()
|
||||
{
|
||||
return contiguous<wallPoint>();
|
||||
}
|
||||
template <>
|
||||
inline bool contiguous<wallPointData<scalar> >()
|
||||
{
|
||||
return contiguous<wallPoint>();
|
||||
}
|
||||
template <>
|
||||
inline bool contiguous<wallPointData<vector> >()
|
||||
{
|
||||
return contiguous<wallPoint>();
|
||||
}
|
||||
template <>
|
||||
inline bool contiguous<wallPointData<sphericalTensor> >()
|
||||
{
|
||||
return contiguous<wallPoint>();
|
||||
}
|
||||
template <>
|
||||
inline bool contiguous<wallPointData<symmTensor> >()
|
||||
{
|
||||
return contiguous<wallPoint>();
|
||||
}
|
||||
template <>
|
||||
inline bool contiguous<wallPointData<tensor> >()
|
||||
{
|
||||
return contiguous<wallPoint>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
@ -195,6 +195,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with topoDistanceData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<topoDistanceData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -52,6 +52,164 @@ class smoothDelta
|
||||
:
|
||||
public LESdelta
|
||||
{
|
||||
public:
|
||||
|
||||
//- Public member class used by mesh-wave to propagate the delta-ratio
|
||||
class deltaData
|
||||
{
|
||||
scalar delta_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Update. Gets information from neighbouring face/cell and
|
||||
// uses this to update itself (if nessecary) and return true.
|
||||
template<class TrackingData>
|
||||
inline bool update
|
||||
(
|
||||
const deltaData& w2,
|
||||
const scalar scale,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline deltaData();
|
||||
|
||||
//- Construct from origin, yStar, distance
|
||||
inline deltaData(const scalar delta);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
scalar delta() const
|
||||
{
|
||||
return delta_;
|
||||
}
|
||||
|
||||
|
||||
// Needed by FaceCellWave
|
||||
|
||||
//- Check whether origin has been changed at all or
|
||||
// still contains original (invalid) value.
|
||||
template<class TrackingData>
|
||||
inline bool valid(TrackingData& td) const;
|
||||
|
||||
//- Check for identical geometrical data.
|
||||
// Used for cyclics checking.
|
||||
template<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const deltaData&,
|
||||
const scalar,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
//- Convert any absolute coordinates into relative to
|
||||
// (patch)face centre
|
||||
template<class TrackingData>
|
||||
inline void leaveDomain
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyPatch&,
|
||||
const label patchFaceI,
|
||||
const point& faceCentre,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Reverse of leaveDomain
|
||||
template<class TrackingData>
|
||||
inline void enterDomain
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyPatch&,
|
||||
const label patchFaceI,
|
||||
const point& faceCentre,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Apply rotation matrix to any coordinates
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyMesh&,
|
||||
const tensor&,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring face.
|
||||
template<class TrackingData>
|
||||
inline bool updateCell
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisCellI,
|
||||
const label neighbourFaceI,
|
||||
const deltaData& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring cell.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFaceI,
|
||||
const label neighbourCellI,
|
||||
const deltaData& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of different value on same face.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFaceI,
|
||||
const deltaData& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Same (like operator==)
|
||||
template<class TrackingData>
|
||||
inline bool equal(const deltaData&, TrackingData& td) const;
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Needed for List IO
|
||||
inline bool operator==(const deltaData&) const;
|
||||
|
||||
inline bool operator!=(const deltaData&) const;
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const deltaData& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.delta_;
|
||||
}
|
||||
|
||||
friend Istream& operator>>(Istream& is, deltaData& wDist)
|
||||
{
|
||||
return is >> wDist.delta_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
autoPtr<LESdelta> geometricDelta_;
|
||||
@ -67,159 +225,6 @@ class smoothDelta
|
||||
// Calculate the delta values
|
||||
void calcDelta();
|
||||
|
||||
//- Private member class used by mesh-wave to propagate the delta-ratio
|
||||
class deltaData
|
||||
{
|
||||
scalar delta_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Update. Gets information from neighbouring face/cell and
|
||||
// uses this to update itself (if nessecary) and return true.
|
||||
template<class TrackingData>
|
||||
inline bool update
|
||||
(
|
||||
const deltaData& w2,
|
||||
const scalar scale,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline deltaData();
|
||||
|
||||
//- Construct from origin, yStar, distance
|
||||
inline deltaData(const scalar delta);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
scalar delta() const
|
||||
{
|
||||
return delta_;
|
||||
}
|
||||
|
||||
|
||||
// Needed by FaceCellWave
|
||||
|
||||
//- Check whether origin has been changed at all or
|
||||
// still contains original (invalid) value.
|
||||
template<class TrackingData>
|
||||
inline bool valid(TrackingData& td) const;
|
||||
|
||||
//- Check for identical geometrical data.
|
||||
// Used for cyclics checking.
|
||||
template<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const deltaData&,
|
||||
const scalar,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
//- Convert any absolute coordinates into relative to
|
||||
// (patch)face centre
|
||||
template<class TrackingData>
|
||||
inline void leaveDomain
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyPatch&,
|
||||
const label patchFaceI,
|
||||
const point& faceCentre,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Reverse of leaveDomain
|
||||
template<class TrackingData>
|
||||
inline void enterDomain
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyPatch&,
|
||||
const label patchFaceI,
|
||||
const point& faceCentre,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Apply rotation matrix to any coordinates
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyMesh&,
|
||||
const tensor&,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring face.
|
||||
template<class TrackingData>
|
||||
inline bool updateCell
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisCellI,
|
||||
const label neighbourFaceI,
|
||||
const deltaData& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring cell.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFaceI,
|
||||
const label neighbourCellI,
|
||||
const deltaData& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of different value on same face.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFaceI,
|
||||
const deltaData& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Same (like operator==)
|
||||
template<class TrackingData>
|
||||
inline bool equal(const deltaData&, TrackingData& td) const;
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Needed for List IO
|
||||
inline bool operator==(const deltaData&) const;
|
||||
|
||||
inline bool operator!=(const deltaData&) const;
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const deltaData& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.delta_;
|
||||
}
|
||||
|
||||
friend Istream& operator>>(Istream& is, deltaData& wDist)
|
||||
{
|
||||
return is >> wDist.delta_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void setChangedFaces
|
||||
(
|
||||
@ -262,6 +267,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with deltaData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<smoothDelta::deltaData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
Reference in New Issue
Block a user