mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of develop.openfoam.com:Development/OpenFOAM-plus
This commit is contained in:
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,7 +42,11 @@ See also
|
|||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
#include<list>
|
#include "labelRange.H"
|
||||||
|
#include "ListOps.H"
|
||||||
|
#include "SubList.H"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -61,6 +65,19 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
if (false)
|
||||||
|
{
|
||||||
|
labelList intlist(IStringStream("(0 1 2)")());
|
||||||
|
Info<<"construct from Istream: " << intlist << endl;
|
||||||
|
|
||||||
|
IStringStream("(3 4 5)")() >> static_cast<labelUList&>(intlist);
|
||||||
|
Info<<"is >>: " << intlist << endl;
|
||||||
|
|
||||||
|
IStringStream("(6 7 8)")() >> intlist;
|
||||||
|
Info<<"is >>: " << intlist << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<vector> list1(IStringStream("1 ((0 1 2))")());
|
List<vector> list1(IStringStream("1 ((0 1 2))")());
|
||||||
Info<< "list1: " << list1 << endl;
|
Info<< "list1: " << list1 << endl;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,6 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
labelRange range;
|
||||||
labelRanges ranges;
|
labelRanges ranges;
|
||||||
|
|
||||||
bool removeMode = false;
|
bool removeMode = false;
|
||||||
@ -74,14 +75,16 @@ int main(int argc, char *argv[])
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
label start = 0;
|
{
|
||||||
label size = 0;
|
label start = 0;
|
||||||
|
label size = 0;
|
||||||
|
|
||||||
IStringStream(args[argI])() >> start;
|
IStringStream(args[argI])() >> start;
|
||||||
++argI;
|
++argI;
|
||||||
IStringStream(args[argI])() >> size;
|
IStringStream(args[argI])() >> size;
|
||||||
|
|
||||||
labelRange range(start, size);
|
range.reset(start, size);
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "---------------" << nl;
|
Info<< "---------------" << nl;
|
||||||
if (removeMode)
|
if (removeMode)
|
||||||
@ -107,10 +110,11 @@ int main(int argc, char *argv[])
|
|||||||
ranges.add(range);
|
ranges.add(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "<list>" << ranges << "</list>" << nl;
|
Info<< "<list>" << ranges << "</list>" << nl
|
||||||
forAllConstIter(labelRanges, ranges, iter)
|
<< "content:";
|
||||||
|
for (auto i : ranges)
|
||||||
{
|
{
|
||||||
Info<< " " << iter();
|
Info<< " " << i;
|
||||||
}
|
}
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,8 +148,9 @@ runParallel()
|
|||||||
|
|
||||||
# Store any parsed additional arguments e.g. decomposeParDict
|
# Store any parsed additional arguments e.g. decomposeParDict
|
||||||
APP_PARARGS=
|
APP_PARARGS=
|
||||||
# Check the default decomposeParDict if available
|
|
||||||
nProcs=$(getNumberOfProcessors system/decomposeParDict)
|
# Initialise number of procs to unset value
|
||||||
|
nProcs=-1
|
||||||
|
|
||||||
# Parse options and executable
|
# Parse options and executable
|
||||||
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
|
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
|
||||||
@ -185,6 +186,8 @@ runParallel()
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ "$nProcs" -eq -1 ] && nProcs=$(getNumberOfProcessors system/decomposeParDict)
|
||||||
|
|
||||||
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
|
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
|
||||||
then
|
then
|
||||||
echo "$APP_NAME already run on $PWD:" \
|
echo "$APP_NAME already run on $PWD:" \
|
||||||
@ -213,7 +216,7 @@ cloneCase()
|
|||||||
else
|
else
|
||||||
echo "Cloning $2 case from $1"
|
echo "Cloning $2 case from $1"
|
||||||
mkdir $2
|
mkdir $2
|
||||||
cpfiles="0 system constant"
|
cpfiles="0.orig 0 system constant"
|
||||||
for f in $cpfiles
|
for f in $cpfiles
|
||||||
do
|
do
|
||||||
\cp -r $1/$f $2
|
\cp -r $1/$f $2
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
|
|||||||
}
|
}
|
||||||
else if (firstToken.isLabel())
|
else if (firstToken.isLabel())
|
||||||
{
|
{
|
||||||
label s = firstToken.labelToken();
|
const label s = firstToken.labelToken();
|
||||||
|
|
||||||
// Set list length to that read
|
// Set list length to that read
|
||||||
L.setSize(s);
|
L.setSize(s);
|
||||||
|
|||||||
@ -183,7 +183,7 @@ bool Foam::UList<T>::operator<(const UList<T>& a) const
|
|||||||
(
|
(
|
||||||
const_iterator vi = begin(), ai = a.begin();
|
const_iterator vi = begin(), ai = a.begin();
|
||||||
vi < end() && ai < a.end();
|
vi < end() && ai < a.end();
|
||||||
vi++, ai++
|
++vi, ++ai
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (*vi < *ai)
|
if (*vi < *ai)
|
||||||
|
|||||||
@ -427,7 +427,7 @@ inline void reverse(UList<T>&);
|
|||||||
// \endcode
|
// \endcode
|
||||||
// \sa forAllReverse
|
// \sa forAllReverse
|
||||||
#define forAll(list, i) \
|
#define forAll(list, i) \
|
||||||
for (Foam::label i=0; i<(list).size(); i++)
|
for (Foam::label i=0; i<(list).size(); ++i)
|
||||||
|
|
||||||
//- Reverse loop across all elements in \a list
|
//- Reverse loop across all elements in \a list
|
||||||
// \par Usage
|
// \par Usage
|
||||||
@ -439,7 +439,7 @@ inline void reverse(UList<T>&);
|
|||||||
// \endcode
|
// \endcode
|
||||||
// \sa forAll
|
// \sa forAll
|
||||||
#define forAllReverse(list, i) \
|
#define forAllReverse(list, i) \
|
||||||
for (Foam::label i=(list).size()-1; i>=0; i--)
|
for (Foam::label i=(list).size()-1; i>=0; --i)
|
||||||
|
|
||||||
//- Iterate across all elements in the \a container object of type
|
//- Iterate across all elements in the \a container object of type
|
||||||
// \a Container.
|
// \a Container.
|
||||||
@ -472,8 +472,8 @@ inline void reverse(UList<T>&);
|
|||||||
#define forAllConstIter(Container,container,iter) \
|
#define forAllConstIter(Container,container,iter) \
|
||||||
for \
|
for \
|
||||||
( \
|
( \
|
||||||
Container::const_iterator iter = (container).begin(); \
|
Container::const_iterator iter = (container).cbegin(); \
|
||||||
iter != (container).end(); \
|
iter != (container).cend(); \
|
||||||
++iter \
|
++iter \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,7 +33,7 @@ template<class T>
|
|||||||
inline Foam::UList<T>::UList()
|
inline Foam::UList<T>::UList()
|
||||||
:
|
:
|
||||||
size_(0),
|
size_(0),
|
||||||
v_(0)
|
v_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ inline bool Foam::UList<T>::empty() const
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::reverse(UList<T>& ul, const label n)
|
inline void Foam::reverse(UList<T>& ul, const label n)
|
||||||
{
|
{
|
||||||
for (int i=0; i<n/2; i++)
|
for (int i=0; i<n/2; ++i)
|
||||||
{
|
{
|
||||||
Swap(ul[i], ul[n-1-i]);
|
Swap(ul[i], ul[n-1-i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -165,7 +165,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Check list length
|
// Check list length
|
||||||
label s = elems.size();
|
const label s = elems.size();
|
||||||
|
|
||||||
if (s != L.size())
|
if (s != L.size())
|
||||||
{
|
{
|
||||||
@ -174,14 +174,14 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
<< " expected " << L.size()
|
<< " expected " << L.size()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
L[i] = elems[i];
|
L[i] = elems[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (firstToken.isLabel())
|
else if (firstToken.isLabel())
|
||||||
{
|
{
|
||||||
label s = firstToken.labelToken();
|
const label s = firstToken.labelToken();
|
||||||
|
|
||||||
// Set list length to that read
|
// Set list length to that read
|
||||||
if (s != L.size())
|
if (s != L.size())
|
||||||
@ -203,7 +203,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
{
|
{
|
||||||
if (delimiter == token::BEGIN_LIST)
|
if (delimiter == token::BEGIN_LIST)
|
||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
is >> L[i];
|
is >> L[i];
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
"reading the single entry"
|
"reading the single entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
L[i] = element;
|
L[i] = element;
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
(
|
(
|
||||||
typename SLList<T>::const_iterator iter = sll.begin();
|
typename SLList<T>::const_iterator iter = sll.begin();
|
||||||
iter != sll.end();
|
iter != sll.end();
|
||||||
++iter
|
++iter, ++i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
L[i] = iter();
|
L[i] = iter();
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,27 +43,35 @@ static const unsigned char base64Chars[64] =
|
|||||||
//! \endcond
|
//! \endcond
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
std::size_t Foam::base64Layer::encodedLength(std::size_t n)
|
||||||
|
{
|
||||||
|
return 4 * ((n / 3) + (n % 3 ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode0()
|
inline unsigned char Foam::base64Layer::encode0() const
|
||||||
{
|
{
|
||||||
// Top 6 bits of char0
|
// Top 6 bits of char0
|
||||||
return base64Chars[((group_[0] & 0xFC) >> 2)];
|
return base64Chars[((group_[0] & 0xFC) >> 2)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode1()
|
inline unsigned char Foam::base64Layer::encode1() const
|
||||||
{
|
{
|
||||||
// Bottom 2 bits of char0, Top 4 bits of char1
|
// Bottom 2 bits of char0, Top 4 bits of char1
|
||||||
return base64Chars[((group_[0] & 0x03) << 4) | ((group_[1] & 0xF0) >> 4)];
|
return base64Chars[((group_[0] & 0x03) << 4) | ((group_[1] & 0xF0) >> 4)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode2()
|
inline unsigned char Foam::base64Layer::encode2() const
|
||||||
{
|
{
|
||||||
// Bottom 4 bits of char1, Top 2 bits of char2
|
// Bottom 4 bits of char1, Top 2 bits of char2
|
||||||
return base64Chars[((group_[1] & 0x0F) << 2) | ((group_[2] & 0xC0) >> 6)];
|
return base64Chars[((group_[1] & 0x0F) << 2) | ((group_[2] & 0xC0) >> 6)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode3()
|
inline unsigned char Foam::base64Layer::encode3() const
|
||||||
{
|
{
|
||||||
// Bottom 6 bits of char2
|
// Bottom 6 bits of char2
|
||||||
return base64Chars[(group_[2] & 0x3F)];
|
return base64Chars[(group_[2] & 0x3F)];
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,7 +30,7 @@ Description
|
|||||||
Base64 encoding accoding to RFC 4648 specification
|
Base64 encoding accoding to RFC 4648 specification
|
||||||
(https://tools.ietf.org/html/rfc4648#page-5).
|
(https://tools.ietf.org/html/rfc4648#page-5).
|
||||||
It is the obligation of the caller to avoid using normal output
|
It is the obligation of the caller to avoid using normal output
|
||||||
while the base-64 encoding layer is actively being used.
|
while the base-64 encoding layer is actively used.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
base64Layer.C
|
base64Layer.C
|
||||||
@ -70,10 +70,10 @@ class base64Layer
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
inline unsigned char encode0();
|
inline unsigned char encode0() const;
|
||||||
inline unsigned char encode1();
|
inline unsigned char encode1() const;
|
||||||
inline unsigned char encode2();
|
inline unsigned char encode2() const;
|
||||||
inline unsigned char encode3();
|
inline unsigned char encode3() const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
base64Layer(const base64Layer&) = delete;
|
base64Layer(const base64Layer&) = delete;
|
||||||
@ -95,7 +95,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and attach to an output stream
|
//- Construct and attach to an output stream
|
||||||
base64Layer(std::ostream&);
|
base64Layer(std::ostream& os);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -104,6 +104,10 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- The encoded length has 4 bytes out for every 3 bytes in.
|
||||||
|
static std::size_t encodedLength(std::size_t n);
|
||||||
|
|
||||||
|
|
||||||
//- Encode the character sequence, writing when possible.
|
//- Encode the character sequence, writing when possible.
|
||||||
void write(const char* s, std::streamsize n);
|
void write(const char* s, std::streamsize n);
|
||||||
|
|
||||||
@ -111,7 +115,7 @@ public:
|
|||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
//- End the encoding sequence, padding the final characters with '='.
|
//- End the encoding sequence, padding the final characters with '='.
|
||||||
// Return false if no encoding layer was actually used.
|
// Return false if no encoding was actually performed.
|
||||||
bool close();
|
bool close();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -32,7 +32,7 @@ Description
|
|||||||
Note: cannot access the state dictionary until after construction of the
|
Note: cannot access the state dictionary until after construction of the
|
||||||
function objects, since the owner container functionObjectList is owned
|
function objects, since the owner container functionObjectList is owned
|
||||||
by time, and time owns the state dictionary. I.e. need to wait for time
|
by time, and time owns the state dictionary. I.e. need to wait for time
|
||||||
to be fully consttucted.
|
to be fully constructed.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace functionObjects
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class functionObjectFile Declaration
|
Class writeFile Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class writeFile
|
class writeFile
|
||||||
|
|||||||
@ -3,7 +3,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,8 +29,6 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::labelRange::const_iterator Foam::labelRange::endIter_;
|
|
||||||
|
|
||||||
int Foam::labelRange::debug(::Foam::debug::debugSwitch("labelRange", 0));
|
int Foam::labelRange::debug(::Foam::debug::debugSwitch("labelRange", 0));
|
||||||
|
|
||||||
|
|
||||||
@ -47,13 +45,24 @@ Foam::labelRange::labelRange(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::labelRange::intersects
|
void Foam::labelRange::adjust()
|
||||||
(
|
|
||||||
const labelRange& range,
|
|
||||||
const bool touches
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
label final = touches ? 1 : 0;
|
if (start_ < 0)
|
||||||
|
{
|
||||||
|
size_ += start_;
|
||||||
|
start_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size_ < 0)
|
||||||
|
{
|
||||||
|
size_ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::labelRange::overlaps(const labelRange& range, bool touches) const
|
||||||
|
{
|
||||||
|
const label final = touches ? 1 : 0;
|
||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
@ -97,7 +106,7 @@ Foam::labelRange Foam::labelRange::join(const labelRange& range) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::labelRange& Foam::labelRange::operator+=(const labelRange& rhs)
|
void Foam::labelRange::operator+=(const labelRange& rhs)
|
||||||
{
|
{
|
||||||
if (!size_)
|
if (!size_)
|
||||||
{
|
{
|
||||||
@ -112,8 +121,6 @@ Foam::labelRange& Foam::labelRange::operator+=(const labelRange& rhs)
|
|||||||
start_ = lower;
|
start_ = lower;
|
||||||
size_ = upper - lower + 1;
|
size_ = upper - lower + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,10 +134,10 @@ Foam::Istream& Foam::operator>>(Istream& is, labelRange& range)
|
|||||||
|
|
||||||
is.check("operator>>(Istream&, labelRange&)");
|
is.check("operator>>(Istream&, labelRange&)");
|
||||||
|
|
||||||
// disallow invalid sizes
|
// Disallow invalid sizes
|
||||||
if (range.size_ <= 0)
|
if (range.size_ < 0)
|
||||||
{
|
{
|
||||||
range.clear();
|
range.size_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
@ -139,15 +146,11 @@ Foam::Istream& Foam::operator>>(Istream& is, labelRange& range)
|
|||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const labelRange& range)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const labelRange& range)
|
||||||
{
|
{
|
||||||
// write ASCII only for now
|
// Write ASCII only for now
|
||||||
os << token::BEGIN_LIST
|
os << token::BEGIN_LIST
|
||||||
<< range.start_ << token::SPACE << range.size_
|
<< range.start_ << token::SPACE << range.size_
|
||||||
<< token::END_LIST;
|
<< token::END_LIST;
|
||||||
|
|
||||||
// os << token::BEGIN_BLOCK
|
|
||||||
// << range.start_ << "-" << range.last()
|
|
||||||
// << token::END_BLOCK;
|
|
||||||
|
|
||||||
os.check("operator<<(Ostream&, const labelRange&)");
|
os.check("operator<<(Ostream&, const labelRange&)");
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::labelRange
|
Foam::labelRange
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A label range specifier.
|
A range of labels.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
labelRange.C
|
labelRange.C
|
||||||
@ -47,8 +47,8 @@ class Ostream;
|
|||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
class labelRange;
|
class labelRange;
|
||||||
Istream& operator>>(Istream&, labelRange&);
|
Istream& operator>>(Istream& is, labelRange& range);
|
||||||
Ostream& operator<<(Ostream&, const labelRange&);
|
Ostream& operator<<(Ostream& os, const labelRange& range);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class labelRange Declaration
|
Class labelRange Declaration
|
||||||
@ -63,7 +63,7 @@ class labelRange
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static int debug;
|
static int debug;
|
||||||
|
|
||||||
|
|
||||||
// Public classes
|
// Public classes
|
||||||
@ -75,31 +75,50 @@ public:
|
|||||||
|
|
||||||
bool operator()(const labelRange& a, const labelRange& b)
|
bool operator()(const labelRange& a, const labelRange& b)
|
||||||
{
|
{
|
||||||
return a.first() < b.first();
|
return a.operator<(b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct an empty range
|
//- Construct an empty range with zero as start and size.
|
||||||
inline labelRange();
|
inline labelRange();
|
||||||
|
|
||||||
//- Construct a range
|
//- Construct a range from start and size.
|
||||||
// A negative size is autmatically changed to zero.
|
// Optionally adjust the start to avoid any negative indices.
|
||||||
inline labelRange(const label start, const label size);
|
// Always reduce a negative size to zero.
|
||||||
|
inline labelRange
|
||||||
|
(
|
||||||
|
const label start,
|
||||||
|
const label size,
|
||||||
|
const bool adjustStart = false
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from Istream.
|
//- Construct from Istream.
|
||||||
labelRange(Istream&);
|
labelRange(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Reset to zero size
|
//- Alias for setSize(const label)
|
||||||
|
inline void resize(const label n);
|
||||||
|
|
||||||
|
//- Adjust size
|
||||||
|
inline void setSize(const label n);
|
||||||
|
|
||||||
|
//- Reset to zero start and zero size
|
||||||
inline void clear();
|
inline void clear();
|
||||||
|
|
||||||
//- Is the range empty?
|
//- Is the range empty?
|
||||||
inline bool empty() const;
|
inline bool empty() const;
|
||||||
|
|
||||||
|
//- Adjust the start to avoid any negative indices
|
||||||
|
void adjust();
|
||||||
|
|
||||||
|
//- Is the range valid (non-empty)?
|
||||||
|
inline bool valid() const;
|
||||||
|
|
||||||
//- Return the effective size of the range
|
//- Return the effective size of the range
|
||||||
inline label size() const;
|
inline label size() const;
|
||||||
|
|
||||||
@ -109,32 +128,44 @@ public:
|
|||||||
//- The (inclusive) upper value of the range
|
//- The (inclusive) upper value of the range
|
||||||
inline label last() const;
|
inline label last() const;
|
||||||
|
|
||||||
//- Return true if the value is within the range
|
//- Reset start and size.
|
||||||
inline bool contains(const label) const;
|
// Optionally adjust the start to avoid any negative indices.
|
||||||
|
// Always reduce a negative size to zero.
|
||||||
|
// Return true if the updated range valid (non-empty).
|
||||||
|
inline bool reset
|
||||||
|
(
|
||||||
|
const label start,
|
||||||
|
const label size,
|
||||||
|
const bool adjustStart = false
|
||||||
|
);
|
||||||
|
|
||||||
//- Return true if the ranges intersect
|
//- Return true if the value is within the range
|
||||||
|
inline bool contains(const label value) const;
|
||||||
|
|
||||||
|
//- Return true if the ranges overlap.
|
||||||
// Optional test for ranges that also just touch each other
|
// Optional test for ranges that also just touch each other
|
||||||
bool intersects(const labelRange&, const bool touches = false) const;
|
bool overlaps(const labelRange& range, bool touches=false) const;
|
||||||
|
|
||||||
//- Return a joined range, squashing any gaps in between
|
//- Return a joined range, squashing any gaps in between
|
||||||
// A prior intersects() check can be used to avoid squashing gaps.
|
// A prior overlaps() check can be used to avoid squashing gaps.
|
||||||
labelRange join(const labelRange&) const;
|
labelRange join(const labelRange& range) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Return element in range, no bounds checking
|
//- Return element in range, no bounds checking
|
||||||
inline label operator[](const label) const;
|
inline label operator[](const label i) const;
|
||||||
|
|
||||||
//- Comparison function for sorting, compares the start
|
//- Comparison function for sorting, compares the start.
|
||||||
|
// If the start values are equal, also compares the size.
|
||||||
inline bool operator<(const labelRange& rhs) const;
|
inline bool operator<(const labelRange& rhs) const;
|
||||||
|
|
||||||
//- Join ranges, squashing any gaps in between
|
//- Join ranges, squashing any gaps in between
|
||||||
// A prior intersects() check can be used to avoid squashing gaps.
|
// A prior overlaps() check can be used to avoid squashing gaps.
|
||||||
labelRange& operator+=(const labelRange&);
|
void operator+=(const labelRange& rhs);
|
||||||
|
|
||||||
inline bool operator==(const labelRange&) const;
|
inline bool operator==(const labelRange& rhs) const;
|
||||||
inline bool operator!=(const labelRange&) const;
|
inline bool operator!=(const labelRange& rhs) const;
|
||||||
|
|
||||||
|
|
||||||
// STL iterator
|
// STL iterator
|
||||||
@ -142,6 +173,8 @@ public:
|
|||||||
//- An STL const_iterator
|
//- An STL const_iterator
|
||||||
class const_iterator
|
class const_iterator
|
||||||
{
|
{
|
||||||
|
friend class labelRange;
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the range for which this is an iterator
|
//- Reference to the range for which this is an iterator
|
||||||
@ -150,54 +183,48 @@ public:
|
|||||||
//- Current index
|
//- Current index
|
||||||
label index_;
|
label index_;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null - equivalent to an 'end' position
|
//- Construct from range at 'begin' or 'end' position
|
||||||
inline const_iterator();
|
inline const_iterator
|
||||||
|
(
|
||||||
//- Construct from range, moving to its 'begin' position
|
const labelRange& range,
|
||||||
inline explicit const_iterator(const labelRange&);
|
const bool endIter = false
|
||||||
|
);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
inline bool operator==(const const_iterator&) const;
|
inline bool operator==(const const_iterator& iter) const;
|
||||||
|
inline bool operator!=(const const_iterator& iter) const;
|
||||||
|
|
||||||
inline bool operator!=(const const_iterator&) const;
|
inline label operator*() const;
|
||||||
|
inline label operator()() const;
|
||||||
inline label operator*();
|
|
||||||
inline label operator()();
|
|
||||||
|
|
||||||
inline const_iterator& operator++();
|
inline const_iterator& operator++();
|
||||||
inline const_iterator operator++(int);
|
inline const_iterator operator++(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- const_iterator set to the beginning of the range
|
//- A const_iterator set to the beginning of the range
|
||||||
inline const_iterator cbegin() const;
|
inline const_iterator cbegin() const;
|
||||||
|
|
||||||
//- const_iterator set to beyond the end of the range
|
//- A const_iterator set to beyond the end of the range
|
||||||
inline const const_iterator& cend() const;
|
inline const const_iterator cend() const;
|
||||||
|
|
||||||
//- const_iterator set to the beginning of the range
|
//- A const_iterator set to the beginning of the range
|
||||||
inline const_iterator begin() const;
|
inline const_iterator begin() const;
|
||||||
|
|
||||||
//- const_iterator set to beyond the end of the range
|
//- A const_iterator set to beyond the end of the range
|
||||||
inline const const_iterator& end() const;
|
inline const const_iterator end() const;
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Istream& operator>>(Istream&, labelRange&);
|
friend Istream& operator>>(Istream& is, labelRange& range);
|
||||||
friend Ostream& operator<<(Ostream&, const labelRange&);
|
friend Ostream& operator<<(Ostream& os, const labelRange& range);
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//- const_iterator returned by end(), cend()
|
|
||||||
static const const_iterator endIter_;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,32 +33,39 @@ inline Foam::labelRange::labelRange()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::labelRange::labelRange(const label start, const label size)
|
inline Foam::labelRange::labelRange
|
||||||
|
(
|
||||||
|
const label start,
|
||||||
|
const label size,
|
||||||
|
const bool adjustStart
|
||||||
|
)
|
||||||
:
|
:
|
||||||
start_(start),
|
start_(start),
|
||||||
size_(size)
|
size_(size)
|
||||||
{
|
{
|
||||||
// disallow invalid sizes
|
if (adjustStart)
|
||||||
if (size_ <= 0)
|
|
||||||
{
|
{
|
||||||
this->clear();
|
// Disallow invalid indices and sizes
|
||||||
|
adjust();
|
||||||
|
}
|
||||||
|
else if (size_ < 0)
|
||||||
|
{
|
||||||
|
// Disallow invalid sizes
|
||||||
|
size_ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::labelRange::const_iterator::const_iterator()
|
inline Foam::labelRange::const_iterator::const_iterator
|
||||||
:
|
(
|
||||||
range_(*reinterpret_cast<Foam::labelRange* >(0)),
|
const labelRange& range,
|
||||||
index_(-1)
|
const bool endIter
|
||||||
{}
|
)
|
||||||
|
|
||||||
|
|
||||||
inline Foam::labelRange::const_iterator::const_iterator(const labelRange& range)
|
|
||||||
:
|
:
|
||||||
range_(range),
|
range_(range),
|
||||||
index_(range_.empty() ? -1 : 0)
|
index_(endIter ? range_.size() : 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -76,17 +83,17 @@ inline bool Foam::labelRange::const_iterator::operator!=
|
|||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return !(this->operator==(iter));
|
return (this->index_ != iter.index_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::labelRange::const_iterator::operator*()
|
inline Foam::label Foam::labelRange::const_iterator::operator*() const
|
||||||
{
|
{
|
||||||
return range_[index_];
|
return range_[index_];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::labelRange::const_iterator::operator()()
|
inline Foam::label Foam::labelRange::const_iterator::operator()() const
|
||||||
{
|
{
|
||||||
return range_[index_];
|
return range_[index_];
|
||||||
}
|
}
|
||||||
@ -95,12 +102,7 @@ inline Foam::label Foam::labelRange::const_iterator::operator()()
|
|||||||
inline Foam::labelRange::const_iterator&
|
inline Foam::labelRange::const_iterator&
|
||||||
Foam::labelRange::const_iterator::operator++()
|
Foam::labelRange::const_iterator::operator++()
|
||||||
{
|
{
|
||||||
if (++index_ >= range_.size())
|
++index_;
|
||||||
{
|
|
||||||
// equivalent to end iterator
|
|
||||||
index_ = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +111,7 @@ inline Foam::labelRange::const_iterator
|
|||||||
Foam::labelRange::const_iterator::operator++(int)
|
Foam::labelRange::const_iterator::operator++(int)
|
||||||
{
|
{
|
||||||
const_iterator old = *this;
|
const_iterator old = *this;
|
||||||
this->operator++();
|
++index_;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +122,9 @@ inline Foam::labelRange::const_iterator Foam::labelRange::cbegin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::labelRange::const_iterator& Foam::labelRange::cend() const
|
inline const Foam::labelRange::const_iterator Foam::labelRange::cend() const
|
||||||
{
|
{
|
||||||
return endIter_;
|
return const_iterator(*this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,14 +134,31 @@ inline Foam::labelRange::const_iterator Foam::labelRange::begin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::labelRange::const_iterator& Foam::labelRange::end() const
|
inline const Foam::labelRange::const_iterator Foam::labelRange::end() const
|
||||||
{
|
{
|
||||||
return endIter_;
|
return const_iterator(*this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline void Foam::labelRange::resize(const label n)
|
||||||
|
{
|
||||||
|
setSize(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::labelRange::setSize(const label n)
|
||||||
|
{
|
||||||
|
size_ = n;
|
||||||
|
|
||||||
|
if (size_ < 0)
|
||||||
|
{
|
||||||
|
size_ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::labelRange::clear()
|
inline void Foam::labelRange::clear()
|
||||||
{
|
{
|
||||||
start_ = size_ = 0;
|
start_ = size_ = 0;
|
||||||
@ -152,6 +171,12 @@ inline bool Foam::labelRange::empty() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::labelRange::valid() const
|
||||||
|
{
|
||||||
|
return size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::labelRange::size() const
|
inline Foam::label Foam::labelRange::size() const
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
@ -170,6 +195,31 @@ inline Foam::label Foam::labelRange::last() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::labelRange::reset
|
||||||
|
(
|
||||||
|
const label start,
|
||||||
|
const label size,
|
||||||
|
const bool adjustStart
|
||||||
|
)
|
||||||
|
{
|
||||||
|
start_ = start;
|
||||||
|
size_ = size;
|
||||||
|
|
||||||
|
if (adjustStart)
|
||||||
|
{
|
||||||
|
// Disallow invalid indices and sizes
|
||||||
|
adjust();
|
||||||
|
}
|
||||||
|
else if (size_ < 0)
|
||||||
|
{
|
||||||
|
// Disallow invalid sizes
|
||||||
|
size_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::labelRange::contains(const label value) const
|
inline bool Foam::labelRange::contains(const label value) const
|
||||||
{
|
{
|
||||||
return value >= this->first() && value <= this->last();
|
return value >= this->first() && value <= this->last();
|
||||||
@ -186,7 +236,11 @@ inline Foam::label Foam::labelRange::operator[](const label i) const
|
|||||||
|
|
||||||
inline bool Foam::labelRange::operator<(const labelRange& rhs) const
|
inline bool Foam::labelRange::operator<(const labelRange& rhs) const
|
||||||
{
|
{
|
||||||
return this->first() < rhs.first();
|
return
|
||||||
|
(
|
||||||
|
this->first() < rhs.first()
|
||||||
|
|| (this->first() == rhs.first() && this->size() < rhs.size())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,11 +26,6 @@ License
|
|||||||
#include "labelRanges.H"
|
#include "labelRanges.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
const Foam::labelRanges::const_iterator Foam::labelRanges::endIter_;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::labelRanges::insertBefore
|
void Foam::labelRanges::insertBefore
|
||||||
@ -141,7 +136,7 @@ bool Foam::labelRanges::add(const labelRange& range)
|
|||||||
{
|
{
|
||||||
labelRange& currRange = ParentType::operator[](elemI);
|
labelRange& currRange = ParentType::operator[](elemI);
|
||||||
|
|
||||||
if (currRange.intersects(range, true))
|
if (currRange.overlaps(range, true))
|
||||||
{
|
{
|
||||||
// absorb into the existing (adjacent/overlapping) range
|
// absorb into the existing (adjacent/overlapping) range
|
||||||
currRange += range;
|
currRange += range;
|
||||||
@ -150,7 +145,7 @@ bool Foam::labelRanges::add(const labelRange& range)
|
|||||||
for (; elemI < this->size()-1; ++elemI)
|
for (; elemI < this->size()-1; ++elemI)
|
||||||
{
|
{
|
||||||
labelRange& nextRange = ParentType::operator[](elemI+1);
|
labelRange& nextRange = ParentType::operator[](elemI+1);
|
||||||
if (currRange.intersects(nextRange, true))
|
if (currRange.overlaps(nextRange, true))
|
||||||
{
|
{
|
||||||
currRange += nextRange;
|
currRange += nextRange;
|
||||||
nextRange.clear();
|
nextRange.clear();
|
||||||
|
|||||||
@ -3,7 +3,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,8 +49,8 @@ class Ostream;
|
|||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
class labelRanges;
|
class labelRanges;
|
||||||
Istream& operator>>(Istream&, labelRanges&);
|
Istream& operator>>(Istream& is, labelRanges& ranges);
|
||||||
Ostream& operator<<(Ostream&, const labelRanges&);
|
Ostream& operator<<(Ostream& is, const labelRanges& ranges);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class labelRanges Declaration
|
Class labelRanges Declaration
|
||||||
@ -68,13 +68,13 @@ class labelRanges
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Insert range before specified insertion index, by copying up
|
//- Insert range before specified insertion index, by copying up
|
||||||
void insertBefore(const label, const labelRange&);
|
void insertBefore(const label insert, const labelRange& range);
|
||||||
|
|
||||||
//- Purge empty ranges, by copying down
|
//- Purge empty ranges, by copying down
|
||||||
void purgeEmpty();
|
void purgeEmpty();
|
||||||
|
|
||||||
//- Print the range for debugging purposes
|
//- Print the range for debugging purposes
|
||||||
Ostream& printRange(Ostream&, const labelRange&) const;
|
Ostream& printRange(Ostream& os, const labelRange& range) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -85,10 +85,10 @@ public:
|
|||||||
inline labelRanges();
|
inline labelRanges();
|
||||||
|
|
||||||
//- Construct given size
|
//- Construct given size
|
||||||
inline explicit labelRanges(const label);
|
inline explicit labelRanges(const label nElem);
|
||||||
|
|
||||||
//- Construct from Istream.
|
//- Construct from Istream.
|
||||||
labelRanges(Istream&);
|
labelRanges(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -100,19 +100,22 @@ public:
|
|||||||
using DynamicList<labelRange>::empty;
|
using DynamicList<labelRange>::empty;
|
||||||
|
|
||||||
//- Return true if the value is within any of the ranges
|
//- Return true if the value is within any of the ranges
|
||||||
inline bool contains(const label) const;
|
inline bool contains(const label value) const;
|
||||||
|
|
||||||
//- Add the range to the list
|
//- Add the range to the list
|
||||||
bool add(const labelRange&);
|
bool add(const labelRange& range);
|
||||||
|
|
||||||
//- Remove the range from the list
|
//- Remove the range from the list
|
||||||
bool remove(const labelRange&);
|
bool remove(const labelRange& range);
|
||||||
|
|
||||||
|
|
||||||
// STL iterator
|
// STL iterator
|
||||||
|
|
||||||
//- An STL const_iterator
|
//- An STL const_iterator
|
||||||
class const_iterator
|
class const_iterator
|
||||||
{
|
{
|
||||||
|
friend class labelRanges;
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the list for which this is an iterator
|
//- Reference to the list for which this is an iterator
|
||||||
@ -124,22 +127,21 @@ public:
|
|||||||
//- Index of current element at listIndex
|
//- Index of current element at listIndex
|
||||||
label subIndex_;
|
label subIndex_;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null - equivalent to an 'end' position
|
//- Construct from ranges at 'begin' or 'end' position
|
||||||
inline const_iterator();
|
inline const_iterator
|
||||||
|
(
|
||||||
//- Construct from list, moving to its 'begin' position
|
const labelRanges& lst,
|
||||||
inline explicit const_iterator(const labelRanges&);
|
const bool endIter = false
|
||||||
|
);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
inline bool operator==(const const_iterator&) const;
|
inline bool operator==(const const_iterator& iter) const;
|
||||||
|
inline bool operator!=(const const_iterator& iter) const;
|
||||||
inline bool operator!=(const const_iterator&) const;
|
|
||||||
|
|
||||||
inline label operator*();
|
inline label operator*();
|
||||||
inline label operator()();
|
inline label operator()();
|
||||||
@ -149,29 +151,23 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- const_iterator set to the beginning of the list
|
//- A const_iterator set to the beginning of the list
|
||||||
inline const_iterator cbegin() const;
|
inline const_iterator cbegin() const;
|
||||||
|
|
||||||
//- const_iterator set to beyond the end of the list
|
//- A const_iterator set to beyond the end of the list
|
||||||
inline const const_iterator& cend() const;
|
inline const const_iterator cend() const;
|
||||||
|
|
||||||
//- const_iterator set to the beginning of the list
|
//- A const_iterator set to the beginning of the list
|
||||||
inline const_iterator begin() const;
|
inline const_iterator begin() const;
|
||||||
|
|
||||||
//- const_iterator set to beyond the end of the list
|
//- A const_iterator set to beyond the end of the list
|
||||||
inline const const_iterator& end() const;
|
inline const const_iterator end() const;
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Istream& operator>>(Istream&, labelRanges&);
|
friend Istream& operator>>(Istream& is, labelRanges& ranges);
|
||||||
friend Ostream& operator<<(Ostream&, const labelRanges&);
|
friend Ostream& operator<<(Ostream& os, const labelRanges& ranges);
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//- const_iterator returned by end(), cend()
|
|
||||||
static const const_iterator endIter_;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,28 +40,18 @@ inline Foam::labelRanges::labelRanges(const label nElem)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::labelRanges::const_iterator::const_iterator()
|
inline Foam::labelRanges::const_iterator::const_iterator
|
||||||
|
(
|
||||||
|
const labelRanges& lst,
|
||||||
|
const bool endIter
|
||||||
|
)
|
||||||
:
|
:
|
||||||
list_(*reinterpret_cast<Foam::labelRanges* >(0)),
|
list_(lst),
|
||||||
index_(-1),
|
index_(endIter ? lst.size() : 0),
|
||||||
subIndex_(-1)
|
subIndex_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::labelRanges::const_iterator::const_iterator(const labelRanges& lst)
|
|
||||||
:
|
|
||||||
list_(lst),
|
|
||||||
index_(0),
|
|
||||||
subIndex_(0)
|
|
||||||
{
|
|
||||||
if (list_.empty())
|
|
||||||
{
|
|
||||||
// equivalent to end iterator
|
|
||||||
index_ = subIndex_ = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::labelRanges::const_iterator::operator==
|
inline bool Foam::labelRanges::const_iterator::operator==
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
@ -69,7 +59,7 @@ inline bool Foam::labelRanges::const_iterator::operator==
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
this->index_ == iter.index_
|
this->index_ == iter.index_
|
||||||
&& this->subIndex_ == iter.subIndex_
|
&& this->subIndex_ == iter.subIndex_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -101,13 +91,9 @@ Foam::labelRanges::const_iterator::operator++()
|
|||||||
{
|
{
|
||||||
if (++subIndex_ >= list_[index_].size())
|
if (++subIndex_ >= list_[index_].size())
|
||||||
{
|
{
|
||||||
// go to next list entry
|
// Next sub-list
|
||||||
|
++index_;
|
||||||
subIndex_ = 0;
|
subIndex_ = 0;
|
||||||
if (++index_ >= list_.size())
|
|
||||||
{
|
|
||||||
// equivalent to end iterator
|
|
||||||
index_ = subIndex_ = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -129,9 +115,9 @@ inline Foam::labelRanges::const_iterator Foam::labelRanges::cbegin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::labelRanges::const_iterator& Foam::labelRanges::cend() const
|
inline const Foam::labelRanges::const_iterator Foam::labelRanges::cend() const
|
||||||
{
|
{
|
||||||
return endIter_;
|
return const_iterator(*this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,9 +127,9 @@ inline Foam::labelRanges::const_iterator Foam::labelRanges::begin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::labelRanges::const_iterator& Foam::labelRanges::end() const
|
inline const Foam::labelRanges::const_iterator Foam::labelRanges::end() const
|
||||||
{
|
{
|
||||||
return endIter_;
|
return const_iterator(*this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -326,7 +326,7 @@ void Foam::foamVtkCells::correct()
|
|||||||
nAddVerts += 5;
|
nAddVerts += 5;
|
||||||
|
|
||||||
vertOffset_[celLoc] = nAddVerts;
|
vertOffset_[celLoc] = nAddVerts;
|
||||||
decompose_.superCells_[nAddCells++] = celLoc;
|
decompose_.superCells_[nAddCells++] = cellI;
|
||||||
}
|
}
|
||||||
|
|
||||||
cellTypes_[celLoc] = foamVtkCore::VTK_PYRAMID;
|
cellTypes_[celLoc] = foamVtkCore::VTK_PYRAMID;
|
||||||
@ -373,7 +373,7 @@ void Foam::foamVtkCells::correct()
|
|||||||
nAddVerts += 4;
|
nAddVerts += 4;
|
||||||
|
|
||||||
vertOffset_[celLoc] = nAddVerts;
|
vertOffset_[celLoc] = nAddVerts;
|
||||||
decompose_.superCells_[nAddCells++] = celLoc;
|
decompose_.superCells_[nAddCells++] = cellI;
|
||||||
}
|
}
|
||||||
|
|
||||||
cellTypes_[celLoc] = foamVtkCore::VTK_TETRA;
|
cellTypes_[celLoc] = foamVtkCore::VTK_TETRA;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ vtk/format/foamVtkAppendBase64Formatter.C
|
|||||||
vtk/format/foamVtkAppendRawFormatter.C
|
vtk/format/foamVtkAppendRawFormatter.C
|
||||||
vtk/format/foamVtkAsciiFormatter.C
|
vtk/format/foamVtkAsciiFormatter.C
|
||||||
vtk/format/foamVtkBase64Formatter.C
|
vtk/format/foamVtkBase64Formatter.C
|
||||||
|
vtk/format/foamVtkBase64Layer.C
|
||||||
vtk/format/foamVtkLegacyFormatter.C
|
vtk/format/foamVtkLegacyFormatter.C
|
||||||
vtk/format/foamVtkFormatter.C
|
vtk/format/foamVtkFormatter.C
|
||||||
vtk/format/foamVtkOutputOptions.C
|
vtk/format/foamVtkOutputOptions.C
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -27,8 +27,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const char* Foam::foamVtkAppendBase64Formatter::name_ = "append";
|
const char* Foam::foamVtkAppendBase64Formatter::name_ = "append";
|
||||||
const char* Foam::foamVtkAppendBase64Formatter::encoding_ = "base64";
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -38,14 +37,16 @@ Foam::foamVtkAppendBase64Formatter::foamVtkAppendBase64Formatter
|
|||||||
std::ostream& os
|
std::ostream& os
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
foamVtkBase64Formatter(os)
|
foamVtkBase64Layer(os)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::foamVtkAppendBase64Formatter::~foamVtkAppendBase64Formatter()
|
Foam::foamVtkAppendBase64Formatter::~foamVtkAppendBase64Formatter()
|
||||||
{}
|
{
|
||||||
|
base64Layer::close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
@ -56,10 +57,4 @@ const char* Foam::foamVtkAppendBase64Formatter::name() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* Foam::foamVtkAppendBase64Formatter::encoding() const
|
|
||||||
{
|
|
||||||
return encoding_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#ifndef foamVtkAppendBase64Formatter_H
|
#ifndef foamVtkAppendBase64Formatter_H
|
||||||
#define foamVtkAppendBase64Formatter_H
|
#define foamVtkAppendBase64Formatter_H
|
||||||
|
|
||||||
#include "foamVtkBase64Formatter.H"
|
#include "foamVtkBase64Layer.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -49,12 +49,11 @@ namespace Foam
|
|||||||
|
|
||||||
class foamVtkAppendBase64Formatter
|
class foamVtkAppendBase64Formatter
|
||||||
:
|
:
|
||||||
public foamVtkBase64Formatter
|
public foamVtkBase64Layer
|
||||||
{
|
{
|
||||||
// Private Data Members
|
// Private Data Members
|
||||||
|
|
||||||
static const char* name_;
|
static const char* name_;
|
||||||
static const char* encoding_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -71,7 +70,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and attach to an output stream
|
//- Construct and attach to an output stream
|
||||||
foamVtkAppendBase64Formatter(std::ostream&);
|
foamVtkAppendBase64Formatter(std::ostream& os);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -83,9 +82,6 @@ public:
|
|||||||
//- Output name for XML type ("append")
|
//- Output name for XML type ("append")
|
||||||
virtual const char* name() const;
|
virtual const char* name() const;
|
||||||
|
|
||||||
//- Name for the XML append encoding ("base64").
|
|
||||||
virtual const char* encoding() const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -71,9 +71,9 @@ const char* Foam::foamVtkAppendRawFormatter::encoding() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkAppendRawFormatter::writeSize(const uint64_t val)
|
void Foam::foamVtkAppendRawFormatter::writeSize(const uint64_t nBytes)
|
||||||
{
|
{
|
||||||
write(reinterpret_cast<const char*>(&val), sizeof(uint64_t));
|
write(reinterpret_cast<const char*>(&nBytes), sizeof(uint64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,28 +85,28 @@ void Foam::foamVtkAppendRawFormatter::write(const uint8_t val)
|
|||||||
|
|
||||||
void Foam::foamVtkAppendRawFormatter::write(const label val)
|
void Foam::foamVtkAppendRawFormatter::write(const label val)
|
||||||
{
|
{
|
||||||
// std::cerr<<"label is:" << sizeof(val) << '\n';
|
// std::cerr<<"label:" << sizeof(val) << "=" << val << '\n';
|
||||||
write(reinterpret_cast<const char*>(&val), sizeof(label));
|
write(reinterpret_cast<const char*>(&val), sizeof(label));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkAppendRawFormatter::write(const float val)
|
void Foam::foamVtkAppendRawFormatter::write(const float val)
|
||||||
{
|
{
|
||||||
// std::cerr<<"float is:" << sizeof(val) << '\n';
|
// std::cerr<<"float:" << sizeof(val) << "=" << val << '\n';
|
||||||
write(reinterpret_cast<const char*>(&val), sizeof(float));
|
write(reinterpret_cast<const char*>(&val), sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkAppendRawFormatter::write(const double val)
|
void Foam::foamVtkAppendRawFormatter::write(const double val)
|
||||||
{
|
{
|
||||||
// std::cerr<<"write double as float:" << val << '\n';
|
// std::cerr<<"double as float=" << val << '\n';
|
||||||
float copy(val);
|
float copy(val);
|
||||||
write(copy);
|
write(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkAppendRawFormatter::flush()
|
void Foam::foamVtkAppendRawFormatter::flush()
|
||||||
{}
|
{/*nop*/}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and attach to an output stream
|
//- Construct and attach to an output stream
|
||||||
foamVtkAppendRawFormatter(std::ostream&);
|
foamVtkAppendRawFormatter(std::ostream& os);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -94,12 +94,14 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Write leading size for binary output
|
//- Write leading size for binary output
|
||||||
virtual void writeSize(const uint64_t);
|
virtual void writeSize(const uint64_t nBytes);
|
||||||
|
|
||||||
virtual void write(const uint8_t);
|
virtual void write(const uint8_t val);
|
||||||
virtual void write(const label);
|
virtual void write(const label val);
|
||||||
virtual void write(const float);
|
virtual void write(const float val);
|
||||||
virtual void write(const double);
|
virtual void write(const double val);
|
||||||
|
|
||||||
|
//- A no-op for this format
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -47,6 +47,16 @@ inline void Foam::foamVtkAsciiFormatter::next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::foamVtkAsciiFormatter::done()
|
||||||
|
{
|
||||||
|
if (pos_)
|
||||||
|
{
|
||||||
|
os()<< '\n';
|
||||||
|
}
|
||||||
|
pos_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::foamVtkAsciiFormatter::foamVtkAsciiFormatter(std::ostream& os)
|
Foam::foamVtkAsciiFormatter::foamVtkAsciiFormatter(std::ostream& os)
|
||||||
@ -73,7 +83,7 @@ Foam::foamVtkAsciiFormatter::foamVtkAsciiFormatter
|
|||||||
|
|
||||||
Foam::foamVtkAsciiFormatter::~foamVtkAsciiFormatter()
|
Foam::foamVtkAsciiFormatter::~foamVtkAsciiFormatter()
|
||||||
{
|
{
|
||||||
flush();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +101,7 @@ const char* Foam::foamVtkAsciiFormatter::encoding() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkAsciiFormatter::writeSize(const uint64_t)
|
void Foam::foamVtkAsciiFormatter::writeSize(const uint64_t ignored)
|
||||||
{/*nop*/}
|
{/*nop*/}
|
||||||
|
|
||||||
|
|
||||||
@ -125,11 +135,14 @@ void Foam::foamVtkAsciiFormatter::write(const double val)
|
|||||||
|
|
||||||
void Foam::foamVtkAsciiFormatter::flush()
|
void Foam::foamVtkAsciiFormatter::flush()
|
||||||
{
|
{
|
||||||
if (pos_)
|
done();
|
||||||
{
|
}
|
||||||
os()<< '\n';
|
|
||||||
}
|
|
||||||
pos_ = 0;
|
std::size_t
|
||||||
|
Foam::foamVtkAsciiFormatter::encodedLength(std::size_t ignored) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -62,9 +62,12 @@ class foamVtkAsciiFormatter
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Advance to next position, adding space or newline as required
|
//- Advance to next position, adding space or newline as needed
|
||||||
inline void next();
|
inline void next();
|
||||||
|
|
||||||
|
//- Finish an output line, adding newline as needed
|
||||||
|
inline void done();
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
foamVtkAsciiFormatter(const foamVtkAsciiFormatter&) = delete;
|
foamVtkAsciiFormatter(const foamVtkAsciiFormatter&) = delete;
|
||||||
@ -78,10 +81,10 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and attach to an output stream, use default precision
|
//- Construct and attach to an output stream, use default precision
|
||||||
foamVtkAsciiFormatter(std::ostream&);
|
foamVtkAsciiFormatter(std::ostream& os);
|
||||||
|
|
||||||
//- Construct and attach to an output stream, use specified precision
|
//- Construct and attach to an output stream, use specified precision
|
||||||
foamVtkAsciiFormatter(std::ostream&, unsigned precision);
|
foamVtkAsciiFormatter(std::ostream& os, unsigned precision);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -95,18 +98,24 @@ public:
|
|||||||
virtual const char* name() const;
|
virtual const char* name() const;
|
||||||
|
|
||||||
//- Name for the XML append encoding - unused.
|
//- Name for the XML append encoding - unused.
|
||||||
// Currently simply "ASCII", but this should not be relied upon.
|
// Currently identical to name(), but do not rely on this.
|
||||||
virtual const char* encoding() const;
|
virtual const char* encoding() const;
|
||||||
|
|
||||||
|
|
||||||
//- Write leading size - this is a no-op for ascii output
|
//- Write leading size - this is a no-op for ascii output
|
||||||
virtual void writeSize(const uint64_t);
|
virtual void writeSize(const uint64_t ignored);
|
||||||
|
|
||||||
virtual void write(const uint8_t);
|
virtual void write(const uint8_t val);
|
||||||
virtual void write(const label);
|
virtual void write(const label val);
|
||||||
virtual void write(const float);
|
virtual void write(const float val);
|
||||||
virtual void write(const double);
|
virtual void write(const double val);
|
||||||
|
|
||||||
|
//- Write a newline if needed to finish a line of output.
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
|
//- The encoded length for ascii output is not applicable.
|
||||||
|
virtual std::size_t encodedLength(std::size_t ignored) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -27,28 +27,14 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const char* Foam::foamVtkBase64Formatter::name_ = "binary";
|
const char* Foam::foamVtkBase64Formatter::name_ = "binary";
|
||||||
const char* Foam::foamVtkBase64Formatter::encoding_ = "base64";
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::foamVtkBase64Formatter::write
|
|
||||||
(
|
|
||||||
const char* s,
|
|
||||||
std::streamsize n
|
|
||||||
)
|
|
||||||
{
|
|
||||||
base64Layer::write(s, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::foamVtkBase64Formatter::foamVtkBase64Formatter(std::ostream& os)
|
Foam::foamVtkBase64Formatter::foamVtkBase64Formatter(std::ostream& os)
|
||||||
:
|
:
|
||||||
foamVtkFormatter(os),
|
foamVtkBase64Layer(os)
|
||||||
base64Layer(os)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +42,10 @@ Foam::foamVtkBase64Formatter::foamVtkBase64Formatter(std::ostream& os)
|
|||||||
|
|
||||||
Foam::foamVtkBase64Formatter::~foamVtkBase64Formatter()
|
Foam::foamVtkBase64Formatter::~foamVtkBase64Formatter()
|
||||||
{
|
{
|
||||||
flush();
|
if (base64Layer::close())
|
||||||
|
{
|
||||||
|
os().put('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,46 +57,6 @@ const char* Foam::foamVtkBase64Formatter::name() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* Foam::foamVtkBase64Formatter::encoding() const
|
|
||||||
{
|
|
||||||
return encoding_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkBase64Formatter::writeSize(const uint64_t val)
|
|
||||||
{
|
|
||||||
write(reinterpret_cast<const char*>(&val), sizeof(uint64_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkBase64Formatter::write(const uint8_t val)
|
|
||||||
{
|
|
||||||
base64Layer::add(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkBase64Formatter::write(const label val)
|
|
||||||
{
|
|
||||||
// std::cerr<<"label is:" << sizeof(val) << '\n';
|
|
||||||
write(reinterpret_cast<const char*>(&val), sizeof(label));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkBase64Formatter::write(const float val)
|
|
||||||
{
|
|
||||||
// std::cerr<<"float is:" << sizeof(val) << '\n';
|
|
||||||
write(reinterpret_cast<const char*>(&val), sizeof(float));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkBase64Formatter::write(const double val)
|
|
||||||
{
|
|
||||||
// std::cerr<<"write double as float:" << val << '\n';
|
|
||||||
float copy(val);
|
|
||||||
write(copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkBase64Formatter::flush()
|
void Foam::foamVtkBase64Formatter::flush()
|
||||||
{
|
{
|
||||||
if (base64Layer::close())
|
if (base64Layer::close())
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -33,8 +33,7 @@ Description
|
|||||||
#ifndef foamVtkBase64Formatter_H
|
#ifndef foamVtkBase64Formatter_H
|
||||||
#define foamVtkBase64Formatter_H
|
#define foamVtkBase64Formatter_H
|
||||||
|
|
||||||
#include "foamVtkFormatter.H"
|
#include "foamVtkBase64Layer.H"
|
||||||
#include "base64Layer.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,8 +46,7 @@ namespace Foam
|
|||||||
|
|
||||||
class foamVtkBase64Formatter
|
class foamVtkBase64Formatter
|
||||||
:
|
:
|
||||||
public foamVtkFormatter,
|
public foamVtkBase64Layer
|
||||||
private base64Layer
|
|
||||||
{
|
{
|
||||||
// Private Data Members
|
// Private Data Members
|
||||||
|
|
||||||
@ -64,20 +62,12 @@ class foamVtkBase64Formatter
|
|||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const foamVtkBase64Formatter&) = delete;
|
void operator=(const foamVtkBase64Formatter&) = delete;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected Member Functions
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
void write(const char* s, std::streamsize n);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and attach to an output stream
|
//- Construct and attach to an output stream
|
||||||
foamVtkBase64Formatter(std::ostream&);
|
foamVtkBase64Formatter(std::ostream& os);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -90,17 +80,9 @@ public:
|
|||||||
// The lowercase version of the Legacy output type.
|
// The lowercase version of the Legacy output type.
|
||||||
virtual const char* name() const;
|
virtual const char* name() const;
|
||||||
|
|
||||||
//- Name for the XML append encoding.
|
|
||||||
virtual const char* encoding() const;
|
|
||||||
|
|
||||||
|
//- End the encoding sequence (padding the final characters with '=')
|
||||||
//- Write leading size for binary output
|
// and write a newline to the output if any encoding was done.
|
||||||
virtual void writeSize(const uint64_t);
|
|
||||||
|
|
||||||
virtual void write(const uint8_t);
|
|
||||||
virtual void write(const label);
|
|
||||||
virtual void write(const float);
|
|
||||||
virtual void write(const double);
|
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
116
src/fileFormats/vtk/format/foamVtkBase64Layer.C
Normal file
116
src/fileFormats/vtk/format/foamVtkBase64Layer.C
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "foamVtkBase64Layer.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const char* Foam::foamVtkBase64Layer::encoding_ = "base64";
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::foamVtkBase64Layer::write
|
||||||
|
(
|
||||||
|
const char* s,
|
||||||
|
std::streamsize n
|
||||||
|
)
|
||||||
|
{
|
||||||
|
base64Layer::write(s, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::foamVtkBase64Layer::foamVtkBase64Layer(std::ostream& os)
|
||||||
|
:
|
||||||
|
foamVtkFormatter(os),
|
||||||
|
base64Layer(os)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::foamVtkBase64Layer::~foamVtkBase64Layer()
|
||||||
|
{
|
||||||
|
base64Layer::close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const char* Foam::foamVtkBase64Layer::encoding() const
|
||||||
|
{
|
||||||
|
return encoding_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::foamVtkBase64Layer::writeSize(const uint64_t nBytes)
|
||||||
|
{
|
||||||
|
write(reinterpret_cast<const char*>(&nBytes), sizeof(uint64_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::foamVtkBase64Layer::write(const uint8_t val)
|
||||||
|
{
|
||||||
|
base64Layer::add(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::foamVtkBase64Layer::write(const label val)
|
||||||
|
{
|
||||||
|
// std::cerr<<"label:" << sizeof(val) << "=" << val << '\n';
|
||||||
|
write(reinterpret_cast<const char*>(&val), sizeof(label));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::foamVtkBase64Layer::write(const float val)
|
||||||
|
{
|
||||||
|
// std::cerr<<"float:" << sizeof(val) << "=" << val << '\n';
|
||||||
|
write(reinterpret_cast<const char*>(&val), sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::foamVtkBase64Layer::write(const double val)
|
||||||
|
{
|
||||||
|
// std::cerr<<"double as float=" << val << '\n';
|
||||||
|
float copy(val);
|
||||||
|
write(copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::foamVtkBase64Layer::flush()
|
||||||
|
{
|
||||||
|
base64Layer::close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::size_t Foam::foamVtkBase64Layer::encodedLength(std::size_t n) const
|
||||||
|
{
|
||||||
|
return base64Layer::encodedLength(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
114
src/fileFormats/vtk/format/foamVtkBase64Layer.H
Normal file
114
src/fileFormats/vtk/format/foamVtkBase64Layer.H
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
\\/ 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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
foamVtkBase64Layer
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base-64 encoded output.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef foamVtkBase64Layer_H
|
||||||
|
#define foamVtkBase64Layer_H
|
||||||
|
|
||||||
|
#include "foamVtkFormatter.H"
|
||||||
|
#include "base64Layer.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class foamVtkBase64Layer Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class foamVtkBase64Layer
|
||||||
|
:
|
||||||
|
public foamVtkFormatter,
|
||||||
|
protected base64Layer
|
||||||
|
{
|
||||||
|
// Private Data Members
|
||||||
|
|
||||||
|
static const char* encoding_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
foamVtkBase64Layer(const foamVtkBase64Layer&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const foamVtkBase64Layer&) = delete;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
void write(const char* s, std::streamsize n);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct and attach to an output stream
|
||||||
|
foamVtkBase64Layer(std::ostream& os);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~foamVtkBase64Layer();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Name for the XML append encoding ("base64").
|
||||||
|
virtual const char* encoding() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Write leading size for binary output
|
||||||
|
virtual void writeSize(const uint64_t nBytes);
|
||||||
|
|
||||||
|
virtual void write(const uint8_t val);
|
||||||
|
virtual void write(const label val);
|
||||||
|
virtual void write(const float val);
|
||||||
|
virtual void write(const double val);
|
||||||
|
|
||||||
|
//- End the encoding sequence (padding the final characters with '=')
|
||||||
|
virtual void flush();
|
||||||
|
|
||||||
|
//- The encoded length for base64 encoded output.
|
||||||
|
virtual std::size_t encodedLength(std::size_t n) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -52,6 +52,12 @@ Foam::foamVtkFormatter::~foamVtkFormatter()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
std::size_t Foam::foamVtkFormatter::encodedLength(std::size_t n) const
|
||||||
|
{
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkFormatter::indent()
|
void Foam::foamVtkFormatter::indent()
|
||||||
{
|
{
|
||||||
label n = xmlTags_.size() * 2;
|
label n = xmlTags_.size() * 2;
|
||||||
@ -149,7 +155,6 @@ Foam::foamVtkFormatter::tag(const word& tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Foam::foamVtkFormatter&
|
Foam::foamVtkFormatter&
|
||||||
Foam::foamVtkFormatter::endTag(const word& tag)
|
Foam::foamVtkFormatter::endTag(const word& tag)
|
||||||
{
|
{
|
||||||
@ -181,7 +186,6 @@ Foam::foamVtkFormatter::endTag(const word& tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Foam::foamVtkFormatter&
|
Foam::foamVtkFormatter&
|
||||||
Foam::foamVtkFormatter::xmlAttr
|
Foam::foamVtkFormatter::xmlAttr
|
||||||
(
|
(
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -74,8 +74,8 @@ class foamVtkFormatter
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
foamVtkFormatter& xmlAttribute
|
foamVtkFormatter& xmlAttribute
|
||||||
(
|
(
|
||||||
const word&,
|
const word& k,
|
||||||
const Type&,
|
const Type& v,
|
||||||
const char quote
|
const char quote
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -120,14 +120,20 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Write leading size for binary output
|
//- Write leading size for binary output
|
||||||
virtual void writeSize(const uint64_t) = 0;
|
virtual void writeSize(const uint64_t nBytes) = 0;
|
||||||
|
|
||||||
virtual void write(const uint8_t) = 0;
|
virtual void write(const uint8_t val) = 0;
|
||||||
virtual void write(const label) = 0;
|
virtual void write(const label val) = 0;
|
||||||
virtual void write(const float) = 0;
|
virtual void write(const float val) = 0;
|
||||||
virtual void write(const double) = 0;
|
virtual void write(const double val) = 0;
|
||||||
|
|
||||||
|
//- Flush encoding, write newline etc.
|
||||||
virtual void flush() = 0;
|
virtual void flush() = 0;
|
||||||
|
|
||||||
|
//- The encoded length for binary output.
|
||||||
|
// The default is pass-through.
|
||||||
|
virtual std::size_t encodedLength(std::size_t n) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
@ -138,7 +144,7 @@ public:
|
|||||||
foamVtkFormatter& xmlHeader();
|
foamVtkFormatter& xmlHeader();
|
||||||
|
|
||||||
//- Write XML comment (at the current indentation level)
|
//- Write XML comment (at the current indentation level)
|
||||||
foamVtkFormatter& comment(const std::string&);
|
foamVtkFormatter& comment(const std::string& text);
|
||||||
|
|
||||||
|
|
||||||
//- Open XML tag
|
//- Open XML tag
|
||||||
@ -177,40 +183,40 @@ public:
|
|||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& xmlAttr
|
foamVtkFormatter& xmlAttr
|
||||||
(
|
(
|
||||||
const word&,
|
const word& k,
|
||||||
const std::string&,
|
const std::string& v,
|
||||||
const char quote = '\''
|
const char quote = '\''
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& xmlAttr
|
foamVtkFormatter& xmlAttr
|
||||||
(
|
(
|
||||||
const word&,
|
const word& k,
|
||||||
const int32_t,
|
const int32_t v,
|
||||||
const char quote = '\''
|
const char quote = '\''
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& xmlAttr
|
foamVtkFormatter& xmlAttr
|
||||||
(
|
(
|
||||||
const word&,
|
const word& k,
|
||||||
const int64_t,
|
const int64_t v,
|
||||||
const char quote = '\''
|
const char quote = '\''
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& xmlAttr
|
foamVtkFormatter& xmlAttr
|
||||||
(
|
(
|
||||||
const word&,
|
const word& k,
|
||||||
const uint64_t,
|
const uint64_t v,
|
||||||
const char quote = '\''
|
const char quote = '\''
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& xmlAttr
|
foamVtkFormatter& xmlAttr
|
||||||
(
|
(
|
||||||
const word&,
|
const word& k,
|
||||||
const scalar,
|
const scalar v,
|
||||||
const char quote = '\''
|
const char quote = '\''
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -219,19 +225,19 @@ public:
|
|||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& operator()(const word&, const std::string&);
|
foamVtkFormatter& operator()(const word& k, const std::string& v);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& operator()(const word&, const int32_t);
|
foamVtkFormatter& operator()(const word& k, const int32_t v);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& operator()(const word&, const int64_t);
|
foamVtkFormatter& operator()(const word& k, const int64_t v);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& operator()(const word&, const uint64_t);
|
foamVtkFormatter& operator()(const word& k, const uint64_t v);
|
||||||
|
|
||||||
//- Write XML attribute
|
//- Write XML attribute
|
||||||
foamVtkFormatter& operator()(const word&, const scalar);
|
foamVtkFormatter& operator()(const word& k, const scalar v);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -71,8 +71,8 @@ const char* Foam::foamVtkLegacyFormatter::encoding() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkLegacyFormatter::writeSize(const uint64_t)
|
void Foam::foamVtkLegacyFormatter::writeSize(const uint64_t ignored)
|
||||||
{}
|
{/*nop*/}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkLegacyFormatter::write(const uint8_t val)
|
void Foam::foamVtkLegacyFormatter::write(const uint8_t val)
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,11 +25,10 @@ Class
|
|||||||
foamVtkLegacyFormatter
|
foamVtkLegacyFormatter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Binary output for the VTK legacy format, always written as big-endian.
|
Binary output for the VTK legacy format, always written as big-endian
|
||||||
|
and with 32-bit integers.
|
||||||
|
|
||||||
The legacy files are always written as big endian.
|
This format should never be used for OpenFOAM with 64-bit label sizes.
|
||||||
Since integers in the legacy format are limited to 32-bit,
|
|
||||||
this format should not be used for OpenFOAM with 64-bit label sizes.
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
foamVtkLegacyFormatter.C
|
foamVtkLegacyFormatter.C
|
||||||
@ -81,7 +80,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and attach to an output stream
|
//- Construct and attach to an output stream
|
||||||
foamVtkLegacyFormatter(std::ostream&);
|
foamVtkLegacyFormatter(std::ostream& os);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -90,22 +89,25 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Name for the Legacy output type ("BINARY")
|
//- Name for the legacy binary output type ("BINARY")
|
||||||
virtual const char* name() const;
|
virtual const char* name() const;
|
||||||
|
|
||||||
//- Name for the XML append encoding (unused)
|
//- Name for the XML append encoding (unused)
|
||||||
// Currently simply "BINARY", but this should not be relied upon.
|
// Currently identical to name(), but do not rely on this.
|
||||||
virtual const char* encoding() const;
|
virtual const char* encoding() const;
|
||||||
|
|
||||||
|
|
||||||
//- Write leading size - a no-op for legacy binary output
|
//- Write leading size - a no-op for legacy binary output
|
||||||
virtual void writeSize(const uint64_t);
|
virtual void writeSize(const uint64_t ignored);
|
||||||
|
|
||||||
virtual void write(const uint8_t);
|
virtual void write(const uint8_t val);
|
||||||
virtual void write(const label);
|
virtual void write(const label val);
|
||||||
virtual void write(const float);
|
virtual void write(const float val);
|
||||||
virtual void write(const double);
|
virtual void write(const double val);
|
||||||
|
|
||||||
|
//- Write a newline to the output
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -45,10 +45,8 @@ Foam::foamVtkOutputOptions::foamVtkOutputOptions()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoPtr<Foam::foamVtkFormatter> Foam::foamVtkOutputOptions::newFormatter
|
Foam::autoPtr<Foam::foamVtkFormatter>
|
||||||
(
|
Foam::foamVtkOutputOptions::newFormatter(std::ostream& os) const
|
||||||
std::ostream& os
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
switch (type_)
|
switch (type_)
|
||||||
{
|
{
|
||||||
@ -87,9 +85,9 @@ Foam::autoPtr<Foam::foamVtkFormatter> Foam::foamVtkOutputOptions::newFormatter
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::foamVtkOutputOptions::ascii(bool b)
|
void Foam::foamVtkOutputOptions::ascii(bool on)
|
||||||
{
|
{
|
||||||
if (b)
|
if (on)
|
||||||
{
|
{
|
||||||
// Force ASCII:
|
// Force ASCII:
|
||||||
|
|
||||||
@ -132,9 +130,9 @@ void Foam::foamVtkOutputOptions::ascii(bool b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkOutputOptions::append(bool b)
|
void Foam::foamVtkOutputOptions::append(bool on)
|
||||||
{
|
{
|
||||||
if (b)
|
if (on)
|
||||||
{
|
{
|
||||||
if (!(type_ & APPEND))
|
if (!(type_ & APPEND))
|
||||||
{
|
{
|
||||||
@ -153,9 +151,9 @@ void Foam::foamVtkOutputOptions::append(bool b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkOutputOptions::legacy(bool b)
|
void Foam::foamVtkOutputOptions::legacy(bool on)
|
||||||
{
|
{
|
||||||
if (b)
|
if (on)
|
||||||
{
|
{
|
||||||
if (type_ & APPEND)
|
if (type_ & APPEND)
|
||||||
{
|
{
|
||||||
@ -180,9 +178,9 @@ void Foam::foamVtkOutputOptions::legacy(bool b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::foamVtkOutputOptions::precision(unsigned val) const
|
void Foam::foamVtkOutputOptions::precision(unsigned prec) const
|
||||||
{
|
{
|
||||||
precision_ = val;
|
precision_ = prec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -88,7 +88,7 @@ public:
|
|||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Return new data formatter based on the writer options
|
//- Return new data formatter based on the writer options
|
||||||
autoPtr<foamVtkFormatter> newFormatter(std::ostream&) const;
|
autoPtr<foamVtkFormatter> newFormatter(std::ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -117,16 +117,16 @@ public:
|
|||||||
// In append mode, this switches between base64 and raw binary.
|
// In append mode, this switches between base64 and raw binary.
|
||||||
// In XML mode, this switches between ASCII and base64.
|
// In XML mode, this switches between ASCII and base64.
|
||||||
// In legacy mode, this switches between ASCII and binary.
|
// In legacy mode, this switches between ASCII and binary.
|
||||||
void ascii(bool);
|
void ascii(bool on);
|
||||||
|
|
||||||
//- Toggle append mode on/off.
|
//- Toggle append mode on/off.
|
||||||
void append(bool);
|
void append(bool on);
|
||||||
|
|
||||||
//- Toggle legacy mode on/off.
|
//- Toggle legacy mode on/off.
|
||||||
void legacy(bool);
|
void legacy(bool on);
|
||||||
|
|
||||||
//- Set the write precision to be used for new ASCII formatters
|
//- Set the write precision to be used for new ASCII formatters
|
||||||
void precision(unsigned val) const;
|
void precision(unsigned prec) const;
|
||||||
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|||||||
@ -59,11 +59,11 @@ Foam::foamVtkPTraits<double>::typeName = "Float64";
|
|||||||
#ifdef WM_LITTLE_ENDIAN
|
#ifdef WM_LITTLE_ENDIAN
|
||||||
template<>
|
template<>
|
||||||
const char* const
|
const char* const
|
||||||
Foam::foamVtkPTraits<::Foam::endian>::typeName = "LittleEndian";
|
Foam::foamVtkPTraits<Foam::endian>::typeName = "LittleEndian";
|
||||||
#else
|
#else
|
||||||
template<>
|
template<>
|
||||||
const char* const
|
const char* const
|
||||||
Foam::foamVtkPTraits<::Foam::endian>::typeName = "BigEndian";
|
Foam::foamVtkPTraits<Foam::endian>::typeName = "BigEndian";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -58,28 +58,28 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<uint8_t>::typeName; // = UInt8
|
const char* const foamVtkPTraits<uint8_t>::typeName; // UInt8
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<int32_t>::typeName; // = Int32
|
const char* const foamVtkPTraits<int32_t>::typeName; // Int32
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<int32_t>::typeName; // = UInt32
|
const char* const foamVtkPTraits<uint32_t>::typeName; // UInt32
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<int32_t>::typeName; // = Int64
|
const char* const foamVtkPTraits<int64_t>::typeName; // Int64
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<int64_t>::typeName; // = UInt64
|
const char* const foamVtkPTraits<uint64_t>::typeName; // UInt64
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<float>::typeName; // = Float32
|
const char* const foamVtkPTraits<float>::typeName; // Float32
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<double>::typeName; // = Float64
|
const char* const foamVtkPTraits<double>::typeName; // Float64
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* const foamVtkPTraits<::Foam::endian>::typeName;
|
const char* const foamVtkPTraits<Foam::endian>::typeName; // (Big|Little)Endian
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Description
|
|||||||
Usage
|
Usage
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
valueFraction | fraction od value used for boundary [0-1] | yes |
|
valueFraction | fraction of value used for boundary [0-1] | yes |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Foam::slipFvPatchField<Type>::slipFvPatchField
|
|||||||
const DimensionedField<Type, volMesh>& iF
|
const DimensionedField<Type, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicSymmetryFvPatchField<Type>(p, iF)
|
basicSymmetryFvPatchField<Type>(p, iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::functionObjects::runTimePostProcessing
|
Foam::functionObjects::runTimePostPro::runTimePostProcessing
|
||||||
|
|
||||||
Group
|
Group
|
||||||
grpGraphicsFunctionObjects
|
grpGraphicsFunctionObjects
|
||||||
|
|||||||
@ -201,7 +201,7 @@ Foam::functionObjects::scalarTransport::scalarTransport
|
|||||||
resetOnStartUp_(false),
|
resetOnStartUp_(false),
|
||||||
schemesField_("unknown-schemesField"),
|
schemesField_("unknown-schemesField"),
|
||||||
fvOptions_(mesh_),
|
fvOptions_(mesh_),
|
||||||
bounded01_(dict.lookupOrDefault<bool>("bounded01", true))
|
bounded01_(dict.lookupOrDefault<Switch>("bounded01", true))
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
@ -235,12 +235,7 @@ bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
|
|||||||
dict.readIfPresent("bounded01", bounded01_);
|
dict.readIfPresent("bounded01", bounded01_);
|
||||||
|
|
||||||
schemesField_ = dict.lookupOrDefault("schemesField", fieldName_);
|
schemesField_ = dict.lookupOrDefault("schemesField", fieldName_);
|
||||||
|
constantD_ = dict.readIfPresent("D", D_);
|
||||||
constantD_ = false;
|
|
||||||
if (dict.readIfPresent("D", D_))
|
|
||||||
{
|
|
||||||
constantD_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
dict.readIfPresent("nCorr", nCorr_);
|
dict.readIfPresent("nCorr", nCorr_);
|
||||||
dict.readIfPresent("resetOnStartUp", resetOnStartUp_);
|
dict.readIfPresent("resetOnStartUp", resetOnStartUp_);
|
||||||
@ -256,11 +251,11 @@ bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::scalarTransport::execute()
|
bool Foam::functionObjects::scalarTransport::execute()
|
||||||
{
|
{
|
||||||
Log << type() << " write:" << endl;
|
|
||||||
|
|
||||||
volScalarField& s = transportedField();
|
volScalarField& s = transportedField();
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
Log << type() << " execute: " << s.name() << endl;
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
// Calculate the diffusivity
|
// Calculate the diffusivity
|
||||||
|
|||||||
@ -111,17 +111,18 @@ Usage
|
|||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
type | Type name: scalarTransport | yes |
|
type | Type name: scalarTransport | yes |
|
||||||
phi | Name of flux field | yes |
|
field | Name of the scalar field | no | s
|
||||||
|
phi | Name of flux field | no | phi
|
||||||
rho | Name of density field | no | rho
|
rho | Name of density field | no | rho
|
||||||
phase | Name of the phase name | no | none
|
phase | Name of the phase | no | none
|
||||||
nut | Name of the turbulence viscosity | no | none
|
nut | Name of the turbulence viscosity | no | none
|
||||||
D | Diffusion coefficient | no | auto generated
|
D | Diffusion coefficient | no | auto generated
|
||||||
nCorr | Number of correctors | no | 0
|
nCorr | Number of correctors | no | 0
|
||||||
resetOnStartUp | Reset scalar to zero on start-up | no | no
|
resetOnStartUp | Reset scalar to zero on start-up | no | no
|
||||||
schemesField | Name of field to specify schemes | no | fieldName
|
schemesField | Name of field to specify schemes | no | field name
|
||||||
fvOptions | List of scalar sources | no |
|
fvOptions | List of scalar sources | no |
|
||||||
bounded01 | Bounds scalar between 0-1 for multiphase | no |true
|
bounded01 | Bounds scalar between 0-1 for multiphase | no | true
|
||||||
phasePhiCompressed |Compressed flux for VOF | no | alphaPhiUn
|
phasePhiCompressed | Compressed flux for VOF | no | alphaPhiUn
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
See also
|
See also
|
||||||
@ -156,10 +157,10 @@ class scalarTransport
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of field to process
|
//- Name of the transport field.
|
||||||
word fieldName_;
|
word fieldName_;
|
||||||
|
|
||||||
//- Name of flux field
|
//- Name of flux field (optional)
|
||||||
word phiName_;
|
word phiName_;
|
||||||
|
|
||||||
//- Name of density field (optional)
|
//- Name of density field (optional)
|
||||||
@ -168,10 +169,10 @@ class scalarTransport
|
|||||||
//- Name of turbulent viscosity field (optional)
|
//- Name of turbulent viscosity field (optional)
|
||||||
word nutName_;
|
word nutName_;
|
||||||
|
|
||||||
//- Name of phase field
|
//- Name of phase field (optional)
|
||||||
word phaseName_;
|
word phaseName_;
|
||||||
|
|
||||||
//- Name of phase field compressed flux
|
//- Name of phase field compressed flux (optional)
|
||||||
word phasePhiCompressedName_;
|
word phasePhiCompressedName_;
|
||||||
|
|
||||||
//- Diffusion coefficient (optional)
|
//- Diffusion coefficient (optional)
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
#include "coordinateSystem.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -63,7 +63,6 @@ SourceFiles
|
|||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
#include "surfaceMesh.H"
|
#include "surfaceMesh.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "coordinateSystems.H"
|
|
||||||
#include "interpolation.H"
|
#include "interpolation.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
#include "coordinateSystem.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -52,7 +52,6 @@ SourceFiles
|
|||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "coordinateSystems.H"
|
|
||||||
#include "interpolation.H"
|
#include "interpolation.H"
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
|
|||||||
@ -3,7 +3,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) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -264,15 +264,13 @@ void Foam::faceShading::calculate()
|
|||||||
{
|
{
|
||||||
includeAllFacesPerPatch[patchI].insert
|
includeAllFacesPerPatch[patchI].insert
|
||||||
(
|
(
|
||||||
faceI //pp.start()
|
faceI
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
labelList triSurfaceToAgglom(5*nFaces);
|
|
||||||
|
|
||||||
triSurface localSurface = triangulate
|
triSurface localSurface = triangulate
|
||||||
(
|
(
|
||||||
includePatches,
|
includePatches,
|
||||||
@ -294,9 +292,10 @@ void Foam::faceShading::calculate()
|
|||||||
dict
|
dict
|
||||||
);
|
);
|
||||||
|
|
||||||
surfacesMesh.searchableSurface::write();
|
if (debug)
|
||||||
|
{
|
||||||
triSurfaceToAgglom.resize(surfacesMesh.size());
|
surfacesMesh.searchableSurface::write();
|
||||||
|
}
|
||||||
|
|
||||||
scalar maxBounding = 5.0*mag(mesh_.bounds().max() - mesh_.bounds().min());
|
scalar maxBounding = 5.0*mag(mesh_.bounds().max() - mesh_.bounds().min());
|
||||||
|
|
||||||
@ -324,7 +323,7 @@ void Foam::faceShading::calculate()
|
|||||||
|
|
||||||
const vector d(direction_*maxBounding);
|
const vector d(direction_*maxBounding);
|
||||||
|
|
||||||
start.append(fc - SMALL*d);
|
start.append(fc - 0.001*d);
|
||||||
|
|
||||||
startIndex.append(myFaceId);
|
startIndex.append(myFaceId);
|
||||||
|
|
||||||
@ -355,7 +354,7 @@ void Foam::faceShading::calculate()
|
|||||||
(
|
(
|
||||||
mesh_.time().path()/"allVisibleFaces.obj",
|
mesh_.time().path()/"allVisibleFaces.obj",
|
||||||
end,
|
end,
|
||||||
Cfs
|
start
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2015 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,6 +26,9 @@ License
|
|||||||
#include "solarCalculator.H"
|
#include "solarCalculator.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
|
#include "constants.H"
|
||||||
|
|
||||||
|
using namespace Foam::constant;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -104,6 +107,14 @@ void Foam::solarCalculator::calculateBetaTetha()
|
|||||||
beta_ = max(asin(cos(L)*cos(deltaRad)*cos(H) + sin(L)*sin(deltaRad)), 1e-3);
|
beta_ = max(asin(cos(L)*cos(deltaRad)*cos(H) + sin(L)*sin(deltaRad)), 1e-3);
|
||||||
tetha_ = acos((sin(beta_)*sin(L) - sin(deltaRad))/(cos(beta_)*cos(L)));
|
tetha_ = acos((sin(beta_)*sin(L) - sin(deltaRad))/(cos(beta_)*cos(L)));
|
||||||
|
|
||||||
|
// theta is the angle between the SOUTH axis and the Sun
|
||||||
|
// If the hour angle is lower than zero (morning) the Sun is positioned
|
||||||
|
// on the East side.
|
||||||
|
if (H < 0)
|
||||||
|
{
|
||||||
|
tetha_ += 2*(constant::mathematical::pi - tetha_);
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info << tab << "altitude : " << radToDeg(beta_) << endl;
|
Info << tab << "altitude : " << radToDeg(beta_) << endl;
|
||||||
@ -126,9 +137,10 @@ void Foam::solarCalculator::calculateSunDirection()
|
|||||||
new coordinateSystem("grid", Zero, gridUp_, eastDir_)
|
new coordinateSystem("grid", Zero, gridUp_, eastDir_)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Assuming 'z' vertical, 'y' North and 'x' East
|
||||||
direction_.z() = -sin(beta_);
|
direction_.z() = -sin(beta_);
|
||||||
direction_.y() = cos(beta_)*cos(tetha_); //North
|
direction_.y() = cos(beta_)*cos(tetha_); // South axis
|
||||||
direction_.x() = cos(beta_)*sin(tetha_); //East
|
direction_.x() = cos(beta_)*sin(tetha_); // West axis
|
||||||
|
|
||||||
direction_ /= mag(direction_);
|
direction_ /= mag(direction_);
|
||||||
|
|
||||||
@ -137,6 +149,7 @@ void Foam::solarCalculator::calculateSunDirection()
|
|||||||
Info<< "Sun direction in absolute coordinates : " << direction_ <<endl;
|
Info<< "Sun direction in absolute coordinates : " << direction_ <<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Transform to actual coordinate system
|
||||||
direction_ = coord_->R().transform(direction_);
|
direction_ = coord_->R().transform(direction_);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -62,7 +62,7 @@ Foam::waveModels::waveAbsorptionModel::waveAbsorptionModel
|
|||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
readDict(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,9 +75,12 @@ Foam::waveModels::waveAbsorptionModel::~waveAbsorptionModel()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::waveModels::waveAbsorptionModel::read(const dictionary& overrideDict)
|
bool Foam::waveModels::waveAbsorptionModel::readDict
|
||||||
|
(
|
||||||
|
const dictionary& overrideDict
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (waveModel::read(overrideDict))
|
if (waveModel::readDict(overrideDict))
|
||||||
{
|
{
|
||||||
// Note: always set to true
|
// Note: always set to true
|
||||||
activeAbsorption_ = true;
|
activeAbsorption_ = true;
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -96,7 +96,7 @@ Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption
|
|||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
readDict(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,12 +109,12 @@ Foam::waveModels::shallowWaterAbsorption::~shallowWaterAbsorption()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::waveModels::shallowWaterAbsorption::read
|
bool Foam::waveModels::shallowWaterAbsorption::readDict
|
||||||
(
|
(
|
||||||
const dictionary& overrideDict
|
const dictionary& overrideDict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return waveAbsorptionModel::read(overrideDict);
|
return waveAbsorptionModel::readDict(overrideDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -86,7 +86,7 @@ Foam::waveModels::regularWaveModel::regularWaveModel
|
|||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
readDict(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,9 +99,12 @@ Foam::waveModels::regularWaveModel::~regularWaveModel()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::waveModels::regularWaveModel::read(const dictionary& overrideDict)
|
bool Foam::waveModels::regularWaveModel::readDict
|
||||||
|
(
|
||||||
|
const dictionary& overrideDict
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (waveGenerationModel::read(overrideDict))
|
if (waveGenerationModel::readDict(overrideDict))
|
||||||
{
|
{
|
||||||
lookup("rampTime") >> rampTime_;
|
lookup("rampTime") >> rampTime_;
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -105,12 +105,13 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace waveModels
|
} // End namespace waveModels
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -70,7 +70,7 @@ Foam::waveModels::solitaryWaveModel::solitaryWaveModel
|
|||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
readDict(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,9 +83,12 @@ Foam::waveModels::solitaryWaveModel::~solitaryWaveModel()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::waveModels::solitaryWaveModel::read(const dictionary& overrideDict)
|
bool Foam::waveModels::solitaryWaveModel::readDict
|
||||||
|
(
|
||||||
|
const dictionary& overrideDict
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (waveGenerationModel::read(overrideDict))
|
if (waveGenerationModel::readDict(overrideDict))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -87,12 +87,13 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace waveModels
|
} // End namespace waveModels
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -55,7 +55,7 @@ Foam::waveModels::waveGenerationModel::waveGenerationModel
|
|||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
readDict(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +68,12 @@ Foam::waveModels::waveGenerationModel::~waveGenerationModel()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::waveModels::waveGenerationModel::read(const dictionary& overrideDict)
|
bool Foam::waveModels::waveGenerationModel::readDict
|
||||||
|
(
|
||||||
|
const dictionary& overrideDict
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (waveModel::read(overrideDict))
|
if (waveModel::readDict(overrideDict))
|
||||||
{
|
{
|
||||||
lookup("activeAbsorption") >> activeAbsorption_;
|
lookup("activeAbsorption") >> activeAbsorption_;
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -101,7 +101,7 @@ Foam::vector Foam::waveModels::Boussinesq::Deta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::waveModels::Boussinesq::U
|
Foam::vector Foam::waveModels::Boussinesq::Uf
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -139,6 +139,8 @@ Foam::vector Foam::waveModels::Boussinesq::U
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::waveModels::Boussinesq::setLevel
|
void Foam::waveModels::Boussinesq::setLevel
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -165,44 +167,6 @@ void Foam::waveModels::Boussinesq::setLevel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::Boussinesq::Boussinesq
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const polyPatch& patch,
|
|
||||||
const bool readFields
|
|
||||||
)
|
|
||||||
:
|
|
||||||
solitaryWaveModel(dict, mesh, patch, false)
|
|
||||||
{
|
|
||||||
if (readFields)
|
|
||||||
{
|
|
||||||
read(dict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::Boussinesq::~Boussinesq()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::waveModels::Boussinesq::read(const dictionary& overrideDict)
|
|
||||||
{
|
|
||||||
if (solitaryWaveModel::read(overrideDict))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::Boussinesq::setVelocity
|
void Foam::waveModels::Boussinesq::setVelocity
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -224,7 +188,7 @@ void Foam::waveModels::Boussinesq::setVelocity
|
|||||||
{
|
{
|
||||||
const label paddlei = faceToPaddle_[facei];
|
const label paddlei = faceToPaddle_[facei];
|
||||||
|
|
||||||
const vector Uf = U
|
const vector Uf = this->Uf
|
||||||
(
|
(
|
||||||
waveHeight_,
|
waveHeight_,
|
||||||
waterDepthRef_,
|
waterDepthRef_,
|
||||||
@ -242,6 +206,44 @@ void Foam::waveModels::Boussinesq::setVelocity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::Boussinesq::Boussinesq
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const polyPatch& patch,
|
||||||
|
const bool readFields
|
||||||
|
)
|
||||||
|
:
|
||||||
|
solitaryWaveModel(dict, mesh, patch, false)
|
||||||
|
{
|
||||||
|
if (readFields)
|
||||||
|
{
|
||||||
|
readDict(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::Boussinesq::~Boussinesq()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::waveModels::Boussinesq::readDict(const dictionary& overrideDict)
|
||||||
|
{
|
||||||
|
if (solitaryWaveModel::readDict(overrideDict))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::Boussinesq::info(Ostream& os) const
|
void Foam::waveModels::Boussinesq::info(Ostream& os) const
|
||||||
{
|
{
|
||||||
solitaryWaveModel::info(os);
|
solitaryWaveModel::info(os);
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,12 +49,12 @@ class Boussinesq
|
|||||||
:
|
:
|
||||||
public solitaryWaveModel
|
public solitaryWaveModel
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// Protected Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Wave height
|
//- Wave height
|
||||||
virtual scalar eta
|
scalar eta
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -66,7 +66,7 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Wave
|
//- Wave
|
||||||
virtual vector Deta
|
vector Deta
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -78,7 +78,7 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Wave velocity
|
//- Wave velocity
|
||||||
virtual vector U
|
vector Uf
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -90,6 +90,11 @@ protected:
|
|||||||
const scalar z
|
const scalar z
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Set the water level
|
//- Set the water level
|
||||||
virtual void setLevel
|
virtual void setLevel
|
||||||
(
|
(
|
||||||
@ -128,12 +133,13 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace waveModels
|
} // End namespace waveModels
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -48,6 +48,26 @@ namespace waveModels
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::waveModels::StokesI::eta
|
||||||
|
(
|
||||||
|
const scalar H,
|
||||||
|
const scalar Kx,
|
||||||
|
const scalar x,
|
||||||
|
const scalar Ky,
|
||||||
|
const scalar y,
|
||||||
|
const scalar omega,
|
||||||
|
const scalar t,
|
||||||
|
const scalar phase
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
scalar phaseTot = Kx*x + Ky*y - omega*t + phase;
|
||||||
|
|
||||||
|
return H*0.5*cos(phaseTot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::scalar Foam::waveModels::StokesI::waveLength
|
Foam::scalar Foam::waveModels::StokesI::waveLength
|
||||||
(
|
(
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -66,24 +86,7 @@ Foam::scalar Foam::waveModels::StokesI::waveLength
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::waveModels::StokesI::eta
|
Foam::vector Foam::waveModels::StokesI::UfBase
|
||||||
(
|
|
||||||
const scalar H,
|
|
||||||
const scalar Kx,
|
|
||||||
const scalar x,
|
|
||||||
const scalar Ky,
|
|
||||||
const scalar y,
|
|
||||||
const scalar omega,
|
|
||||||
const scalar t,
|
|
||||||
const scalar phase
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
scalar phaseTot = Kx*x + Ky*y - omega*t + phase;
|
|
||||||
|
|
||||||
return H*0.5*cos(phaseTot);
|
|
||||||
}
|
|
||||||
|
|
||||||
Foam::vector Foam::waveModels::StokesI::U
|
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -141,46 +144,6 @@ void Foam::waveModels::StokesI::setLevel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::StokesI::StokesI
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const polyPatch& patch,
|
|
||||||
const bool readFields
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regularWaveModel(dict, mesh, patch, false)
|
|
||||||
{
|
|
||||||
if (readFields)
|
|
||||||
{
|
|
||||||
read(dict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::StokesI::~StokesI()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::waveModels::StokesI::read(const dictionary& overrideDict)
|
|
||||||
{
|
|
||||||
if (regularWaveModel::read(overrideDict))
|
|
||||||
{
|
|
||||||
waveLength_ = waveLength(waterDepthRef_, wavePeriod_);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::StokesI::setVelocity
|
void Foam::waveModels::StokesI::setVelocity
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -207,7 +170,7 @@ void Foam::waveModels::StokesI::setVelocity
|
|||||||
{
|
{
|
||||||
const label paddlei = faceToPaddle_[facei];
|
const label paddlei = faceToPaddle_[facei];
|
||||||
|
|
||||||
const vector Uf = U
|
const vector Uf = UfBase
|
||||||
(
|
(
|
||||||
waveHeight_,
|
waveHeight_,
|
||||||
waterDepthRef_,
|
waterDepthRef_,
|
||||||
@ -227,6 +190,46 @@ void Foam::waveModels::StokesI::setVelocity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::StokesI::StokesI
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const polyPatch& patch,
|
||||||
|
const bool readFields
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regularWaveModel(dict, mesh, patch, false)
|
||||||
|
{
|
||||||
|
if (readFields)
|
||||||
|
{
|
||||||
|
readDict(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::StokesI::~StokesI()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::waveModels::StokesI::readDict(const dictionary& overrideDict)
|
||||||
|
{
|
||||||
|
if (regularWaveModel::readDict(overrideDict))
|
||||||
|
{
|
||||||
|
waveLength_ = waveLength(waterDepthRef_, wavePeriod_);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::StokesI::info(Ostream& os) const
|
void Foam::waveModels::StokesI::info(Ostream& os) const
|
||||||
{
|
{
|
||||||
regularWaveModel::info(os);
|
regularWaveModel::info(os);
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,15 +49,12 @@ class StokesI
|
|||||||
:
|
:
|
||||||
public regularWaveModel
|
public regularWaveModel
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// Protected Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Return the wavelength
|
|
||||||
virtual scalar waveLength(const scalar h, const scalar T) const;
|
|
||||||
|
|
||||||
//- Wave height
|
//- Wave height
|
||||||
virtual scalar eta
|
scalar eta
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar Kx,
|
const scalar Kx,
|
||||||
@ -69,8 +66,16 @@ protected:
|
|||||||
const scalar phase
|
const scalar phase
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Return the wavelength
|
||||||
|
virtual scalar waveLength(const scalar h, const scalar T) const;
|
||||||
|
|
||||||
//- Wave velocity
|
//- Wave velocity
|
||||||
virtual vector U
|
virtual vector UfBase
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -84,7 +89,6 @@ protected:
|
|||||||
const scalar z
|
const scalar z
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Set the water level
|
//- Set the water level
|
||||||
virtual void setLevel
|
virtual void setLevel
|
||||||
(
|
(
|
||||||
@ -123,12 +127,13 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace waveModels
|
} // End namespace waveModels
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -71,7 +71,9 @@ Foam::scalar Foam::waveModels::StokesII::eta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::waveModels::StokesII::U
|
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::vector Foam::waveModels::StokesII::UfBase
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -148,7 +150,7 @@ Foam::waveModels::StokesII::StokesII
|
|||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
readDict(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,9 +163,9 @@ Foam::waveModels::StokesII::~StokesII()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::waveModels::StokesII::read(const dictionary& overrideDict)
|
bool Foam::waveModels::StokesII::readDict(const dictionary& overrideDict)
|
||||||
{
|
{
|
||||||
if (StokesI::read(overrideDict))
|
if (StokesI::readDict(overrideDict))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,12 +49,12 @@ class StokesII
|
|||||||
:
|
:
|
||||||
public StokesI
|
public StokesI
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// Protected Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Wave height
|
//- Wave height
|
||||||
virtual scalar eta
|
scalar eta
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -67,8 +67,13 @@ protected:
|
|||||||
const scalar phase
|
const scalar phase
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Wave velocity
|
//- Wave velocity
|
||||||
virtual vector U
|
virtual vector UfBase
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -112,12 +117,13 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace waveModels
|
} // End namespace waveModels
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -680,7 +680,7 @@ Foam::scalar Foam::waveModels::StokesV::eta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::waveModels::StokesV::U
|
Foam::vector Foam::waveModels::StokesV::Uf
|
||||||
(
|
(
|
||||||
const scalar d,
|
const scalar d,
|
||||||
const scalar kx,
|
const scalar kx,
|
||||||
@ -722,17 +722,17 @@ Foam::vector Foam::waveModels::StokesV::U
|
|||||||
|
|
||||||
scalar u =
|
scalar u =
|
||||||
a1u*cosh(k*z)*cos(theta)
|
a1u*cosh(k*z)*cos(theta)
|
||||||
+ a2u*cosh(2.0*k*z)*cos(2.0*(theta))
|
+ a2u*cosh(2*k*z)*cos(2*theta)
|
||||||
+ a3u*cosh(3.0*k*z)*cos(3.0*(theta))
|
+ a3u*cosh(3*k*z)*cos(3*theta)
|
||||||
+ a4u*cosh(4.0*k*z)*cos(4.0*(theta))
|
+ a4u*cosh(4*k*z)*cos(4*theta)
|
||||||
+ a5u*cosh(5.0*k*z)*cos(5.0*(theta));
|
+ a5u*cosh(5*k*z)*cos(5*theta);
|
||||||
|
|
||||||
scalar w =
|
scalar w =
|
||||||
a1u*sinh(k*z)*sin(theta)
|
a1u*sinh(k*z)*sin(theta)
|
||||||
+ a2u*sinh(2.0*k*z)*sin(2.0*(theta))
|
+ a2u*sinh(2*k*z)*sin(2*theta)
|
||||||
+ a3u*sinh(3.0*k*z)*sin(3.0*(theta))
|
+ a3u*sinh(3*k*z)*sin(3*theta)
|
||||||
+ a4u*sinh(4.0*k*z)*sin(4.0*(theta))
|
+ a4u*sinh(4*k*z)*sin(4*theta)
|
||||||
+ a5u*sinh(5.0*k*z)*sin(5.0*(theta));
|
+ a5u*sinh(5*k*z)*sin(5*theta);
|
||||||
|
|
||||||
scalar v = u*sin(waveAngle_);
|
scalar v = u*sin(waveAngle_);
|
||||||
u *= cos(waveAngle_);
|
u *= cos(waveAngle_);
|
||||||
@ -741,6 +741,8 @@ Foam::vector Foam::waveModels::StokesV::U
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::waveModels::StokesV::setLevel
|
void Foam::waveModels::StokesV::setLevel
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -773,71 +775,6 @@ void Foam::waveModels::StokesV::setLevel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::StokesV::StokesV
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const polyPatch& patch,
|
|
||||||
const bool readFields
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regularWaveModel(dict, mesh, patch, false),
|
|
||||||
lambda_(0)
|
|
||||||
{
|
|
||||||
if (readFields)
|
|
||||||
{
|
|
||||||
read(dict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::StokesV::~StokesV()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::waveModels::StokesV::read(const dictionary& overrideDict)
|
|
||||||
{
|
|
||||||
if (regularWaveModel::read(overrideDict))
|
|
||||||
{
|
|
||||||
scalar f1;
|
|
||||||
scalar f2;
|
|
||||||
scalar waveK;
|
|
||||||
|
|
||||||
initialise
|
|
||||||
(
|
|
||||||
waveHeight_,
|
|
||||||
waterDepthRef_,
|
|
||||||
wavePeriod_,
|
|
||||||
waveK,
|
|
||||||
lambda_,
|
|
||||||
f1,
|
|
||||||
f2
|
|
||||||
);
|
|
||||||
|
|
||||||
if (f1 > 0.001 || f2 > 0.001)
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "No convergence for Stokes V wave theory" << nl
|
|
||||||
<< " f1: " << f1 << nl
|
|
||||||
<< " f2: " << f2 << nl
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
waveLength_ = 2.0*mathematical::pi/waveK;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::StokesV::setVelocity
|
void Foam::waveModels::StokesV::setVelocity
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -863,7 +800,7 @@ void Foam::waveModels::StokesV::setVelocity
|
|||||||
{
|
{
|
||||||
const label paddlei = faceToPaddle_[facei];
|
const label paddlei = faceToPaddle_[facei];
|
||||||
|
|
||||||
const vector Uf = U
|
const vector Uf = this->Uf
|
||||||
(
|
(
|
||||||
waterDepthRef_,
|
waterDepthRef_,
|
||||||
waveKx,
|
waveKx,
|
||||||
@ -883,9 +820,72 @@ void Foam::waveModels::StokesV::setVelocity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::StokesV::StokesV
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const polyPatch& patch,
|
||||||
|
const bool readFields
|
||||||
|
)
|
||||||
|
:
|
||||||
|
StokesI(dict, mesh, patch, false),
|
||||||
|
lambda_(0)
|
||||||
|
{
|
||||||
|
if (readFields)
|
||||||
|
{
|
||||||
|
readDict(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::StokesV::~StokesV()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::waveModels::StokesV::readDict(const dictionary& overrideDict)
|
||||||
|
{
|
||||||
|
if (StokesI::readDict(overrideDict))
|
||||||
|
{
|
||||||
|
scalar f1;
|
||||||
|
scalar f2;
|
||||||
|
scalar waveK;
|
||||||
|
|
||||||
|
initialise
|
||||||
|
(
|
||||||
|
waveHeight_,
|
||||||
|
waterDepthRef_,
|
||||||
|
wavePeriod_,
|
||||||
|
waveK,
|
||||||
|
lambda_,
|
||||||
|
f1,
|
||||||
|
f2
|
||||||
|
);
|
||||||
|
|
||||||
|
if (f1 > 0.001 || f2 > 0.001)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "No convergence for Stokes V wave theory" << nl
|
||||||
|
<< " f1: " << f1 << nl
|
||||||
|
<< " f2: " << f2 << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::StokesV::info(Ostream& os) const
|
void Foam::waveModels::StokesV::info(Ostream& os) const
|
||||||
{
|
{
|
||||||
regularWaveModel::info(os);
|
StokesI::info(os);
|
||||||
|
|
||||||
os << " Lambda : " << lambda_ << nl
|
os << " Lambda : " << lambda_ << nl
|
||||||
<< " Wave type : " << waveType() << nl;
|
<< " Wave type : " << waveType() << nl;
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -39,7 +39,7 @@ Description
|
|||||||
#ifndef waveModels_StokesV_H
|
#ifndef waveModels_StokesV_H
|
||||||
#define waveModels_StokesV_H
|
#define waveModels_StokesV_H
|
||||||
|
|
||||||
#include "regularWaveModel.H"
|
#include "StokesIWaveModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,71 +54,65 @@ namespace waveModels
|
|||||||
|
|
||||||
class StokesV
|
class StokesV
|
||||||
:
|
:
|
||||||
public regularWaveModel
|
public StokesI
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// Proteced Data
|
// Private Member Functions
|
||||||
|
|
||||||
//-
|
|
||||||
scalar lambda_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
|
||||||
|
|
||||||
// Model coefficients
|
// Model coefficients
|
||||||
|
|
||||||
virtual scalar A11(const scalar h, const scalar k) const;
|
scalar A11(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A13(const scalar h, const scalar k) const;
|
scalar A13(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A15(const scalar h, const scalar k) const;
|
scalar A15(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A22(const scalar h, const scalar k) const;
|
scalar A22(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A24(const scalar h, const scalar k) const;
|
scalar A24(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A33(const scalar h, const scalar k) const;
|
scalar A33(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A35(const scalar h, const scalar k) const;
|
scalar A35(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A44(const scalar h, const scalar k) const;
|
scalar A44(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar A55(const scalar h, const scalar k) const;
|
scalar A55(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B22(const scalar h, const scalar k) const;
|
scalar B22(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B24(const scalar h, const scalar k) const;
|
scalar B24(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B33(const scalar h, const scalar k) const;
|
scalar B33(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B33k(const scalar h, const scalar k) const;
|
scalar B33k(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B35(const scalar h, const scalar k) const;
|
scalar B35(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B35k(const scalar h, const scalar k) const;
|
scalar B35k(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B44(const scalar h, const scalar k) const;
|
scalar B44(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B55(const scalar h, const scalar k) const;
|
scalar B55(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar B55k(const scalar h, const scalar k) const;
|
scalar B55k(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar C1(const scalar h, const scalar k) const;
|
scalar C1(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar C1k(const scalar h, const scalar k) const;
|
scalar C1k(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar C2(const scalar h, const scalar k) const;
|
scalar C2(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar C2k(const scalar h, const scalar k) const;
|
scalar C2k(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar C3(const scalar h, const scalar k) const;
|
scalar C3(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
virtual scalar C4(const scalar h, const scalar k) const;
|
scalar C4(const scalar h, const scalar k) const;
|
||||||
|
|
||||||
|
|
||||||
//- Model intialisation
|
//- Model intialisation
|
||||||
virtual void initialise
|
void initialise
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar d,
|
const scalar d,
|
||||||
@ -130,7 +124,7 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Wave height
|
//- Wave height
|
||||||
virtual scalar eta
|
scalar eta
|
||||||
(
|
(
|
||||||
const scalar h,
|
const scalar h,
|
||||||
const scalar kx,
|
const scalar kx,
|
||||||
@ -144,7 +138,7 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Wave velocity
|
//- Wave velocity
|
||||||
virtual vector U
|
vector Uf
|
||||||
(
|
(
|
||||||
const scalar d,
|
const scalar d,
|
||||||
const scalar kx,
|
const scalar kx,
|
||||||
@ -158,6 +152,17 @@ protected:
|
|||||||
const scalar z
|
const scalar z
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Proteced Data
|
||||||
|
|
||||||
|
//-
|
||||||
|
scalar lambda_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Set the water level
|
//- Set the water level
|
||||||
virtual void setLevel
|
virtual void setLevel
|
||||||
(
|
(
|
||||||
@ -196,12 +201,13 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace waveModels
|
} // End namespace waveModels
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -189,7 +189,7 @@ Foam::vector Foam::waveModels::cnoidal::dEtaDx
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::waveModels::cnoidal::U
|
Foam::vector Foam::waveModels::cnoidal::Uf
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -231,6 +231,8 @@ Foam::vector Foam::waveModels::cnoidal::U
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::waveModels::cnoidal::setLevel
|
void Foam::waveModels::cnoidal::setLevel
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -262,55 +264,6 @@ void Foam::waveModels::cnoidal::setLevel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::cnoidal::cnoidal
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const polyPatch& patch,
|
|
||||||
const bool readFields
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regularWaveModel(dict, mesh, patch, false),
|
|
||||||
m_(0)
|
|
||||||
{
|
|
||||||
if (readFields)
|
|
||||||
{
|
|
||||||
read(dict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::waveModels::cnoidal::~cnoidal()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::waveModels::cnoidal::read(const dictionary& overrideDict)
|
|
||||||
{
|
|
||||||
if (regularWaveModel::read(overrideDict))
|
|
||||||
{
|
|
||||||
// Initialise m parameter and wavelength
|
|
||||||
initialise
|
|
||||||
(
|
|
||||||
waveHeight_,
|
|
||||||
waterDepthRef_,
|
|
||||||
wavePeriod_,
|
|
||||||
m_,
|
|
||||||
waveLength_
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::cnoidal::setVelocity
|
void Foam::waveModels::cnoidal::setVelocity
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -336,7 +289,7 @@ void Foam::waveModels::cnoidal::setVelocity
|
|||||||
{
|
{
|
||||||
const label paddlei = faceToPaddle_[facei];
|
const label paddlei = faceToPaddle_[facei];
|
||||||
|
|
||||||
const vector Uf = U
|
const vector Uf = this->Uf
|
||||||
(
|
(
|
||||||
waveHeight_,
|
waveHeight_,
|
||||||
waterDepthRef_,
|
waterDepthRef_,
|
||||||
@ -356,6 +309,55 @@ void Foam::waveModels::cnoidal::setVelocity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::cnoidal::cnoidal
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const polyPatch& patch,
|
||||||
|
const bool readFields
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regularWaveModel(dict, mesh, patch, false),
|
||||||
|
m_(0)
|
||||||
|
{
|
||||||
|
if (readFields)
|
||||||
|
{
|
||||||
|
readDict(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::waveModels::cnoidal::~cnoidal()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::waveModels::cnoidal::readDict(const dictionary& overrideDict)
|
||||||
|
{
|
||||||
|
if (regularWaveModel::readDict(overrideDict))
|
||||||
|
{
|
||||||
|
// Initialise m parameter and wavelength
|
||||||
|
initialise
|
||||||
|
(
|
||||||
|
waveHeight_,
|
||||||
|
waterDepthRef_,
|
||||||
|
wavePeriod_,
|
||||||
|
m_,
|
||||||
|
waveLength_
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModels::cnoidal::info(Ostream& os) const
|
void Foam::waveModels::cnoidal::info(Ostream& os) const
|
||||||
{
|
{
|
||||||
regularWaveModel::info(os);
|
regularWaveModel::info(os);
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,16 +49,11 @@ class cnoidal
|
|||||||
:
|
:
|
||||||
public regularWaveModel
|
public regularWaveModel
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// Protected data
|
// Private Member Functions
|
||||||
|
|
||||||
//- `m' coefficient
|
|
||||||
scalar m_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
|
||||||
|
|
||||||
|
//- Initialise
|
||||||
void initialise
|
void initialise
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
@ -69,7 +64,7 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Wave height
|
//- Wave height
|
||||||
virtual scalar eta
|
scalar eta
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar Kx,
|
const scalar Kx,
|
||||||
@ -107,7 +102,7 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Wave velocity
|
//- Wave velocity
|
||||||
virtual vector U
|
vector Uf
|
||||||
(
|
(
|
||||||
const scalar H,
|
const scalar H,
|
||||||
const scalar h,
|
const scalar h,
|
||||||
@ -121,6 +116,18 @@ protected:
|
|||||||
const scalar z
|
const scalar z
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- `m' coefficient
|
||||||
|
scalar m_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
|
||||||
//- Set the water level
|
//- Set the water level
|
||||||
virtual void setLevel
|
virtual void setLevel
|
||||||
(
|
(
|
||||||
@ -159,12 +166,13 @@ public:
|
|||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Info
|
//- Info
|
||||||
virtual void info(Ostream& os) const;
|
virtual void info(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace waveModels
|
} // End namespace waveModels
|
||||||
|
|||||||
@ -277,7 +277,7 @@ Foam::waveModel::waveModel
|
|||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
readDict(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ Foam::waveModel::~waveModel()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::waveModel::read(const dictionary& overrideDict)
|
bool Foam::waveModel::readDict(const dictionary& overrideDict)
|
||||||
{
|
{
|
||||||
readOpt() = IOobject::READ_IF_PRESENT;
|
readOpt() = IOobject::READ_IF_PRESENT;
|
||||||
if (headerOk())
|
if (headerOk())
|
||||||
|
|||||||
@ -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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -231,7 +231,7 @@ public:
|
|||||||
static word modelName(const word& patchName);
|
static word modelName(const word& patchName);
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& overrideDict);
|
virtual bool readDict(const dictionary& overrideDict);
|
||||||
|
|
||||||
//- Return the latest wave velocity prediction
|
//- Return the latest wave velocity prediction
|
||||||
virtual const vectorField& U() const;
|
virtual const vectorField& U() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user