Commit 53a5eda5 authored by andy's avatar andy
Browse files

Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

parents dec0a99a d8a7b8fd
......@@ -146,7 +146,8 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readOldTimeIfPresent()
this->time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
this->registerObject()
);
if (field0.headerOk())
......@@ -761,7 +762,10 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime() const
(
this->name() + "_0",
this->time().timeName(),
this->db()
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
this->registerObject()
),
*this
);
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -66,16 +66,31 @@ Foam::PatchTools::sortedEdgeFaces
vector e2 = e.vec(localPoints);
e2 /= mag(e2) + VSMALL;
// Get opposite vertex for 0th face
const Face& f = localFaces[faceNbs[0]];
// Get the vertex on 0th face that forms a vector with the first
// edge point that has the largest angle with the edge
const Face& f0 = localFaces[faceNbs[0]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
scalar maxAngle = GREAT;
vector maxAngleEdgeDir(vector::max);
forAll(f0, fpI)
{
if (f0[fpI] != e.start())
{
const vector faceEdgeDir = localPoints[f0[fpI]] - edgePt;
const scalar angle = faceEdgeDir & e2;
if (angle < maxAngle)
{
maxAngle = angle;
maxAngleEdgeDir = faceEdgeDir;
}
}
}
// Get vector normal both to e2 and to edge from opposite vertex
// to edge (will be x-axis of our coordinate system)
vector e0 = e2 ^ (localPoints[vertI] - edgePt);
vector e0 = e2 ^ maxAngleEdgeDir;
e0 /= mag(e0) + VSMALL;
// Get y-axis of coordinate system
......@@ -88,13 +103,29 @@ Foam::PatchTools::sortedEdgeFaces
for (label nbI = 1; nbI < faceNbs.size(); nbI++)
{
// Get opposite vertex
// Get the vertex on face that forms a vector with the first
// edge point that has the largest angle with the edge
const Face& f = localFaces[faceNbs[nbI]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
vector vec = e2 ^ (localPoints[vertI] - edgePt);
maxAngle = GREAT;
maxAngleEdgeDir = vector::max;
forAll(f, fpI)
{
if (f[fpI] != e.start())
{
const vector faceEdgeDir = localPoints[f[fpI]] - edgePt;
const scalar angle = faceEdgeDir & e2;
if (angle < maxAngle)
{
maxAngle = angle;
maxAngleEdgeDir = faceEdgeDir;
}
}
}
vector vec = e2 ^ maxAngleEdgeDir;
vec /= mag(vec) + VSMALL;
faceAngles[nbI] = pseudoAngle
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -83,6 +83,10 @@ void Foam::attachDetach::attachInterface
forAll(removedPoints, pointI)
{
//Pout<< "Removing point:" << removedPoints[pointI]
// << " currently at:" << ref.points()[removedPoints[pointI]]
// << endl;
ref.setAction(polyRemovePoint(removedPoints[pointI]));
}
......@@ -90,8 +94,16 @@ void Foam::attachDetach::attachInterface
// Remove all faces from the slave patch
forAll(slavePatch, i)
{
//Pout<< "Removing face " << i + slavePatchStart
// << " with verts:" << ref.faces()[i + slavePatchStart]
// << " at:"
// << UIndirectList<point>
// (
// ref.points(),
// ref.faces()[i + slavePatchStart]
// )
// << endl;
ref.setAction(polyRemoveFace(i + slavePatchStart));
// Pout<< "Removing face " << i + slavePatchStart << endl;
}
// Modify the faces from the master patch
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -203,8 +203,8 @@ void Foam::layerAdditionRemoval::addCellLayer
// Flip the face as necessary
if
(
mc[faceI] == nei[mf[faceI]]
|| !mesh.isInternalFace(mf[faceI])
!mesh.isInternalFace(mf[faceI])
|| mc[faceI] == nei[mf[faceI]]
)
{
flipFaceFlux = true;
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -275,7 +275,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
// of the cell to be removed
label masterSideCell = own[mf[faceI]];
if (masterSideCell == mc[faceI])
if (mesh.isInternalFace(mf[faceI]) && masterSideCell == mc[faceI])
{
// Owner cell of the face is being removed.
// Grab the neighbour instead
......@@ -284,7 +284,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
label slaveSideCell = own[ftc[faceI]];
if (slaveSideCell == mc[faceI])
if (mesh.isInternalFace(ftc[faceI]) && slaveSideCell == mc[faceI])
{
// Owner cell of the face is being removed.
// Grab the neighbour instead
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -82,7 +82,8 @@ void Foam::fvPatchMapper::calcAddressing() const
}
else
{
addr[faceI] = 0;
//addr[faceI] = 0;
addr[faceI] = -1;
}
}
......@@ -90,12 +91,14 @@ void Foam::fvPatchMapper::calcAddressing() const
{
if (min(addr) < 0)
{
FatalErrorIn
//FatalErrorIn
WarningIn
(
"void fvPatchMapper::calcAddressing() const"
) << "Error in patch mapping for patch "
) << "Unmapped entry in patch mapping for patch "
<< patch_.index() << " named " << patch_.name()
<< abort(FatalError);
//<< abort(FatalError);
<< endl;
}
}
}
......@@ -156,19 +159,22 @@ void Foam::fvPatchMapper::calcAddressing() const
}
}
// Cater for bad mapping
if (nActive == 0)
{
newAddr[nActive] = 0;
newWeights[nActive] = 1;
nActive++;
}
//// Cater for bad mapping
//if (nActive == 0)
//{
// newAddr[nActive] = 0;
// newWeights[nActive] = 1;
// nActive++;
//}
newAddr.setSize(nActive);
newWeights.setSize(nActive);
// Re-scale the weights
newWeights /= sum(newWeights);
if (nActive > 0)
{
newWeights /= sum(newWeights);
}
// Reset addressing and weights
curAddr = newAddr;
......
......@@ -1287,7 +1287,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
+ ".obj"
)
);
Info<< "Writing points with too large a extrusion distance to "
Info<< "Writing points with too large an extrusion distance to "
<< str().name() << endl;
}
......@@ -1304,7 +1304,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
+ ".obj"
)
);
Info<< "Writing points with too large a extrusion distance to "
Info<< "Writing points with too large an extrusion distance to "
<< medialVecStr().name() << endl;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -1360,6 +1360,19 @@ void Foam::autoSnapDriver::doSnap
regionSide
);
meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace);
if (debug&meshRefinement::MESH)
{
const_cast<Time&>(mesh.time())++;
Pout<< "Writing duplicatedPoints mesh to time "
<< meshRefiner_.timeName()
<< endl;
meshRefiner_.write
(
debug, mesh.time().path()
/"duplicatedPoints"
);
}
}
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -31,7 +31,7 @@ Description
#include "HashTable.H"
#include "SortableList.H"
#include "transform.H"
#include "PatchTools.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -46,79 +46,10 @@ void Foam::triSurface::calcSortedEdgeFaces() const
const labelListList& eFaces = edgeFaces();
// create the lists for the various results. (resized on completion)
sortedEdgeFacesPtr_ = new labelListList(eFaces.size());
labelListList& sortedEdgeFaces = *sortedEdgeFacesPtr_;
forAll(eFaces, edgeI)
{
const labelList& myFaceNbs = eFaces[edgeI];
if (myFaceNbs.size() > 2)
{
// Get point on edge and normalized direction of edge (= e2 base
// of our coordinate system)
const edge& e = edges()[edgeI];
const point& edgePt = localPoints()[e.start()];
vector e2 = e.vec(localPoints());
e2 /= mag(e2) + VSMALL;
// Get opposite vertex for 0th face
const labelledTri& f = localFaces()[myFaceNbs[0]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
// Get vector normal both to e2 and to edge from opposite vertex
// to edge (will be x-axis of our coordinate system)
vector e0 = e2 ^ (localPoints()[vertI] - edgePt);
e0 /= mag(e0) + VSMALL;
// Get y-axis of coordinate system
vector e1 = e2 ^ e0;
SortableList<scalar> faceAngles(myFaceNbs.size());
// e0 is reference so angle is 0
faceAngles[0] = 0;
for (label nbI = 1; nbI < myFaceNbs.size(); nbI++)
{
// Get opposite vertex
const labelledTri& f = localFaces()[myFaceNbs[nbI]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
vector vec = e2 ^ (localPoints()[vertI] - edgePt);
vec /= mag(vec) + VSMALL;
faceAngles[nbI] = pseudoAngle
(
e0,
e1,
vec
);
}
faceAngles.sort();
sortedEdgeFaces[edgeI] = UIndirectList<label>
(
myFaceNbs,
faceAngles.indices()
);
}
else
{
// No need to sort. Just copy.
sortedEdgeFaces[edgeI] = myFaceNbs;
}
}
sortedEdgeFaces = PatchTools::sortedEdgeFaces(*this);
}
......
Supports Markdown
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