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

This commit is contained in:
laurence
2013-07-11 12:32:10 +01:00
12 changed files with 182 additions and 172 deletions

View File

@ -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
@ -28,7 +28,7 @@ License
#include "OStringStream.H"
#include "OSspecific.H"
#include "IFstream.H"
#include "readHexLabel.H"
#include "ReadHex.H"
#include <cxxabi.h>
#include <execinfo.h>
@ -100,8 +100,8 @@ void printSourceFileAndLine
unsigned long offset = ulong(info.dli_fbase);
IStringStream addressStr(address.substr(2));
label addressValue = readHexLabel(addressStr);
label relativeAddress = addressValue-offset;
long addressValue = ReadHex<long>(addressStr);
long relativeAddress = addressValue-offset;
// Reconstruct hex word from address
OStringStream nStream;
@ -211,7 +211,7 @@ void error::printStack(Ostream& os)
{
string offsetString(line.substr(0, line.find('-')));
IStringStream offsetStr(offsetString);
addressMap.insert(libPath, readHexLabel(offsetStr));
addressMap.insert(libPath, ReadHex<label>(offsetStr));
}
}
}

View File

@ -508,66 +508,6 @@ Foam::volumeType Foam::indexedOctree<Type>::getSide
//
//template<class Type>
//bool Foam::indexedOctree<Type>::findAnyOverlap
//(
// const label nodeI,
// const point& sample,
// const scalar nearestDistSqr
//) const
//{
// const node& nod = nodes_[nodeI];
//
// // Determine order to walk through octants
// FixedList<direction, 8> octantOrder;
// nod.bb_.searchOrder(sample, octantOrder);
//
// // Go into all suboctants (one containing sample first) and update
// // nearest.
// for (direction i = 0; i < 8; i++)
// {
// direction octant = octantOrder[i];
//
// labelBits index = nod.subNodes_[octant];
//
// if (isNode(index))
// {
// label subNodeI = getNode(index);
//
// const treeBoundBox& subBb = nodes_[subNodeI].bb_;
//
// if (overlaps(subBb.min(), subBb.max(), nearestDistSqr, sample))
// {
// return findAnyOverlap
// (
// subNodeI,
// sample,
// nearestDistSqr
// );
// }
// }
// else if (isContent(index))
// {
// if
// (
// overlaps
// (
// nod.bb_,
// octant,
// nearestDistSqr,
// sample
// )
// )
// {
// return true;
// }
// }
// }
//
// return false;
//}
// Find nearest point starting from nodeI
template<class Type>
template<class FindNearestOp>
@ -1819,11 +1759,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
label i = 0;
for (; i < 100000; i++)
{
// if (isLineInsideOrOutside(nodeI, treeStart, treeEnd))
// {
// return hitInfo;
// }
// Ray-trace to end of current node. Updates point (either on triangle
// in case of hit or on node bounding box in case of miss)
@ -1981,38 +1916,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
}
//template<class Type>
//bool Foam::indexedOctree<Type>::isLineInsideOrOutside
//(
// const label nodeI,
// const point& start,
// const point& end
//) const
//{
// const node& nod = nodes_[nodeI];
//
// direction startOctant = nod.bb_.subOctant(start);
// direction endOctant = nod.bb_.subOctant(end);
//
// if (startOctant == endOctant)
// {
// volumeType startOctantType
// = volumeType(nodeTypes_.get((nodeI<<3) + startOctant));
//
// if
// (
// startOctantType == INSIDE || startOctantType == OUTSIDE
// )
// {
// //Info<< nodeI << " | " << start << " " << end << endl;
// return true;
// }
// }
//
// return false;
//}
// Find first intersection
template<class Type>
template<class FindIntersectOp>

View File

@ -319,13 +319,6 @@ private:
const bool verbose = false
) const;
// bool isLineInsideOrOutside
// (
// const label nodeI,
// const point& start,
// const point& end
// ) const;
//- Find any or nearest intersection of line between start and end.
template<class FindIntersectOp>
pointIndexHit findLine
@ -549,19 +542,6 @@ public:
const FindNearestOp& fnOp
) const;
// bool findAnyOverlap
// (
// const point& sample,
// const scalar nearestDistSqr
// ) const;
//
// bool findAnyOverlap
// (
// const label nodeI,
// const point& sample,
// const scalar nearestDistSqr
// ) const;
//- Low level: calculate nearest starting from subnode.
template<class FindNearestOp>
void findNearest

View File

@ -0,0 +1,76 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Read a non-delimited hex label
\*---------------------------------------------------------------------------*/
#include "ReadHex.H"
#include <cctype>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class T>
T Foam::ReadHex(ISstream& is)
{
// Takes into account that 'a' (or 'A') is 10
static const int alphaOffset = toupper('A') - 10;
// Takes into account that '0' is 0
static const int zeroOffset = int('0');
char c = 0;
// Get next non-whitespace character
while (is.get(c) && isspace(c))
{}
register T result = 0;
do
{
if (isspace(c) || c == 0) break;
if (!isxdigit(c))
{
FatalIOErrorIn("ReadHex(ISstream&)", is)
<< "Illegal hex digit: '" << c << "'"
<< exit(FatalIOError);
}
result <<= 4;
if (isdigit(c))
{
result += int(c) - zeroOffset;
}
else
{
result += toupper(c) - alphaOffset;
}
} while (is.get(c));
return result;
}
// ************************************************************************* //

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam
Description
Read a hex integer from an input stream
SourceFiles
ReadHex.C
\*---------------------------------------------------------------------------*/
#ifndef ReadHex_H
#define ReadHex_H
#include "ISstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
//- Read a hex label from an input stream
template<class T>
T ReadHex(ISstream&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ReadHex.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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
@ -27,48 +27,13 @@ Description
\*---------------------------------------------------------------------------*/
#include "readHexLabel.H"
#include <cctype>
#include "ReadHex.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::label Foam::readHexLabel(ISstream& is)
{
// Takes into account that 'a' (or 'A') is 10
static const label alphaOffset = toupper('A') - 10;
// Takes into account that '0' is 0
static const label zeroOffset = int('0');
char c = 0;
// Get next non-whitespace character
while (is.get(c) && isspace(c))
{}
register label result = 0;
do
{
if (isspace(c) || c == 0) break;
if (!isxdigit(c))
{
FatalIOErrorIn("readHexLabel(ISstream&)", is)
<< "Illegal hex digit: '" << c << "'"
<< exit(FatalIOError);
}
result <<= 4;
if (isdigit(c))
{
result += int(c) - zeroOffset;
}
else
{
result += toupper(c) - alphaOffset;
}
} while (is.get(c));
return result;
return ReadHex<label>(is);
}

View File

@ -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
@ -848,6 +848,30 @@ void Foam::addPatchCellLayer::setRefinement
}
}
forAll(globalEdgeFaces, edgeI)
{
if (globalEdgeFaces[edgeI].size() > 2)
{
const edge& e = pp.edges()[edgeI];
if (nPointLayers[e[0]] > 0 || nPointLayers[e[1]] > 0)
{
FatalErrorIn
(
"addPatchCellLayer::setRefinement"
"(const scalar, const indirectPrimitivePatch&"
", const labelList&, const vectorField&, polyTopoChange&)"
) << "Trying to extrude edge "
<< e.line(pp.localPoints())
<< " which is non-manifold (has "
<< globalEdgeFaces[edgeI].size()
<< " faces using it)"
<< abort(FatalError);
}
}
}
const labelList& meshPoints = pp.meshPoints();
// Some storage for edge-face-addressing.

View File

@ -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
@ -29,7 +29,7 @@ License
Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::wallPoint& wDist)
{
return os << wDist.origin() << wDist.distSqr();
return os << wDist.origin() << token::SPACE << wDist.distSqr();
}
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallPoint& wDist)

View File

@ -39,9 +39,10 @@ Ostream& operator<<
const wallPointData<Type>& wDist
)
{
operator<<(os, static_cast<const wallPoint&>(wDist));
return os << wDist.data();
return os
<< static_cast<const wallPoint&>(wDist)
<< token::SPACE
<< wDist.data();
}
@ -52,9 +53,7 @@ Istream& operator>>
wallPointData<Type>& wDist
)
{
operator>>(is, static_cast<wallPoint&>(wDist));
return is >> wDist.data_;
return is >> static_cast<wallPoint&>(wDist) >> wDist.data_;
}

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
object autoHexMeshDict;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
object autoHexMeshDict;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
object autoHexMeshDict;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //