ENH: FaceCellWave,PointEdgeWave : contiguous underlying data type

This commit is contained in:
mattijs
2010-12-20 17:16:30 +00:00
parent f46446f1b1
commit af7c53443e
18 changed files with 407 additions and 165 deletions

View File

@ -25,11 +25,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "directionInfo.H" #include "directionInfo.H"
//#include "hexMatcher.H"
//#include "meshTools.H"
#include "polyMesh.H" #include "polyMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Find edge among edgeLabels that uses v0 and v1 // Find edge among edgeLabels that uses v0 and v1
@ -209,13 +206,44 @@ Foam::Ostream& Foam::operator<<
const Foam::directionInfo& wDist 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) 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;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -251,6 +251,14 @@ public:
}; };
//- Data associated with directionInfo type are contiguous
template<>
inline bool contiguous<directionInfo>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -33,12 +33,42 @@ Foam::Ostream& Foam::operator<<
const Foam::wallNormalInfo& wDist 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) 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;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -191,6 +191,14 @@ public:
}; };
//- Data associated with wallNormalInfo type are contiguous
template<>
inline bool contiguous<wallNormalInfo>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -33,13 +33,43 @@ Foam::Ostream& Foam::operator<<
const Foam::refinementData& wDist 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) 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;
} }

View File

@ -208,6 +208,14 @@ public:
}; };
//- Data associated with refinementData type are contiguous
template<>
inline bool contiguous<refinementData>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -242,6 +242,14 @@ public:
}; };
//- Data associated with refinementDistanceData type are contiguous
template<>
inline bool contiguous<refinementDistanceData>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -219,6 +219,14 @@ public:
}; };
//- Data associated with smoothData type are contiguous
template<>
inline bool contiguous<smoothData>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -210,6 +210,14 @@ public:
}; };
//- Data associated with sweepData type are contiguous
template<>
inline bool contiguous<sweepData>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -144,6 +144,14 @@ public:
}; };
//- Data associated with pointEdgePoint type as contiguous as underlying type
template<>
inline bool contiguous<wallPointYPlus>()
{
return contiguous<wallPointData<scalar> >();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -218,6 +218,14 @@ public:
}; };
//- Data associated with pointEdgeStructuredWalk type are contiguous
template<>
inline bool contiguous<pointEdgeStructuredWalk>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -40,9 +40,6 @@ SourceFiles
#define pointData_H #define pointData_H
#include "pointEdgePoint.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 } // End namespace Foam

View File

@ -226,6 +226,14 @@ public:
}; };
//- Data associated with pointEdgePoint type are contiguous
template<>
inline bool contiguous<pointEdgePoint>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -201,6 +201,14 @@ public:
}; };
//- Data associated with cellInfo type are contiguous
template<>
inline bool contiguous<cellInfo>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -223,6 +223,14 @@ public:
}; };
//- Data associated with wallPoint type are contiguous
template<>
inline bool contiguous<wallPoint>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -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>();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -195,6 +195,14 @@ public:
}; };
//- Data associated with topoDistanceData type are contiguous
template<>
inline bool contiguous<topoDistanceData>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -52,22 +52,9 @@ class smoothDelta
: :
public LESdelta public LESdelta
{ {
// Private data public:
autoPtr<LESdelta> geometricDelta_; //- Public member class used by mesh-wave to propagate the delta-ratio
scalar maxDeltaRatio_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
smoothDelta(const smoothDelta&);
void operator=(const smoothDelta&);
// Calculate the delta values
void calcDelta();
//- Private member class used by mesh-wave to propagate the delta-ratio
class deltaData class deltaData
{ {
scalar delta_; scalar delta_;
@ -221,6 +208,24 @@ class smoothDelta
}; };
private:
// Private data
autoPtr<LESdelta> geometricDelta_;
scalar maxDeltaRatio_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
smoothDelta(const smoothDelta&);
void operator=(const smoothDelta&);
// Calculate the delta values
void calcDelta();
void setChangedFaces void setChangedFaces
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -262,6 +267,14 @@ public:
}; };
//- Data associated with deltaData type are contiguous
template<>
inline bool contiguous<smoothDelta::deltaData>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam