mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: triad.C operator+=(): Do not assign to elements that are preset
This commit is contained in:
@ -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) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -149,19 +149,19 @@ void Foam::triad::orthogonalize()
|
|||||||
|
|
||||||
void Foam::triad::operator+=(const triad& t2)
|
void Foam::triad::operator+=(const triad& t2)
|
||||||
{
|
{
|
||||||
if (t2.set(0) && !set(0))
|
bool preset[3];
|
||||||
{
|
|
||||||
operator[](0) = t2.operator[](0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (t2.set(1) && !set(1))
|
for (direction i=0; i<3; i++)
|
||||||
{
|
{
|
||||||
operator[](1) = t2.operator[](1);
|
if (t2.set(i) && !set(i))
|
||||||
}
|
{
|
||||||
|
operator[](i) = t2.operator[](i);
|
||||||
if (t2.set(2) && !set(2))
|
preset[i] = true;
|
||||||
{
|
}
|
||||||
operator[](2) = t2.operator[](2);
|
else
|
||||||
|
{
|
||||||
|
preset[i] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set() && t2.set())
|
if (set() && t2.set())
|
||||||
@ -171,6 +171,12 @@ void Foam::triad::operator+=(const triad& t2)
|
|||||||
|
|
||||||
for (direction i=0; i<3; i++)
|
for (direction i=0; i<3; i++)
|
||||||
{
|
{
|
||||||
|
if (preset[i])
|
||||||
|
{
|
||||||
|
signd[i] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
scalar mostAligned = -1;
|
scalar mostAligned = -1;
|
||||||
for (direction j=0; j<3; j++)
|
for (direction j=0; j<3; j++)
|
||||||
{
|
{
|
||||||
@ -197,10 +203,7 @@ void Foam::triad::operator+=(const triad& t2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (direction i=0; i<3; i++)
|
|
||||||
{
|
|
||||||
operator[](i) += signd[i]*t2.operator[](correspondance[i]);
|
operator[](i) += signd[i]*t2.operator[](correspondance[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user