Commit ad24dfdb authored by henry's avatar henry
Browse files
parents e8e24175 bc24fe97
......@@ -53,14 +53,9 @@ inline Foam::label Foam::globalIndex::toGlobal(const label i) const
//- Is on local processor
inline bool Foam::globalIndex::isLocal(const label i) const
{
label localI =
(
Pstream::myProcNo() == 0
? i
: i - offsets_[Pstream::myProcNo()-1]
);
return localI >= 0 && localI < offsets_[Pstream::myProcNo()];
return
(i < offsets_[Pstream::myProcNo()])
&& (i >= (Pstream::myProcNo() == 0 ? 0 : offsets_[Pstream::myProcNo()-1]));
}
......@@ -69,7 +64,7 @@ inline Foam::label Foam::globalIndex::toLocal(const label procI, const label i)
{
label localI = (procI == 0 ? i : i - offsets_[procI-1]);
if (localI < 0 || localI >= offsets_[procI])
if (localI < 0 || i >= offsets_[procI])
{
FatalErrorIn("globalIndex::toLocal(const label, const label)")
<< "Global " << i << " does not belong on processor "
......
......@@ -33,19 +33,15 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef USE_RANDOM
#if INT_MAX != 2147483647
# error "INT_MAX != 2147483647"
# error "The random number generator may not work!"
#endif
#ifdef USE_RANDOM
# include <climits>
# if INT_MAX != 2147483647
# error "INT_MAX != 2147483647"
# error "The random number generator random() may not work!"
# endif
#else
# include <cstdlib>
#endif
......@@ -77,7 +73,7 @@ int Random::bit()
# ifdef USE_RANDOM
if (random() > INT_MAX/2)
# else
if (mrand48() > 0)
if (lrand48() > INT_MAX/2)
# endif
{
return 1;
......
......@@ -533,7 +533,7 @@ Foam::labelList Foam::meshRefinement::getRefineCandidateFaces
const labelList& refineCell
) const
{
labelList testFaces(mesh_.nCells());
labelList testFaces(mesh_.nFaces());
label nTest = 0;
......
......@@ -34,12 +34,6 @@ Description
#include "scalar.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
//- Not VSMALL - but smaller than SMALL
const Foam::scalar Foam::triangleFuncs::NVSMALL = Foam::sqrt(Foam::VSMALL);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::triangleFuncs::setIntersection
......@@ -120,7 +114,8 @@ bool Foam::triangleFuncs::intersectAxesBundle
scalar det = v2*u1 - u2*v1;
if (Foam::mag(det) < SMALL)
// Fix for V0:(-31.71428 0 -15.10714) V10:(-1.285715 8.99165e-16 -1.142858) V20:(0 0 -1.678573) i0:0
if (Foam::mag(det)/max(max(mag(V10),mag(V20)),1) < SMALL)
{
// Triangle parallel to dir
return false;
......@@ -522,7 +517,7 @@ bool Foam::triangleFuncs::classify
bool hit = false;
if (Foam::mag(u1) < NVSMALL)
if (Foam::mag(u1) < ROOTVSMALL)
{
beta = u0/u2;
......
......@@ -71,11 +71,6 @@ public:
private:
// Private data
//- Not VSMALL - but smaller than SMALL
static const scalar NVSMALL;
// Private Member Functions
//- Helper function for intersect. Sets pt to be anywhere on the edge
......
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