COMP/ENH: Update assignments to constructors to compile with clang. Add tensor->triad conversion.

This commit is contained in:
laurence
2012-12-24 15:36:50 +00:00
parent 180cb0bbc1
commit 9989b015a6
14 changed files with 88 additions and 41 deletions

View File

@ -466,8 +466,8 @@ int main(int argc, char *argv[])
labelListList pointPoints; labelListList pointPoints;
autoPtr<mapDistribute> meshDistributor = buildMap(mesh, pointPoints); autoPtr<mapDistribute> meshDistributor = buildMap(mesh, pointPoints);
triadField alignments = buildAlignmentField(mesh); triadField alignments(buildAlignmentField(mesh));
pointField points = buildPointField(mesh); pointField points(buildPointField(mesh));
mesh.printInfo(Info); mesh.printInfo(Info);

View File

@ -168,7 +168,8 @@ public:
); );
//- Inserts points into the triangulation if the point is within //- Inserts points into the triangulation if the point is within
// the circumsphere of another cell // the circumsphere of another cell. Returns HashSet of failed
// point insertions
template<class PointIterator> template<class PointIterator>
labelPairHashSet rangeInsertReferredWithInfo labelPairHashSet rangeInsertReferredWithInfo
( (

View File

@ -585,7 +585,7 @@ Foam::label Foam::cellShapeControl::refineMesh
const autoPtr<backgroundMeshDecomposition>& decomposition const autoPtr<backgroundMeshDecomposition>& decomposition
) )
{ {
const pointField cellCentres = shapeControlMesh_.cellCentres(); const pointField cellCentres(shapeControlMesh_.cellCentres());
Info<< " Created cell centres" << endl; Info<< " Created cell centres" << endl;
@ -682,7 +682,7 @@ Foam::label Foam::cellShapeControl::refineMesh
) )
); );
verts.last().targetCellSize() = lastCellSize; verts.last().targetCellSize() = lastCellSize;
verts.last().alignment() = tensor::I; verts.last().alignment() = triad::unset;
} }
} }
@ -704,8 +704,8 @@ void Foam::cellShapeControl::smoothMesh()
pointPoints pointPoints
); );
triadField alignments = buildAlignmentField(shapeControlMesh_); triadField alignments(buildAlignmentField(shapeControlMesh_));
pointField points = buildPointField(shapeControlMesh_); pointField points(buildPointField(shapeControlMesh_));
// Setup the sizes and alignments on each point // Setup the sizes and alignments on each point
triadField fixedAlignments(shapeControlMesh_.vertexCount(), triad::unset); triadField fixedAlignments(shapeControlMesh_.vertexCount(), triad::unset);
@ -721,12 +721,7 @@ void Foam::cellShapeControl::smoothMesh()
{ {
const tensor& alignment = vit->alignment(); const tensor& alignment = vit->alignment();
fixedAlignments[vit->index()] = triad fixedAlignments[vit->index()] = alignment;
(
alignment.x(),
alignment.y(),
alignment.z()
);
} }
} }
@ -881,12 +876,7 @@ void Foam::cellShapeControl::smoothMesh()
{ {
if (vit->real()) if (vit->real())
{ {
vit->alignment() = tensor vit->alignment() = alignments[vit->index()];
(
alignments[vit->index()].x(),
alignments[vit->index()].y(),
alignments[vit->index()].z()
);
} }
} }
@ -911,9 +901,7 @@ void Foam::cellShapeControl::smoothMesh()
{ {
if (vit->referred()) if (vit->referred())
{ {
const triad& t = alignments[referredPoints[referredI++]]; vit->alignment() = alignments[referredPoints[referredI++]];
vit->alignment() = tensor(t.x(), t.y(), t.z());
} }
} }
} }

View File

@ -684,7 +684,7 @@ void Foam::cellShapeControlMesh::insertBoundingPoints(const boundBox& bb)
boundBox bbInflate = bb; boundBox bbInflate = bb;
bbInflate.inflate(10); bbInflate.inflate(10);
pointField pts = bbInflate.points(); pointField pts(bbInflate.points());
forAll(pts, pI) forAll(pts, pI)
{ {

View File

@ -263,8 +263,6 @@ Foam::triSurfaceScalarField Foam::automatic::load()
surfaceCellSize.write(); surfaceCellSize.write();
debug = 1;
if (debug) if (debug)
{ {
faceList faces(surface_.size()); faceList faces(surface_.size());

View File

@ -212,9 +212,8 @@ void Foam::conformalVoronoiMesh::checkDuals()
typedef CGAL::Exact_predicates_exact_constructions_kernel EK2; typedef CGAL::Exact_predicates_exact_constructions_kernel EK2;
typedef CGAL::Regular_triangulation_euclidean_traits_3<EK2> EK; typedef CGAL::Regular_triangulation_euclidean_traits_3<EK2> EK;
typedef CGAL::Cartesian_converter<typename baseK::Kernel, EK2> To_exact; typedef CGAL::Cartesian_converter<baseK::Kernel, EK2> To_exact;
typedef CGAL::Cartesian_converter<EK2, typename baseK::Kernel> typedef CGAL::Cartesian_converter<EK2, baseK::Kernel> Back_from_exact;
Back_from_exact;
// PackedBoolList bPoints(number_of_finite_cells()); // PackedBoolList bPoints(number_of_finite_cells());
@ -392,13 +391,13 @@ void Foam::conformalVoronoiMesh::checkDuals()
CGAL::Gmpq z(CGAL::to_double(masterPoint.z())); CGAL::Gmpq z(CGAL::to_double(masterPoint.z()));
std::cout<< "master = " << x << " " << y << " " << z std::cout<< "master = " << x << " " << y << " " << z
<< endl; << std::endl;
CGAL::Gmpq xs(CGAL::to_double(closestPoint.x())); CGAL::Gmpq xs(CGAL::to_double(closestPoint.x()));
CGAL::Gmpq ys(CGAL::to_double(closestPoint.y())); CGAL::Gmpq ys(CGAL::to_double(closestPoint.y()));
CGAL::Gmpq zs(CGAL::to_double(closestPoint.z())); CGAL::Gmpq zs(CGAL::to_double(closestPoint.z()));
std::cout<< "slave = " << xs << " " << ys << " " << zs std::cout<< "slave = " << xs << " " << ys << " " << zs
<< endl; << std::endl;
} }
} }
else else

View File

@ -142,7 +142,7 @@ inline int CGAL::indexedVertex<Gt, Vb>::index() const
template<class Gt, class Vb> template<class Gt, class Vb>
inline typename CGAL::indexedVertex<Gt, Vb>::vertexType& inline Foam::indexedVertexEnum::vertexType&
CGAL::indexedVertex<Gt, Vb>::type() CGAL::indexedVertex<Gt, Vb>::type()
{ {
return type_; return type_;
@ -150,7 +150,7 @@ CGAL::indexedVertex<Gt, Vb>::type()
template<class Gt, class Vb> template<class Gt, class Vb>
inline typename CGAL::indexedVertex<Gt, Vb>::vertexType inline Foam::indexedVertexEnum::vertexType
CGAL::indexedVertex<Gt, Vb>::type() const CGAL::indexedVertex<Gt, Vb>::type() const
{ {
return type_; return type_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,7 +36,6 @@ SourceFiles
#define symmTensor_H #define symmTensor_H
#include "SymmTensor.H" #include "SymmTensor.H"
#include "vector.H"
#include "contiguous.H" #include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -103,6 +103,9 @@ public:
//- Construct given SymmTensor //- Construct given SymmTensor
inline Tensor(const SymmTensor<Cmpt>&); inline Tensor(const SymmTensor<Cmpt>&);
//- Construct given triad
inline Tensor(const Vector<Vector<Cmpt> >&);
//- Construct given the three vector components //- Construct given the three vector components
inline Tensor inline Tensor
( (
@ -165,6 +168,9 @@ public:
//- Assign to a SymmTensor //- Assign to a SymmTensor
inline void operator=(const SymmTensor<Cmpt>&); inline void operator=(const SymmTensor<Cmpt>&);
//- Assign to a triad
inline void operator=(const Vector<Vector<Cmpt> >&);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -66,6 +66,24 @@ inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
} }
//- Construct given triad
template <class Cmpt>
inline Tensor<Cmpt>::Tensor(const Vector<Vector<Cmpt> >& tr)
{
this->v_[XX] = tr.x().x();
this->v_[XY] = tr.x().y();
this->v_[XZ] = tr.x().z();
this->v_[YX] = tr.y().x();
this->v_[YY] = tr.y().y();
this->v_[YZ] = tr.y().z();
this->v_[ZX] = tr.z().x();
this->v_[ZY] = tr.z().y();
this->v_[ZZ] = tr.z().z();
}
//- Construct given the three vector components //- Construct given the three vector components
template <class Cmpt> template <class Cmpt>
inline Tensor<Cmpt>::Tensor inline Tensor<Cmpt>::Tensor
@ -272,6 +290,23 @@ inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st)
} }
template <class Cmpt>
inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt> >& tr)
{
this->v_[XX] = tr.x().x();
this->v_[XY] = tr.x().y();
this->v_[XZ] = tr.x().z();
this->v_[YX] = tr.y().x();
this->v_[YY] = tr.y().y();
this->v_[YZ] = tr.y().z();
this->v_[ZX] = tr.z().x();
this->v_[ZY] = tr.z().y();
this->v_[ZZ] = tr.z().z();
}
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
//- Hodge Dual operator (tensor -> vector) //- Hodge Dual operator (tensor -> vector)

View File

@ -25,7 +25,6 @@ License
#include "triad.H" #include "triad.H"
#include "transform.H" #include "transform.H"
#include "tensor.H"
#include "quaternion.H" #include "quaternion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -63,6 +62,14 @@ Foam::triad::triad(const quaternion& q)
} }
Foam::triad::triad(const tensor& t)
{
x() = t.x();
y() = t.y();
z() = t.z();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::triad::orthogonalize() void Foam::triad::orthogonalize()
@ -331,6 +338,16 @@ Foam::triad::operator quaternion() const
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::triad::operator=(const tensor& t)
{
x() = t.x();
y() = t.y();
z() = t.z();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -40,6 +40,7 @@ SourceFiles
#define triad_H #define triad_H
#include "vector.H" #include "vector.H"
#include "tensor.H"
#include "contiguous.H" #include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +59,6 @@ Ostream& operator<<(Ostream&, const triad&);
class quaternion; class quaternion;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class triad Declaration Class triad Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -87,6 +87,9 @@ public:
//- Construct from a quaternion //- Construct from a quaternion
triad(const quaternion& q); triad(const quaternion& q);
//- Construct from a tensor
triad(const tensor& t);
//- Construct from Istream //- Construct from Istream
inline triad(Istream&); inline triad(Istream&);
@ -135,6 +138,8 @@ public:
inline void operator=(const Vector<vector>&); inline void operator=(const Vector<vector>&);
void operator=(const tensor& t);
//- Add the triad t2 to this triad //- Add the triad t2 to this triad
// without normalizing or orthogonalizing // without normalizing or orthogonalizing
void operator+=(const triad& t2); void operator+=(const triad& t2);

View File

@ -496,7 +496,6 @@ Foam::label Foam::polyMeshFilter::filter(const label nOriginalBadFaces)
faceFilterFactor_.resize(mesh_.nFaces(), initialFaceLengthFactor_); faceFilterFactor_.resize(mesh_.nFaces(), initialFaceLengthFactor_);
// Maintain the number of times a point has been part of a bad face // Maintain the number of times a point has been part of a bad face
//
labelList pointErrorCount(mesh_.nPoints(), 0); labelList pointErrorCount(mesh_.nPoints(), 0);
// Main loop // Main loop

View File

@ -564,8 +564,6 @@ void Foam::extendedFeatureEdgeMesh::allNearestFeaturePoints
List<pointIndexHit>& info List<pointIndexHit>& info
) const ) const
{ {
DynamicList<pointIndexHit> dynPointHit;
// Pick up all the feature points that intersect the search sphere // Pick up all the feature points that intersect the search sphere
labelList elems = pointTree().findSphere labelList elems = pointTree().findSphere
( (
@ -573,6 +571,8 @@ void Foam::extendedFeatureEdgeMesh::allNearestFeaturePoints
searchRadiusSqr searchRadiusSqr
); );
DynamicList<pointIndexHit> dynPointHit(elems.size());
forAll(elems, elemI) forAll(elems, elemI)
{ {
label index = elems[elemI]; label index = elems[elemI];
@ -609,7 +609,7 @@ void Foam::extendedFeatureEdgeMesh::allNearestFeatureEdges
sliceStarts[3] = openStart_; sliceStarts[3] = openStart_;
sliceStarts[4] = multipleStart_; sliceStarts[4] = multipleStart_;
DynamicList<pointIndexHit> dynEdgeHit; DynamicList<pointIndexHit> dynEdgeHit(edgeTrees.size()*3);
// Loop over all the feature edge types // Loop over all the feature edge types
forAll(edgeTrees, i) forAll(edgeTrees, i)