Commit 9989b015 authored by laurence's avatar laurence
Browse files

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

parent 180cb0bb
......@@ -466,8 +466,8 @@ int main(int argc, char *argv[])
labelListList pointPoints;
autoPtr<mapDistribute> meshDistributor = buildMap(mesh, pointPoints);
triadField alignments = buildAlignmentField(mesh);
pointField points = buildPointField(mesh);
triadField alignments(buildAlignmentField(mesh));
pointField points(buildPointField(mesh));
mesh.printInfo(Info);
......
......@@ -168,7 +168,8 @@ public:
);
//- 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>
labelPairHashSet rangeInsertReferredWithInfo
(
......
......@@ -585,7 +585,7 @@ Foam::label Foam::cellShapeControl::refineMesh
const autoPtr<backgroundMeshDecomposition>& decomposition
)
{
const pointField cellCentres = shapeControlMesh_.cellCentres();
const pointField cellCentres(shapeControlMesh_.cellCentres());
Info<< " Created cell centres" << endl;
......@@ -682,7 +682,7 @@ Foam::label Foam::cellShapeControl::refineMesh
)
);
verts.last().targetCellSize() = lastCellSize;
verts.last().alignment() = tensor::I;
verts.last().alignment() = triad::unset;
}
}
......@@ -704,8 +704,8 @@ void Foam::cellShapeControl::smoothMesh()
pointPoints
);
triadField alignments = buildAlignmentField(shapeControlMesh_);
pointField points = buildPointField(shapeControlMesh_);
triadField alignments(buildAlignmentField(shapeControlMesh_));
pointField points(buildPointField(shapeControlMesh_));
// Setup the sizes and alignments on each point
triadField fixedAlignments(shapeControlMesh_.vertexCount(), triad::unset);
......@@ -721,12 +721,7 @@ void Foam::cellShapeControl::smoothMesh()
{
const tensor& alignment = vit->alignment();
fixedAlignments[vit->index()] = triad
(
alignment.x(),
alignment.y(),
alignment.z()
);
fixedAlignments[vit->index()] = alignment;
}
}
......@@ -881,12 +876,7 @@ void Foam::cellShapeControl::smoothMesh()
{
if (vit->real())
{
vit->alignment() = tensor
(
alignments[vit->index()].x(),
alignments[vit->index()].y(),
alignments[vit->index()].z()
);
vit->alignment() = alignments[vit->index()];
}
}
......@@ -911,9 +901,7 @@ void Foam::cellShapeControl::smoothMesh()
{
if (vit->referred())
{
const triad& t = alignments[referredPoints[referredI++]];
vit->alignment() = tensor(t.x(), t.y(), t.z());
vit->alignment() = alignments[referredPoints[referredI++]];
}
}
}
......
......@@ -684,7 +684,7 @@ void Foam::cellShapeControlMesh::insertBoundingPoints(const boundBox& bb)
boundBox bbInflate = bb;
bbInflate.inflate(10);
pointField pts = bbInflate.points();
pointField pts(bbInflate.points());
forAll(pts, pI)
{
......
......@@ -263,8 +263,6 @@ Foam::triSurfaceScalarField Foam::automatic::load()
surfaceCellSize.write();
debug = 1;
if (debug)
{
faceList faces(surface_.size());
......
......@@ -212,9 +212,8 @@ void Foam::conformalVoronoiMesh::checkDuals()
typedef CGAL::Exact_predicates_exact_constructions_kernel EK2;
typedef CGAL::Regular_triangulation_euclidean_traits_3<EK2> EK;
typedef CGAL::Cartesian_converter<typename baseK::Kernel, EK2> To_exact;
typedef CGAL::Cartesian_converter<EK2, typename baseK::Kernel>
Back_from_exact;
typedef CGAL::Cartesian_converter<baseK::Kernel, EK2> To_exact;
typedef CGAL::Cartesian_converter<EK2, baseK::Kernel> Back_from_exact;
// PackedBoolList bPoints(number_of_finite_cells());
......@@ -392,13 +391,13 @@ void Foam::conformalVoronoiMesh::checkDuals()
CGAL::Gmpq z(CGAL::to_double(masterPoint.z()));
std::cout<< "master = " << x << " " << y << " " << z
<< endl;
<< std::endl;
CGAL::Gmpq xs(CGAL::to_double(closestPoint.x()));
CGAL::Gmpq ys(CGAL::to_double(closestPoint.y()));
CGAL::Gmpq zs(CGAL::to_double(closestPoint.z()));
std::cout<< "slave = " << xs << " " << ys << " " << zs
<< endl;
<< std::endl;
}
}
else
......
......@@ -142,7 +142,7 @@ inline int CGAL::indexedVertex<Gt, Vb>::index() const
template<class Gt, class Vb>
inline typename CGAL::indexedVertex<Gt, Vb>::vertexType&
inline Foam::indexedVertexEnum::vertexType&
CGAL::indexedVertex<Gt, Vb>::type()
{
return type_;
......@@ -150,7 +150,7 @@ CGAL::indexedVertex<Gt, Vb>::type()
template<class Gt, class Vb>
inline typename CGAL::indexedVertex<Gt, Vb>::vertexType
inline Foam::indexedVertexEnum::vertexType
CGAL::indexedVertex<Gt, Vb>::type() const
{
return type_;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -36,7 +36,6 @@ SourceFiles
#define symmTensor_H
#include "SymmTensor.H"
#include "vector.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -103,6 +103,9 @@ public:
//- Construct given SymmTensor
inline Tensor(const SymmTensor<Cmpt>&);
//- Construct given triad
inline Tensor(const Vector<Vector<Cmpt> >&);
//- Construct given the three vector components
inline Tensor
(
......@@ -165,6 +168,9 @@ public:
//- Assign to a SymmTensor
inline void operator=(const SymmTensor<Cmpt>&);
//- Assign to a triad
inline void operator=(const Vector<Vector<Cmpt> >&);
};
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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
template <class Cmpt>
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 * * * * * * * * * * * * * //
//- Hodge Dual operator (tensor -> vector)
......
......@@ -25,7 +25,6 @@ License
#include "triad.H"
#include "transform.H"
#include "tensor.H"
#include "quaternion.H"
// * * * * * * * * * * * * * * 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 * * * * * * * * * * * * * //
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
......
......@@ -40,6 +40,7 @@ SourceFiles
#define triad_H
#include "vector.H"
#include "tensor.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -58,7 +59,6 @@ Ostream& operator<<(Ostream&, const triad&);
class quaternion;
/*---------------------------------------------------------------------------*\
Class triad Declaration
\*---------------------------------------------------------------------------*/
......@@ -87,6 +87,9 @@ public:
//- Construct from a quaternion
triad(const quaternion& q);
//- Construct from a tensor
triad(const tensor& t);
//- Construct from Istream
inline triad(Istream&);
......@@ -135,6 +138,8 @@ public:
inline void operator=(const Vector<vector>&);
void operator=(const tensor& t);
//- Add the triad t2 to this triad
// without normalizing or orthogonalizing
void operator+=(const triad& t2);
......
......@@ -496,7 +496,6 @@ Foam::label Foam::polyMeshFilter::filter(const label nOriginalBadFaces)
faceFilterFactor_.resize(mesh_.nFaces(), initialFaceLengthFactor_);
// Maintain the number of times a point has been part of a bad face
//
labelList pointErrorCount(mesh_.nPoints(), 0);
// Main loop
......
......@@ -564,8 +564,6 @@ void Foam::extendedFeatureEdgeMesh::allNearestFeaturePoints
List<pointIndexHit>& info
) const
{
DynamicList<pointIndexHit> dynPointHit;
// Pick up all the feature points that intersect the search sphere
labelList elems = pointTree().findSphere
(
......@@ -573,6 +571,8 @@ void Foam::extendedFeatureEdgeMesh::allNearestFeaturePoints
searchRadiusSqr
);
DynamicList<pointIndexHit> dynPointHit(elems.size());
forAll(elems, elemI)
{
label index = elems[elemI];
......@@ -609,7 +609,7 @@ void Foam::extendedFeatureEdgeMesh::allNearestFeatureEdges
sliceStarts[3] = openStart_;
sliceStarts[4] = multipleStart_;
DynamicList<pointIndexHit> dynEdgeHit;
DynamicList<pointIndexHit> dynEdgeHit(edgeTrees.size()*3);
// Loop over all the feature edge types
forAll(edgeTrees, i)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment