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

This commit is contained in:
mattijs
2011-01-04 16:09:20 +00:00
1060 changed files with 8632 additions and 5641 deletions

View File

@ -8,6 +8,12 @@ wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
set -x
# update OpenFOAM version strings if required

View File

@ -50,7 +50,7 @@ const scalar
KRR4::c1X = 1.0/2.0, KRR4::c2X = -3.0/2.0, KRR4::c3X = 121.0/50.0,
KRR4::c4X = 29.0/250.0,
KRR4::a2X = 1.0, KRR4::a3X = 3.0/5.0;
};
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -31,7 +31,7 @@ defineTypeNameAndDebug(Foam::ODESolver, 0);
namespace Foam
{
defineRunTimeSelectionTable(ODESolver, ODE);
};
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -49,7 +49,7 @@ const scalar
RK::dc1 = RK::c1 - 2825.0/27648.0, RK::dc3 = RK::c3 - 18575.0/48384.0,
RK::dc4 = RK::c4 - 13525.0/55296.0, RK::dc5 = -277.00/14336.0,
RK::dc6 = RK::c6 - 0.25;
};
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -42,7 +42,7 @@ namespace Foam
SIBS::redMax = 1.0e-5,
SIBS::redMin = 0.7,
SIBS::scaleMX = 0.1;
};
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -109,12 +109,43 @@ bool Foam::setEnv
}
Foam::word Foam::hostName()
Foam::word Foam::hostName(bool full)
{
char buffer[256];
gethostname(buffer, 256);
char buf[128];
gethostname(buf, sizeof(buf));
return buffer;
// implementation as per hostname from net-tools
if (full)
{
struct hostent *hp = gethostbyname(buf);
if (hp)
{
return hp->h_name;
}
}
return buf;
}
Foam::word Foam::domainName()
{
char buf[128];
gethostname(buf, sizeof(buf));
// implementation as per hostname from net-tools
struct hostent *hp = gethostbyname(buf);
if (hp)
{
char *p = strchr(hp->h_name, '.');
if (p)
{
++p;
return p;
}
}
return word::null;
}
@ -191,8 +222,8 @@ Foam::fileName Foam::home(const word& userName)
Foam::fileName Foam::cwd()
{
char buf[255];
if (getcwd(buf, 255))
char buf[256];
if (getcwd(buf, sizeof(buf)))
{
return buf;
}
@ -947,8 +978,6 @@ bool Foam::ping
const label timeOut
)
{
char *serverAddress;
struct in_addr *ptr;
struct hostent *hostPtr;
volatile int sockfd;
struct sockaddr_in destAddr; // will hold the destination addr
@ -958,15 +987,13 @@ bool Foam::ping
{
FatalErrorIn
(
"Foam::ping(const word&, const label)"
"Foam::ping(const word&, ...)"
) << "gethostbyname error " << h_errno << " for host " << destName
<< abort(FatalError);
}
// Get first of the SLL of addresses
serverAddress = *(hostPtr->h_addr_list);
ptr = reinterpret_cast<struct in_addr*>(serverAddress);
addr = ptr->s_addr;
addr = (reinterpret_cast<struct in_addr*>(*(hostPtr->h_addr_list)))->s_addr;
// Allocate socket
sockfd = socket(AF_INET, SOCK_STREAM, 0);
@ -980,7 +1007,7 @@ bool Foam::ping
}
// Fill sockaddr_in structure with dest address and port
memset (reinterpret_cast<char *>(&destAddr), '\0', sizeof(destAddr));
memset(reinterpret_cast<char *>(&destAddr), '\0', sizeof(destAddr));
destAddr.sin_family = AF_INET;
destAddr.sin_port = htons(ushort(destPort));
destAddr.sin_addr.s_addr = addr;

View File

@ -55,7 +55,11 @@ const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
namespace Foam
{
template<>
const char* Foam::NamedEnum<Foam::fileMonitor::fileState, 3>::names[] =
const char* Foam::NamedEnum
<
Foam::fileMonitor::fileState,
3
>::names[] =
{
"unmodified",
"modified",

View File

@ -79,6 +79,12 @@ const Foam::memInfo& Foam::memInfo::update()
}
bool Foam::memInfo::valid() const
{
return peak_ != -1;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, memInfo& m)

View File

@ -105,6 +105,9 @@ public:
return rss_;
}
//- True if the memory information appears valid
bool valid() const;
// IOstream Operators

View File

@ -64,6 +64,13 @@ $(sha1)/SHA1Digest.C
primitives/random/Random/Random.C
primitives/random/cachedRandom/cachedRandom.H
ranges = primitives/ranges
$(ranges)/labelRange/labelRange.C
$(ranges)/labelRange/labelRanges.C
$(ranges)/scalarRange/scalarRange.C
$(ranges)/scalarRange/scalarRanges.C
containers/HashTables/HashTable/HashTableCore.C
containers/HashTables/StaticHashTable/StaticHashTableCore.C
containers/Lists/SortableList/ParSortableListName.C
@ -194,9 +201,6 @@ $(Time)/timeSelector.C
$(Time)/instant/instant.C
db/scalarRange/scalarRange.C
db/scalarRange/scalarRanges.C
dimensionSet/dimensionSet.C
dimensionSet/dimensionSetIO.C
dimensionSet/dimensionSets.C

View File

@ -36,8 +36,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template <class Type, class TrackingData>
const Foam::scalar
Foam::FaceCellWave<Type, TrackingData>::geomTol_ = 1e-6;
const Foam::scalar Foam::FaceCellWave<Type, TrackingData>::geomTol_ = 1e-6;
template <class Type, class TrackingData>
Foam::scalar Foam::FaceCellWave<Type, TrackingData>::propagationTol_ = 0.01;

View File

@ -47,7 +47,7 @@ Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
{
for (const_iterator iter = ht.begin(); iter != ht.end(); ++iter)
{
insert(iter.key(), new T(**iter));
this->insert(iter.key(), new T(**iter));
}
}
@ -129,11 +129,11 @@ void Foam::HashPtrTable<T, Key, Hash>::operator=
<< abort(FatalError);
}
clear();
this->clear();
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
insert(iter.key(), new T(**iter));
this->insert(iter.key(), new T(**iter));
}
}

View File

@ -98,7 +98,7 @@ public:
//- Construct from dictionary using default dictionary constructor
// class
HashPtrTable(const dictionary& dict);
HashPtrTable(const dictionary&);
//- Construct as copy
HashPtrTable(const HashPtrTable<T, Key, Hash>&);

View File

@ -65,7 +65,7 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inewt)
{
Key key;
is >> key;
insert(key, inewt(key, is).ptr());
this->insert(key, inewt(key, is).ptr());
is.fatalCheck
(
@ -112,7 +112,7 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inewt)
is.putBack(lastToken);
Key key;
is >> key;
insert(key, inewt(key, is).ptr());
this->insert(key, inewt(key, is).ptr());
is.fatalCheck
(
@ -148,7 +148,11 @@ void Foam::HashPtrTable<T, Key, Hash>::read
{
forAllConstIter(dictionary, dict, iter)
{
insert(iter().keyword(), inewt(dict.subDict(iter().keyword())).ptr());
this->insert
(
iter().keyword(),
inewt(dict.subDict(iter().keyword())).ptr()
);
}
}
@ -177,21 +181,21 @@ template<class T, class Key, class Hash>
template<class INew>
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(Istream& is, const INew& inewt)
{
read(is, inewt);
this->read(is, inewt);
}
template<class T, class Key, class Hash>
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(Istream& is)
{
read(is, INew<T>());
this->read(is, INew<T>());
}
template<class T, class Key, class Hash>
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(const dictionary& dict)
{
read(dict, INew<T>());
this->read(dict, INew<T>());
}

View File

@ -37,7 +37,7 @@ Foam::HashSet<Key, Hash>::HashSet(const UList<Key>& lst)
{
forAll(lst, elemI)
{
insert(lst[elemI]);
this->insert(lst[elemI]);
}
}
@ -59,7 +59,7 @@ Foam::HashSet<Key, Hash>::HashSet
++cit
)
{
insert(cit.key());
this->insert(cit.key());
}
}
@ -72,7 +72,7 @@ Foam::label Foam::HashSet<Key, Hash>::insert(const UList<Key>& lst)
label count = 0;
forAll(lst, elemI)
{
if (insert(lst[elemI]))
if (this->insert(lst[elemI]))
{
++count;
}
@ -87,7 +87,7 @@ Foam::label Foam::HashSet<Key, Hash>::insert(const UList<Key>& lst)
template<class Key, class Hash>
inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const
{
return found(key);
return this->found(key);
}
@ -106,7 +106,7 @@ bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) const
// Are all rhs elements in lhs?
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
{
if (!found(iter.key()))
if (!this->found(iter.key()))
{
return false;
}
@ -129,7 +129,7 @@ void Foam::HashSet<Key, Hash>::operator|=(const HashSet<Key, Hash>& rhs)
// Add rhs elements into lhs
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
{
insert(iter.key());
this->insert(iter.key());
}
}
@ -142,7 +142,7 @@ void Foam::HashSet<Key, Hash>::operator&=(const HashSet<Key, Hash>& rhs)
{
if (!rhs.found(iter.key()))
{
erase(iter);
this->erase(iter);
}
}
}
@ -154,13 +154,13 @@ void Foam::HashSet<Key, Hash>::operator^=(const HashSet<Key, Hash>& rhs)
// Add missed rhs elements, remove duplicate elements
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
{
if (found(iter.key()))
if (this->found(iter.key()))
{
erase(iter.key());
this->erase(iter.key());
}
else
{
insert(iter.key());
this->insert(iter.key());
}
}
}
@ -173,7 +173,7 @@ void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
// Remove rhs elements from lhs
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
{
erase(iter.key());
this->erase(iter.key());
}
}

View File

@ -82,7 +82,7 @@ inline bool Foam::HashTable<T, Key, Hash>::insert
const T& newEntry
)
{
return set(key, newEntry, true);
return this->set(key, newEntry, true);
}
@ -93,7 +93,7 @@ inline bool Foam::HashTable<T, Key, Hash>::set
const T& newEntry
)
{
return set(key, newEntry, false);
return this->set(key, newEntry, false);
}
@ -110,9 +110,9 @@ Foam::HashTable<T, Key, Hash>::xfer()
template<class T, class Key, class Hash>
inline T& Foam::HashTable<T, Key, Hash>::operator[](const Key& key)
{
iterator iter = find(key);
iterator iter = this->find(key);
if (iter == end())
if (iter == this->end())
{
FatalErrorIn("HashTable<T, Key, Hash>::operator[](const Key&)")
<< key << " not found in table. Valid entries: "
@ -127,9 +127,9 @@ inline T& Foam::HashTable<T, Key, Hash>::operator[](const Key& key)
template<class T, class Key, class Hash>
inline const T& Foam::HashTable<T, Key, Hash>::operator[](const Key& key) const
{
const_iterator iter = find(key);
const_iterator iter = this->find(key);
if (iter == cend())
if (iter == this->cend())
{
FatalErrorIn("HashTable<T, Key, Hash>::operator[](const Key&) const")
<< key << " not found in table. Valid entries: "
@ -144,11 +144,11 @@ inline const T& Foam::HashTable<T, Key, Hash>::operator[](const Key& key) const
template<class T, class Key, class Hash>
inline T& Foam::HashTable<T, Key, Hash>::operator()(const Key& key)
{
iterator iter = find(key);
iterator iter = this->find(key);
if (iter == end())
if (iter == this->end())
{
insert(key, T());
this->insert(key, T());
return *find(key);
}
else

View File

@ -39,7 +39,7 @@ Foam::ILList<LListBase, T>::ILList(const ILList<LListBase, T>& lst)
++iter
)
{
append(iter().clone().ptr());
this->append(iter().clone().ptr());
}
}
@ -62,7 +62,7 @@ Foam::ILList<LListBase, T>::ILList
++iter
)
{
append(iter().clone(cloneArg).ptr());
this->append(iter().clone(cloneArg).ptr());
}
}
#endif
@ -114,7 +114,7 @@ template<class LListBase, class T>
void Foam::ILList<LListBase, T>::clear()
{
label oldSize = this->size();
for (label i=0; i<oldSize; i++)
for (label i=0; i<oldSize; ++i)
{
eraseHead();
}
@ -145,7 +145,7 @@ void Foam::ILList<LListBase, T>::operator=(const ILList<LListBase, T>& lst)
++iter
)
{
append(iter().clone().ptr());
this->append(iter().clone().ptr());
}
}

View File

@ -53,9 +53,9 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
{
if (delimiter == token::BEGIN_LIST)
{
for (label i=0; i<s; i++)
for (label i=0; i<s; ++i)
{
append(iNew(is).ptr());
this->append(iNew(is).ptr());
is.fatalCheck
(
@ -67,7 +67,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
else
{
T* tPtr = iNew(is).ptr();
append(tPtr);
this->append(tPtr);
is.fatalCheck
(
@ -75,9 +75,9 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
"reading entry"
);
for (label i=1; i<s; i++)
for (label i=1; i<s; ++i)
{
append(new T(*tPtr));
this->append(new T(*tPtr));
}
}
}
@ -109,7 +109,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
)
{
is.putBack(lastToken);
append(iNew(is).ptr());
this->append(iNew(is).ptr());
is >> lastToken;
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
@ -131,14 +131,14 @@ template<class LListBase, class T>
template<class INew>
Foam::ILList<LListBase, T>::ILList(Istream& is, const INew& iNew)
{
read(is, iNew);
this->read(is, iNew);
}
template<class LListBase, class T>
Foam::ILList<LListBase, T>::ILList(Istream& is)
{
read(is, INew<T>());
this->read(is, INew<T>());
}
@ -154,6 +154,4 @@ Foam::Istream& Foam::operator>>(Istream& is, ILList<LListBase, T>& L)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -35,7 +35,7 @@ Foam::LList<LListBase, T>::LList(const LList<LListBase, T>& lst)
{
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter());
this->append(iter());
}
}
@ -53,9 +53,9 @@ template<class LListBase, class T>
void Foam::LList<LListBase, T>::clear()
{
label oldSize = this->size();
for (label i=0; i<oldSize; i++)
for (label i=0; i<oldSize; ++i)
{
removeHead();
this->removeHead();
}
LListBase::clear();
@ -79,7 +79,7 @@ void Foam::LList<LListBase, T>::operator=(const LList<LListBase, T>& lst)
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter());
this->append(iter());
}
}

View File

@ -238,10 +238,7 @@ public:
public:
//- Construct from base iterator
iterator
(
LListBase_iterator baseIter
)
iterator(LListBase_iterator baseIter)
:
LListBase_iterator(baseIter)
{}
@ -282,20 +279,14 @@ public:
public:
//- Construct from base const_iterator
const_iterator
(
LListBase_const_iterator baseIter
)
const_iterator(LListBase_const_iterator baseIter)
:
LListBase_const_iterator(baseIter)
{}
//- Construct from base iterator
const_iterator
(
LListBase_iterator baseIter
)
const_iterator(LListBase_iterator baseIter)
:
LListBase_const_iterator(baseIter)
{}

View File

@ -64,7 +64,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
{
if (delimiter == token::BEGIN_LIST)
{
for (register label i=0; i<s; i++)
for (register label i=0; i<s; ++i)
{
T element;
is >> element;
@ -76,7 +76,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
T element;
is >> element;
for (register label i=0; i<s; i++)
for (register label i=0; i<s; ++i)
{
L.append(element);
}

View File

@ -34,7 +34,7 @@ Foam::LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst)
{
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter().clone().ptr());
this->append(iter().clone().ptr());
}
}
@ -44,7 +44,7 @@ Foam::LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst)
template<class LListBase, class T>
Foam::LPtrList<LListBase, T>::~LPtrList()
{
clear();
this->clear();
}
@ -69,8 +69,8 @@ bool Foam::LPtrList<LListBase, T>::eraseHead()
template<class LListBase, class T>
void Foam::LPtrList<LListBase, T>::clear()
{
label oldSize = this->size();
for (label i=0; i<oldSize; i++)
const label oldSize = this->size();
for (label i=0; i<oldSize; ++i)
{
eraseHead();
}
@ -96,7 +96,7 @@ void Foam::LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst)
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter().clone().ptr());
this->append(iter().clone().ptr());
}
}

View File

@ -63,7 +63,7 @@ Ostream& operator<<
/*---------------------------------------------------------------------------*\
Class LPtrList Declaration
Class LPtrList Declaration
\*---------------------------------------------------------------------------*/
template<class LListBase, class T>
@ -75,7 +75,7 @@ class LPtrList
//- Read from Istream using given Istream constructor class
template<class INew>
void read(Istream&, const INew& inewt);
void read(Istream&, const INew&);
public:
@ -188,10 +188,7 @@ public:
public:
//- Construct from base iterator
iterator
(
LListBase_iterator baseIter
)
iterator(LListBase_iterator baseIter)
:
LList<LListBase, T*>::iterator(baseIter)
{}
@ -224,19 +221,13 @@ public:
public:
//- Construct from base const_iterator
const_iterator
(
LListBase_const_iterator baseIter
)
const_iterator(LListBase_const_iterator baseIter)
:
LList<LListBase, T*>::const_iterator(baseIter)
{}
//- Construct from base iterator
const_iterator
(
LListBase_iterator baseIter
)
const_iterator(LListBase_iterator baseIter)
:
LList<LListBase, T*>::const_iterator(baseIter)
{}

View File

@ -58,9 +58,9 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
{
if (delimiter == token::BEGIN_LIST)
{
for (label i=0; i<s; i++)
for (label i=0; i<s; ++i)
{
append(iNew(is).ptr());
this->append(iNew(is).ptr());
is.fatalCheck
(
@ -72,7 +72,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
else
{
T* tPtr = iNew(is).ptr();
append(tPtr);
this->append(tPtr);
is.fatalCheck
(
@ -80,9 +80,9 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
"reading entry"
);
for (label i=1; i<s; i++)
for (label i=1; i<s; ++i)
{
append(tPtr->clone().ptr());
this->append(tPtr->clone().ptr());
}
}
}
@ -114,7 +114,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
)
{
is.putBack(lastToken);
append(iNew(is).ptr());
this->append(iNew(is).ptr());
is >> lastToken;
is.fatalCheck
@ -144,14 +144,14 @@ template<class LListBase, class T>
template<class INew>
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& iNew)
{
read(is, iNew);
this->read(is, iNew);
}
template<class LListBase, class T>
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is)
{
read(is, INew<T>());
this->read(is, INew<T>());
}

View File

@ -32,7 +32,7 @@ Foam::UILList<LListBase, T>::UILList(const UILList<LListBase, T>& lst)
{
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(&iter());
this->append(&iter());
}
}
@ -46,7 +46,7 @@ void Foam::UILList<LListBase, T>::operator=(const UILList<LListBase, T>& rhs)
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
append(&iter());
this->append(&iter());
}
}

View File

@ -181,10 +181,7 @@ public:
public:
//- Construct from base iterator
iterator
(
LListBase_iterator baseIter
)
iterator(LListBase_iterator baseIter)
:
LListBase_iterator(baseIter)
{}
@ -223,19 +220,13 @@ public:
public:
//- Construct from base const_iterator
const_iterator
(
LListBase_const_iterator baseIter
)
const_iterator(LListBase_const_iterator baseIter)
:
LListBase_const_iterator(baseIter)
{}
//- Construct from base iterator
const_iterator
(
LListBase_iterator baseIter
)
const_iterator(LListBase_iterator baseIter)
:
LListBase_const_iterator(baseIter)
{}

View File

@ -26,6 +26,7 @@ Class
Description
A FIFO stack based on a singly-linked list.
Operations are push(), pop(), top(), bottom() and empty().
SourceFiles

View File

@ -26,6 +26,7 @@ Class
Description
A LIFO stack based on a singly-linked list.
Operations are push(), pop(), top(), bottom() and empty().
SourceFiles

View File

@ -35,7 +35,11 @@ defineTypeNameAndDebug(Foam::UPstream, 0);
namespace Foam
{
template<>
const char* Foam::NamedEnum<Foam::UPstream::commsTypes, 3>::names[] =
const char* Foam::NamedEnum
<
Foam::UPstream::commsTypes,
3
>::names[] =
{
"blocking",
"scheduled",

View File

@ -35,7 +35,11 @@ defineTypeNameAndDebug(Foam::Time, 0);
namespace Foam
{
template<>
const char* Foam::NamedEnum<Foam::Time::stopAtControls, 4>::names[] =
const char* Foam::NamedEnum
<
Foam::Time::stopAtControls,
4
>::names[] =
{
"endTime",
"noWriteNow",
@ -44,7 +48,11 @@ namespace Foam
};
template<>
const char* Foam::NamedEnum<Foam::Time::writeControls, 5>::names[] =
const char* Foam::NamedEnum
<
Foam::Time::writeControls,
5
>::names[] =
{
"timeStep",
"runTime",

View File

@ -31,6 +31,14 @@ License
defineTypeNameAndDebug(Foam::objectRegistry, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::objectRegistry::parentNotTime() const
{
return (&parent_ != dynamic_cast<const objectRegistry*>(&time_));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::objectRegistry::objectRegistry

View File

@ -69,6 +69,10 @@ class objectRegistry
// Private Member Functions
//- Is the objectRegistry parent_ different from time_
// Used to terminate searching within the ancestors
bool parentNotTime() const;
//- Disallow Copy constructor
objectRegistry(const objectRegistry&);

View File

@ -84,22 +84,13 @@ bool Foam::objectRegistry::foundObject(const word& name) const
{
return true;
}
else
{
return false;
}
}
else
else if (this->parentNotTime())
{
if (&parent_ != dynamic_cast<const objectRegistry*>(&time_))
{
return parent_.foundObject<Type>(name);
}
else
{
return false;
}
return parent_.foundObject<Type>(name);
}
return false;
}
@ -117,8 +108,10 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
return *vpsiPtr_;
}
FatalErrorIn("objectRegistry::lookupObject<Type>(const word&) const")
<< nl
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " lookup of " << name << " from objectRegistry "
<< this->name()
<< " successful\n but it is not a " << Type::typeName
@ -127,23 +120,21 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
}
else
{
if (&parent_ != dynamic_cast<const objectRegistry*>(&time_))
if (this->parentNotTime())
{
return parent_.lookupObject<Type>(name);
}
else
{
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " request for " << Type::typeName
<< " " << name << " from objectRegistry " << this->name()
<< " failed\n available objects of type " << Type::typeName
<< " are" << nl
<< names<Type>()
<< abort(FatalError);
}
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " request for " << Type::typeName
<< " " << name << " from objectRegistry " << this->name()
<< " failed\n available objects of type " << Type::typeName
<< " are" << nl
<< names<Type>()
<< abort(FatalError);
}
return *reinterpret_cast< const Type* >(0);

View File

@ -39,7 +39,11 @@ int Foam::regIOobject::fileModificationSkew
namespace Foam
{
template<>
const char* Foam::NamedEnum<Foam::regIOobject::fileCheckTypes, 4>::names[] =
const char* Foam::NamedEnum
<
Foam::regIOobject::fileCheckTypes,
4
>::names[] =
{
"timeStamp",
"timeStampMaster",

View File

@ -109,11 +109,19 @@ public: \
//- Define the typeName as @a Name for template classes
# define defineTemplateTypeNameWithName(Type, Name) \
defineTypeNameWithName(Type, Name)
//- Define the typeName as @a Name for template sub-classes
# define defineTemplate2TypeNameWithName(Type, Name) \
defineTypeNameWithName(Type, Name)
#else
//- Define the typeName as @a Name for template classes
# define defineTemplateTypeNameWithName(Type, Name) \
template<> \
defineTypeNameWithName(Type, Name)
//- Define the typeName as @a Name for template sub-classes
# define defineTemplate2TypeNameWithName(Type, Name) \
template<> \
template<> \
defineTypeNameWithName(Type, Name)
#endif
//- Define the typeName for template classes, useful with typedefs
@ -143,11 +151,19 @@ public: \
//- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
//- Define the debug information for templates sub-classes, lookup as @a Name
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
#else
//- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
template<> \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
//- Define the debug information for templates sub-classes, lookup as @a Name
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
template<> \
template<> \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
#endif
//- Define the debug information for templates
@ -160,6 +176,18 @@ public: \
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
// for templated sub-classes
//- Define the debug information for templates
// Useful with typedefs
#define defineTemplate2DebugSwitch(Type, DebugSwitch) \
defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch)
//- Define the debug information directly for templates
#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// definitions (with debug information)
@ -186,6 +214,19 @@ public: \
defineNamedTemplateTypeName(Type); \
defineNamedTemplateDebugSwitch(Type, DebugSwitch)
// for templated sub-classes
//- Define the typeName and debug information, lookup as @a Name
#define defineTemplate2TypeNameAndDebugWithName(Type, Name, DebugSwitch) \
defineTemplate2TypeNameWithName(Type, Name); \
defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch)
//- Define the typeName and debug information for templates, useful
// with typedefs
#define defineTemplate2TypeNameAndDebug(Type, DebugSwitch) \
defineTemplate2TypeNameAndDebugWithName(Type, #Type, DebugSwitch)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -459,7 +459,7 @@ void DimensionedField<Type, GeoMesh>::operator=
checkField(*this, df, "=");
dimensions_ = df.dimensions();
transfer(const_cast<DimensionedField<Type, GeoMesh>&>(df));
this->transfer(const_cast<DimensionedField<Type, GeoMesh>&>(df));
tdf.clear();
}

View File

@ -26,15 +26,11 @@ License
#include "DimensionedField.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type, class GeoMesh>
void DimensionedField<Type, GeoMesh>::readField
void Foam::DimensionedField<Type, GeoMesh>::readField
(
const dictionary& fieldDict,
const word& fieldDictEntry
@ -43,12 +39,15 @@ void DimensionedField<Type, GeoMesh>::readField
dimensions_.reset(dimensionSet(fieldDict.lookup("dimensions")));
Field<Type> f(fieldDictEntry, fieldDict, GeoMesh::size(mesh_));
transfer(f);
this->transfer(f);
}
template<class Type, class GeoMesh>
void DimensionedField<Type, GeoMesh>::readIfPresent(const word& fieldDictEntry)
void Foam::DimensionedField<Type, GeoMesh>::readIfPresent
(
const word& fieldDictEntry
)
{
if
(
@ -65,7 +64,7 @@ void DimensionedField<Type, GeoMesh>::readIfPresent(const word& fieldDictEntry)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
DimensionedField<Type, GeoMesh>::DimensionedField
Foam::DimensionedField<Type, GeoMesh>::DimensionedField
(
const IOobject& io,
const Mesh& mesh,
@ -84,7 +83,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
bool DimensionedField<Type, GeoMesh>::writeData
bool Foam::DimensionedField<Type, GeoMesh>::writeData
(
Ostream& os,
const word& fieldDictEntry
@ -107,7 +106,7 @@ bool DimensionedField<Type, GeoMesh>::writeData
template<class Type, class GeoMesh>
bool DimensionedField<Type, GeoMesh>::writeData(Ostream& os) const
bool Foam::DimensionedField<Type, GeoMesh>::writeData(Ostream& os) const
{
return writeData(os, "value");
}
@ -116,7 +115,11 @@ bool DimensionedField<Type, GeoMesh>::writeData(Ostream& os) const
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type, class GeoMesh>
Ostream& operator<<(Ostream& os, const DimensionedField<Type, GeoMesh>& df)
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const DimensionedField<Type, GeoMesh>& df
)
{
df.writeData(os);
@ -125,7 +128,7 @@ Ostream& operator<<(Ostream& os, const DimensionedField<Type, GeoMesh>& df)
template<class Type, class GeoMesh>
Ostream& operator<<
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const tmp<DimensionedField<Type, GeoMesh> >& tdf
@ -138,8 +141,4 @@ Ostream& operator<<
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,42 +28,37 @@ License
#include "dictionary.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
template<class Type>
const char* const Field<Type>::typeName("Field");
const char* const Foam::Field<Type>::typeName("Field");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Field<Type>::Field()
Foam::Field<Type>::Field()
:
List<Type>()
{}
template<class Type>
Field<Type>::Field(const label size)
Foam::Field<Type>::Field(const label size)
:
List<Type>(size)
{}
template<class Type>
Field<Type>::Field(const label size, const Type& t)
Foam::Field<Type>::Field(const label size, const Type& t)
:
List<Type>(size, t)
{}
template<class Type>
Field<Type>::Field
Foam::Field<Type>::Field
(
const UList<Type>& mapF,
const labelUList& mapAddressing
@ -74,8 +69,9 @@ Field<Type>::Field
map(mapF, mapAddressing);
}
template<class Type>
Field<Type>::Field
Foam::Field<Type>::Field
(
const tmp<Field<Type> >& tmapF,
const labelUList& mapAddressing
@ -88,7 +84,7 @@ Field<Type>::Field
template<class Type>
Field<Type>::Field
Foam::Field<Type>::Field
(
const UList<Type>& mapF,
const labelListList& mapAddressing,
@ -100,8 +96,9 @@ Field<Type>::Field
map(mapF, mapAddressing, mapWeights);
}
template<class Type>
Field<Type>::Field
Foam::Field<Type>::Field
(
const tmp<Field<Type> >& tmapF,
const labelListList& mapAddressing,
@ -115,7 +112,7 @@ Field<Type>::Field
template<class Type>
Field<Type>::Field
Foam::Field<Type>::Field
(
const UList<Type>& mapF,
const FieldMapper& mapper
@ -126,8 +123,9 @@ Field<Type>::Field
map(mapF, mapper);
}
template<class Type>
Field<Type>::Field
Foam::Field<Type>::Field
(
const tmp<Field<Type> >& tmapF,
const FieldMapper& mapper
@ -140,7 +138,7 @@ Field<Type>::Field
template<class Type>
Field<Type>::Field(const Field<Type>& f)
Foam::Field<Type>::Field(const Field<Type>& f)
:
refCount(),
List<Type>(f)
@ -148,35 +146,37 @@ Field<Type>::Field(const Field<Type>& f)
template<class Type>
Field<Type>::Field(Field<Type>& f, bool reUse)
Foam::Field<Type>::Field(Field<Type>& f, bool reUse)
:
List<Type>(f, reUse)
{}
template<class Type>
Field<Type>::Field(const Xfer<List<Type> >& f)
Foam::Field<Type>::Field(const Xfer<List<Type> >& f)
:
List<Type>(f)
{}
template<class Type>
Field<Type>::Field(const Xfer<Field<Type> >& f)
Foam::Field<Type>::Field(const Xfer<Field<Type> >& f)
:
List<Type>(f)
{}
#ifdef __INTEL_COMPILER
template<class Type>
Field<Type>::Field(const typename Field<Type>::subField& sf)
Foam::Field<Type>::Field(const typename Field<Type>::subField& sf)
:
List<Type>(sf)
{}
#endif
template<class Type>
Field<Type>::Field(const UList<Type>& list)
Foam::Field<Type>::Field(const UList<Type>& list)
:
List<Type>(list)
{}
@ -185,7 +185,7 @@ Field<Type>::Field(const UList<Type>& list)
// Construct as copy of tmp<Field>
#ifdef ConstructFromTmp
template<class Type>
Field<Type>::Field(const tmp<Field<Type> >& tf)
Foam::Field<Type>::Field(const tmp<Field<Type> >& tf)
:
List<Type>(const_cast<Field<Type>&>(tf()), tf.isTmp())
{
@ -195,14 +195,14 @@ Field<Type>::Field(const tmp<Field<Type> >& tf)
template<class Type>
Field<Type>::Field(Istream& is)
Foam::Field<Type>::Field(Istream& is)
:
List<Type>(is)
{}
template<class Type>
Field<Type>::Field
Foam::Field<Type>::Field
(
const word& keyword,
const dictionary& dict,
@ -285,7 +285,7 @@ Field<Type>::Field
template<class Type>
tmp<Field<Type> > Field<Type>::clone() const
Foam::tmp<Foam::Field<Type> > Foam::Field<Type>::clone() const
{
return tmp<Field<Type> >(new Field<Type>(*this));
}
@ -294,7 +294,7 @@ tmp<Field<Type> > Field<Type>::clone() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Field<Type>::map
void Foam::Field<Type>::map
(
const UList<Type>& mapF,
const labelUList& mapAddressing
@ -323,7 +323,7 @@ void Field<Type>::map
template<class Type>
void Field<Type>::map
void Foam::Field<Type>::map
(
const tmp<Field<Type> >& tmapF,
const labelUList& mapAddressing
@ -335,7 +335,7 @@ void Field<Type>::map
template<class Type>
void Field<Type>::map
void Foam::Field<Type>::map
(
const UList<Type>& mapF,
const labelListList& mapAddressing,
@ -378,8 +378,9 @@ void Field<Type>::map
}
}
template<class Type>
void Field<Type>::map
void Foam::Field<Type>::map
(
const tmp<Field<Type> >& tmapF,
const labelListList& mapAddressing,
@ -392,7 +393,7 @@ void Field<Type>::map
template<class Type>
void Field<Type>::map
void Foam::Field<Type>::map
(
const UList<Type>& mapF,
const FieldMapper& mapper
@ -413,8 +414,9 @@ void Field<Type>::map
}
}
template<class Type>
void Field<Type>::map
void Foam::Field<Type>::map
(
const tmp<Field<Type> >& tmapF,
const FieldMapper& mapper
@ -426,7 +428,7 @@ void Field<Type>::map
template<class Type>
void Field<Type>::autoMap
void Foam::Field<Type>::autoMap
(
const FieldMapper& mapper
)
@ -452,7 +454,7 @@ void Field<Type>::autoMap
template<class Type>
void Field<Type>::rmap
void Foam::Field<Type>::rmap
(
const UList<Type>& mapF,
const labelUList& mapAddressing
@ -471,8 +473,9 @@ void Field<Type>::rmap
}
}
template<class Type>
void Field<Type>::rmap
void Foam::Field<Type>::rmap
(
const tmp<Field<Type> >& tmapF,
const labelUList& mapAddressing
@ -484,7 +487,7 @@ void Field<Type>::rmap
template<class Type>
void Field<Type>::rmap
void Foam::Field<Type>::rmap
(
const UList<Type>& mapF,
const labelUList& mapAddressing,
@ -501,8 +504,9 @@ void Field<Type>::rmap
}
}
template<class Type>
void Field<Type>::rmap
void Foam::Field<Type>::rmap
(
const tmp<Field<Type> >& tmapF,
const labelUList& mapAddressing,
@ -515,14 +519,15 @@ void Field<Type>::rmap
template<class Type>
void Field<Type>::negate()
void Foam::Field<Type>::negate()
{
TFOR_ALL_F_OP_OP_F(Type, *this, =, -, Type, *this)
}
template<class Type>
tmp<Field<typename Field<Type>::cmptType> > Field<Type>::component
Foam::tmp<Foam::Field<typename Foam::Field<Type>::cmptType> >
Foam::Field<Type>::component
(
const direction d
) const
@ -534,7 +539,7 @@ tmp<Field<typename Field<Type>::cmptType> > Field<Type>::component
template<class Type>
void Field<Type>::replace
void Foam::Field<Type>::replace
(
const direction d,
const UList<cmptType>& sf
@ -546,7 +551,7 @@ void Field<Type>::replace
template<class Type>
void Field<Type>::replace
void Foam::Field<Type>::replace
(
const direction d,
const tmp<Field<cmptType> >& tsf
@ -558,7 +563,7 @@ void Field<Type>::replace
template<class Type>
void Field<Type>::replace
void Foam::Field<Type>::replace
(
const direction d,
const cmptType& c
@ -570,7 +575,7 @@ void Field<Type>::replace
template<class Type>
tmp<Field<Type> > Field<Type>::T() const
Foam::tmp<Foam::Field<Type> > Foam::Field<Type>::T() const
{
tmp<Field<Type> > transpose(new Field<Type>(this->size()));
::Foam::T(transpose(), *this);
@ -579,7 +584,7 @@ tmp<Field<Type> > Field<Type>::T() const
template<class Type>
void Field<Type>::writeEntry(const word& keyword, Ostream& os) const
void Foam::Field<Type>::writeEntry(const word& keyword, Ostream& os) const
{
os.writeKeyword(keyword);
@ -617,7 +622,7 @@ void Field<Type>::writeEntry(const word& keyword, Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Field<Type>::operator=(const Field<Type>& rhs)
void Foam::Field<Type>::operator=(const Field<Type>& rhs)
{
if (this == &rhs)
{
@ -631,21 +636,21 @@ void Field<Type>::operator=(const Field<Type>& rhs)
template<class Type>
void Field<Type>::operator=(const SubField<Type>& rhs)
void Foam::Field<Type>::operator=(const SubField<Type>& rhs)
{
List<Type>::operator=(rhs);
}
template<class Type>
void Field<Type>::operator=(const UList<Type>& rhs)
void Foam::Field<Type>::operator=(const UList<Type>& rhs)
{
List<Type>::operator=(rhs);
}
template<class Type>
void Field<Type>::operator=(const tmp<Field>& rhs)
void Foam::Field<Type>::operator=(const tmp<Field>& rhs)
{
if (this == &(rhs()))
{
@ -662,7 +667,7 @@ void Field<Type>::operator=(const tmp<Field>& rhs)
template<class Type>
void Field<Type>::operator=(const Type& t)
void Foam::Field<Type>::operator=(const Type& t)
{
List<Type>::operator=(t);
}
@ -670,7 +675,7 @@ void Field<Type>::operator=(const Type& t)
template<class Type>
template<class Form, class Cmpt, int nCmpt>
void Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs)
void Foam::Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs)
{
typedef VectorSpace<Form,Cmpt,nCmpt> VSType;
TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs)
@ -680,20 +685,20 @@ void Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs)
#define COMPUTED_ASSIGNMENT(TYPE, op) \
\
template<class Type> \
void Field<Type>::operator op(const UList<TYPE>& f) \
void Foam::Field<Type>::operator op(const UList<TYPE>& f) \
{ \
TFOR_ALL_F_OP_F(Type, *this, op, TYPE, f) \
} \
\
template<class Type> \
void Field<Type>::operator op(const tmp<Field<TYPE> >& tf) \
void Foam::Field<Type>::operator op(const tmp<Field<TYPE> >& tf) \
{ \
operator op(tf()); \
tf.clear(); \
} \
\
template<class Type> \
void Field<Type>::operator op(const TYPE& t) \
void Foam::Field<Type>::operator op(const TYPE& t) \
{ \
TFOR_ALL_F_OP_S(Type, *this, op, TYPE, t) \
}
@ -709,17 +714,17 @@ COMPUTED_ASSIGNMENT(scalar, /=)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class Type>
Ostream& operator<<(Ostream& os, const Field<Type>& f)
Foam::Ostream& Foam::operator<<(Ostream& os, const Field<Type>& f)
{
os << static_cast<const List<Type>&>(f);
os << static_cast<const List<Type>&>(f);
return os;
}
template<class Type>
Ostream& operator<<(Ostream& os, const tmp<Field<Type> >& tf)
Foam::Ostream& Foam::operator<<(Ostream& os, const tmp<Field<Type> >& tf)
{
os << tf();
os << tf();
tf.clear();
return os;
}
@ -727,10 +732,6 @@ Ostream& operator<<(Ostream& os, const tmp<Field<Type> >& tf)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "FieldFunctions.C"
#include "FieldFunctions.C"
// ************************************************************************* //

View File

@ -176,8 +176,10 @@ public:
//- Construct by transferring the Field contents
Field(const Xfer<Field<Type> >&);
#ifdef __INTEL_COMPILER
//- Construct as copy of subField
Field(const typename Field<Type>::subField&);
#endif
//- Construct as copy of tmp<Field>
# ifdef ConstructFromTmp
@ -188,7 +190,7 @@ public:
Field(Istream&);
//- Construct from a dictionary entry
Field(const word& keyword, const dictionary& dict, const label size);
Field(const word& keyword, const dictionary&, const label size);
//- Clone
tmp<Field<Type> > clone() const;

View File

@ -53,7 +53,7 @@ GeometricBoundaryField
forAll(bmesh_, patchi)
{
set
this->set
(
patchi,
PatchField<Type>::New
@ -112,7 +112,7 @@ GeometricBoundaryField
{
forAll(bmesh_, patchi)
{
set
this->set
(
patchi,
PatchField<Type>::New
@ -129,7 +129,7 @@ GeometricBoundaryField
{
forAll(bmesh_, patchi)
{
set
this->set
(
patchi,
PatchField<Type>::New
@ -167,7 +167,7 @@ GeometricBoundaryField
forAll(bmesh_, patchi)
{
set(patchi, ptfl[patchi].clone(field));
this->set(patchi, ptfl[patchi].clone(field));
}
}
@ -195,7 +195,7 @@ GeometricBoundaryField
forAll(bmesh_, patchi)
{
set(patchi, btf[patchi].clone(field));
this->set(patchi, btf[patchi].clone(field));
}
}
@ -275,7 +275,7 @@ GeometricBoundaryField
<< " to split cyclics." << exit(FatalIOError);
}
set
this->set
(
patchi,
PatchField<Type>::New
@ -288,7 +288,7 @@ GeometricBoundaryField
}
else
{
set
this->set
(
patchi,
PatchField<Type>::New

View File

@ -941,7 +941,14 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
{
word name = this->name();
if (this->mesh().data::lookupOrDefault<bool>("finalIteration", false))
if
(
this->mesh().data::template lookupOrDefault<bool>
(
"finalIteration",
false
)
)
{
name += "Final";
}

View File

@ -74,8 +74,8 @@ void MapGeometricFields
{
HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
(
mapper.thisDb().objectRegistry::lookupClass
<GeometricField<Type, PatchField, GeoMesh> >()
mapper.thisDb().objectRegistry::template
lookupClass<GeometricField<Type, PatchField, GeoMesh> >()
);
// It is necessary to enforce that all old-time fields are stored

View File

@ -31,21 +31,22 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebug(pointScalarField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(pointVectorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug
defineTemplate2TypeNameAndDebug(pointScalarField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug(pointVectorField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug
(
pointSphericalTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug
defineTemplate2TypeNameAndDebug
(
pointSymmTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug(pointTensorField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug(pointTensorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(pointScalarField, 0);
defineTemplateTypeNameAndDebug(pointVectorField, 0);

View File

@ -64,9 +64,6 @@ public:
// Constructors
//- Construct null
UniformDimensionedField();
//- Construct from components
UniformDimensionedField(const IOobject&, const dimensioned<Type>&);

View File

@ -27,15 +27,11 @@ License
#include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
Foam::basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -46,7 +42,7 @@ basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
template<class Type>
basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
Foam::basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -58,7 +54,7 @@ basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
template<class Type>
basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
Foam::basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
(
const basicSymmetryPointPatchField<Type>& ptf,
const pointPatch& p,
@ -71,7 +67,7 @@ basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
template<class Type>
basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
Foam::basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
(
const basicSymmetryPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -84,7 +80,10 @@ basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void basicSymmetryPointPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::basicSymmetryPointPatchField<Type>::evaluate
(
const Pstream::commsTypes
)
{
const vectorField& nHat = this->patch().pointNormals();
@ -99,12 +98,8 @@ void basicSymmetryPointPatchField<Type>::evaluate(const Pstream::commsTypes)
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
this->setInInternalField(iF, tvalues());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,15 +26,11 @@ License
#include "mixedPointPatchField.H"
#include "pointPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void mixedPointPatchField<Type>::checkFieldSize() const
void Foam::mixedPointPatchField<Type>::checkFieldSize() const
{
if
(
@ -59,7 +55,7 @@ void mixedPointPatchField<Type>::checkFieldSize() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
mixedPointPatchField<Type>::mixedPointPatchField
Foam::mixedPointPatchField<Type>::mixedPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -72,7 +68,7 @@ mixedPointPatchField<Type>::mixedPointPatchField
template<class Type>
mixedPointPatchField<Type>::mixedPointPatchField
Foam::mixedPointPatchField<Type>::mixedPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -86,7 +82,7 @@ mixedPointPatchField<Type>::mixedPointPatchField
template<class Type>
mixedPointPatchField<Type>::mixedPointPatchField
Foam::mixedPointPatchField<Type>::mixedPointPatchField
(
const mixedPointPatchField<Type>& ptf,
const pointPatch& p,
@ -108,7 +104,7 @@ mixedPointPatchField<Type>::mixedPointPatchField
template<class Type>
mixedPointPatchField<Type>::mixedPointPatchField
Foam::mixedPointPatchField<Type>::mixedPointPatchField
(
const mixedPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -124,7 +120,7 @@ mixedPointPatchField<Type>::mixedPointPatchField
// Map and resize from self given a mapper
template<class Type>
void mixedPointPatchField<Type>::autoMap
void Foam::mixedPointPatchField<Type>::autoMap
(
const pointPatchFieldMapper& m
)
@ -137,7 +133,7 @@ void mixedPointPatchField<Type>::autoMap
// Grab the values using rmap
template<class Type>
void mixedPointPatchField<Type>::rmap
void Foam::mixedPointPatchField<Type>::rmap
(
const pointPatchField<Type>& ptf,
const labelList& addr
@ -154,7 +150,7 @@ void mixedPointPatchField<Type>::rmap
// Evaluate patch field
template<class Type>
void mixedPointPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::mixedPointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
Field<Type>::operator=
(
@ -165,13 +161,13 @@ void mixedPointPatchField<Type>::evaluate(const Pstream::commsTypes)
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, *this);
this->setInInternalField(iF, *this);
}
// Write
template<class Type>
void mixedPointPatchField<Type>::write(Ostream& os) const
void Foam::mixedPointPatchField<Type>::write(Ostream& os) const
{
pointPatchField<Type>::write(os);
refValue_.writeEntry("refValue", os);
@ -179,8 +175,4 @@ void mixedPointPatchField<Type>::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,17 +26,12 @@ License
#include "valuePointPatchField.H"
#include "pointPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void valuePointPatchField<Type>::checkFieldSize() const
void Foam::valuePointPatchField<Type>::checkFieldSize() const
{
if (size() != this->patch().size())
if (this->size() != this->patch().size())
{
FatalErrorIn
(
@ -52,7 +47,7 @@ void valuePointPatchField<Type>::checkFieldSize() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class Type>
valuePointPatchField<Type>::valuePointPatchField
Foam::valuePointPatchField<Type>::valuePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -64,7 +59,7 @@ valuePointPatchField<Type>::valuePointPatchField
template<class Type>
valuePointPatchField<Type>::valuePointPatchField
Foam::valuePointPatchField<Type>::valuePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -105,7 +100,7 @@ valuePointPatchField<Type>::valuePointPatchField
template<class Type>
valuePointPatchField<Type>::valuePointPatchField
Foam::valuePointPatchField<Type>::valuePointPatchField
(
const valuePointPatchField<Type>& ptf,
const pointPatch& p,
@ -119,7 +114,7 @@ valuePointPatchField<Type>::valuePointPatchField
template<class Type>
valuePointPatchField<Type>::valuePointPatchField
Foam::valuePointPatchField<Type>::valuePointPatchField
(
const valuePointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -133,7 +128,7 @@ valuePointPatchField<Type>::valuePointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void valuePointPatchField<Type>::autoMap
void Foam::valuePointPatchField<Type>::autoMap
(
const pointPatchFieldMapper& m
)
@ -143,7 +138,7 @@ void valuePointPatchField<Type>::autoMap
template<class Type>
void valuePointPatchField<Type>::rmap
void Foam::valuePointPatchField<Type>::rmap
(
const pointPatchField<Type>& ptf,
const labelList& addr
@ -161,7 +156,7 @@ void valuePointPatchField<Type>::rmap
template<class Type>
void valuePointPatchField<Type>::updateCoeffs()
void Foam::valuePointPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
@ -171,26 +166,26 @@ void valuePointPatchField<Type>::updateCoeffs()
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, *this);
this->setInInternalField(iF, *this);
pointPatchField<Type>::updateCoeffs();
}
template<class Type>
void valuePointPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::valuePointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, *this);
this->setInInternalField(iF, *this);
pointPatchField<Type>::evaluate();
}
template<class Type>
void valuePointPatchField<Type>::write(Ostream& os) const
void Foam::valuePointPatchField<Type>::write(Ostream& os) const
{
pointPatchField<Type>::write(os);
this->writeEntry("value", os);
@ -200,7 +195,7 @@ void valuePointPatchField<Type>::write(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void valuePointPatchField<Type>::operator=
void Foam::valuePointPatchField<Type>::operator=
(
const valuePointPatchField<Type>& ptf
)
@ -210,7 +205,7 @@ void valuePointPatchField<Type>::operator=
template<class Type>
void valuePointPatchField<Type>::operator=
void Foam::valuePointPatchField<Type>::operator=
(
const pointPatchField<Type>& ptf
)
@ -220,7 +215,7 @@ void valuePointPatchField<Type>::operator=
template<class Type>
void valuePointPatchField<Type>::operator=
void Foam::valuePointPatchField<Type>::operator=
(
const Field<Type>& tf
)
@ -230,7 +225,7 @@ void valuePointPatchField<Type>::operator=
template<class Type>
void valuePointPatchField<Type>::operator=
void Foam::valuePointPatchField<Type>::operator=
(
const Type& t
)
@ -241,7 +236,7 @@ void valuePointPatchField<Type>::operator=
// Force an assignment
template<class Type>
void valuePointPatchField<Type>::operator==
void Foam::valuePointPatchField<Type>::operator==
(
const valuePointPatchField<Type>& ptf
)
@ -251,7 +246,7 @@ void valuePointPatchField<Type>::operator==
template<class Type>
void valuePointPatchField<Type>::operator==
void Foam::valuePointPatchField<Type>::operator==
(
const pointPatchField<Type>& ptf
)
@ -261,7 +256,7 @@ void valuePointPatchField<Type>::operator==
template<class Type>
void valuePointPatchField<Type>::operator==
void Foam::valuePointPatchField<Type>::operator==
(
const Field<Type>& tf
)
@ -271,7 +266,7 @@ void valuePointPatchField<Type>::operator==
template<class Type>
void valuePointPatchField<Type>::operator==
void Foam::valuePointPatchField<Type>::operator==
(
const Type& t
)
@ -280,8 +275,4 @@ void valuePointPatchField<Type>::operator==
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,15 +28,10 @@ License
#include "transformField.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
cyclicPointPatchField<Type>::cyclicPointPatchField
Foam::cyclicPointPatchField<Type>::cyclicPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -48,7 +43,7 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
template<class Type>
cyclicPointPatchField<Type>::cyclicPointPatchField
Foam::cyclicPointPatchField<Type>::cyclicPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -77,7 +72,7 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
template<class Type>
cyclicPointPatchField<Type>::cyclicPointPatchField
Foam::cyclicPointPatchField<Type>::cyclicPointPatchField
(
const cyclicPointPatchField<Type>& ptf,
const pointPatch& p,
@ -109,7 +104,7 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
template<class Type>
cyclicPointPatchField<Type>::cyclicPointPatchField
Foam::cyclicPointPatchField<Type>::cyclicPointPatchField
(
const cyclicPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -123,7 +118,7 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void cyclicPointPatchField<Type>::swapAddSeparated
void Foam::cyclicPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>& pField
@ -177,14 +172,10 @@ void cyclicPointPatchField<Type>::swapAddSeparated
Swap(pf[pairs[pairi][0]], nbrPf[pairs[pairi][1]]);
}
}
addToInternalField(pField, pf);
this->addToInternalField(pField, pf);
nbr.addToInternalField(pField, nbrPf);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,15 +27,11 @@ License
#include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
Foam::cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -46,7 +42,7 @@ cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
Foam::cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -58,7 +54,7 @@ cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
Foam::cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const cyclicSlipPointPatchField<Type>& ptf,
const pointPatch& p,
@ -71,7 +67,7 @@ cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
Foam::cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const cyclicSlipPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -84,7 +80,7 @@ cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void cyclicSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::cyclicSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
const vectorField& nHat = this->patch().pointNormals();
@ -99,12 +95,8 @@ void cyclicSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
this->setInInternalField(iF, tvalues());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,15 +27,11 @@ License
#include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
nonuniformTransformCyclicPointPatchField<Type>::
Foam::nonuniformTransformCyclicPointPatchField<Type>::
nonuniformTransformCyclicPointPatchField
(
const pointPatch& p,
@ -47,7 +43,7 @@ nonuniformTransformCyclicPointPatchField
template<class Type>
nonuniformTransformCyclicPointPatchField<Type>::
Foam::nonuniformTransformCyclicPointPatchField<Type>::
nonuniformTransformCyclicPointPatchField
(
const pointPatch& p,
@ -60,7 +56,7 @@ nonuniformTransformCyclicPointPatchField
template<class Type>
nonuniformTransformCyclicPointPatchField<Type>::
Foam::nonuniformTransformCyclicPointPatchField<Type>::
nonuniformTransformCyclicPointPatchField
(
const nonuniformTransformCyclicPointPatchField<Type>& ptf,
@ -74,7 +70,7 @@ nonuniformTransformCyclicPointPatchField
template<class Type>
nonuniformTransformCyclicPointPatchField<Type>::
Foam::nonuniformTransformCyclicPointPatchField<Type>::
nonuniformTransformCyclicPointPatchField
(
const nonuniformTransformCyclicPointPatchField<Type>& ptf,
@ -88,7 +84,7 @@ nonuniformTransformCyclicPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void nonuniformTransformCyclicPointPatchField<Type>::evaluate
void Foam::nonuniformTransformCyclicPointPatchField<Type>::evaluate
(
const Pstream::commsTypes
)
@ -106,12 +102,8 @@ void nonuniformTransformCyclicPointPatchField<Type>::evaluate
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
this->setInInternalField(iF, tvalues());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,15 +27,11 @@ License
#include "transformField.H"
#include "processorPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -47,7 +43,7 @@ processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
template<class Type>
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -60,7 +56,7 @@ processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
template<class Type>
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
(
const processorCyclicPointPatchField<Type>& ptf,
const pointPatch& p,
@ -74,7 +70,7 @@ processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
template<class Type>
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
(
const processorCyclicPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -88,14 +84,14 @@ processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorCyclicPointPatchField<Type>::~processorCyclicPointPatchField()
Foam::processorCyclicPointPatchField<Type>::~processorCyclicPointPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void processorCyclicPointPatchField<Type>::initSwapAddSeparated
void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
@ -126,7 +122,7 @@ void processorCyclicPointPatchField<Type>::initSwapAddSeparated
template<class Type>
void processorCyclicPointPatchField<Type>::swapAddSeparated
void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
@ -155,13 +151,9 @@ void processorCyclicPointPatchField<Type>::swapAddSeparated
}
// All points are separated
addToInternalField(pField, pnf);
this->addToInternalField(pField, pnf);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,15 +26,11 @@ License
#include "wedgePointPatchField.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
wedgePointPatchField<Type>::wedgePointPatchField
Foam::wedgePointPatchField<Type>::wedgePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -45,7 +41,7 @@ wedgePointPatchField<Type>::wedgePointPatchField
template<class Type>
wedgePointPatchField<Type>::wedgePointPatchField
Foam::wedgePointPatchField<Type>::wedgePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -73,7 +69,7 @@ wedgePointPatchField<Type>::wedgePointPatchField
template<class Type>
wedgePointPatchField<Type>::wedgePointPatchField
Foam::wedgePointPatchField<Type>::wedgePointPatchField
(
const wedgePointPatchField<Type>& ptf,
const pointPatch& p,
@ -104,7 +100,7 @@ wedgePointPatchField<Type>::wedgePointPatchField
template<class Type>
wedgePointPatchField<Type>::wedgePointPatchField
Foam::wedgePointPatchField<Type>::wedgePointPatchField
(
const wedgePointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -117,7 +113,7 @@ wedgePointPatchField<Type>::wedgePointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void wedgePointPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::wedgePointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
// In order to ensure that the wedge patch is always flat, take the
// normal vector from the first point
@ -129,12 +125,8 @@ void wedgePointPatchField<Type>::evaluate(const Pstream::commsTypes)
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
this->setInInternalField(iF, tvalues());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -25,15 +25,10 @@ License
#include "fixedNormalSlipPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
Foam::fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
@ -45,7 +40,7 @@ fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
Foam::fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
@ -58,7 +53,7 @@ fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
Foam::fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>& ptf,
const pointPatch& p,
@ -72,7 +67,7 @@ fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
Foam::fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
@ -86,7 +81,10 @@ fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void fixedNormalSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::fixedNormalSlipPointPatchField<Type>::evaluate
(
const Pstream::commsTypes
)
{
tmp<Field<Type> > tvalues =
transform(I - n_*n_, this->patchInternalField());
@ -94,12 +92,12 @@ void fixedNormalSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
this->setInInternalField(iF, tvalues());
}
template<class Type>
void fixedNormalSlipPointPatchField<Type>::write(Ostream& os) const
void Foam::fixedNormalSlipPointPatchField<Type>::write(Ostream& os) const
{
slipPointPatchField<Type>::write(os);
os.writeKeyword("n")
@ -107,8 +105,4 @@ void fixedNormalSlipPointPatchField<Type>::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -500,81 +500,85 @@ const pointPatchField<Type>& operator+
#endif
#define makePointPatchTypeFieldTypeName(type) \
\
defineNamedTemplateTypeNameAndDebug(type, 0);
#define addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
addToRunTimeSelectionTable \
( \
PatchTypeField, \
typePatchTypeField, \
pointPatch \
); \
addToRunTimeSelectionTable \
( \
PatchTypeField, \
typePatchTypeField, \
patchMapper \
); \
addToRunTimeSelectionTable \
( \
PatchTypeField, \
typePatchTypeField, \
dictionary \
);
#define makePointPatchFieldsTypeName(type) \
\
makePointPatchTypeFieldTypeName(type##PointPatchScalarField); \
makePointPatchTypeFieldTypeName(type##PointPatchVectorField); \
makePointPatchTypeFieldTypeName(type##PointPatchSphericalTensorField); \
makePointPatchTypeFieldTypeName(type##PointPatchSymmTensorField); \
makePointPatchTypeFieldTypeName(type##PointPatchTensorField);
#define makePointPatchTypeField(PatchTypeField, typePatchTypeField) \
\
defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \
\
addToRunTimeSelectionTable \
( \
PatchTypeField, typePatchTypeField, pointPatch \
); \
\
addToRunTimeSelectionTable \
( \
PatchTypeField, \
typePatchTypeField, \
patchMapper \
); \
\
addToRunTimeSelectionTable \
( \
PatchTypeField, typePatchTypeField, dictionary \
);
// for non-templated patch fields
#define makePointPatchTypeField(PatchTypeField,typePatchTypeField) \
defineTypeNameAndDebug(typePatchTypeField, 0); \
addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField)
// for templated patch fields
#define makeTemplatePointPatchTypeField(PatchTypeField, typePatchTypeField) \
defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \
addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField)
#define makePointPatchFields(type) \
\
makePointPatchTypeField \
( \
pointPatchScalarField, \
type##PointPatchScalarField \
); \
\
makePointPatchTypeField \
( \
pointPatchVectorField, \
type##PointPatchVectorField \
); \
\
makePointPatchTypeField \
( \
pointPatchSphericalTensorField, \
type##PointPatchSphericalTensorField \
); \
\
makePointPatchTypeField \
( \
pointPatchSymmTensorField, \
type##PointPatchSymmTensorField \
); \
\
makePointPatchTypeField \
( \
pointPatchTensorField, \
type##PointPatchTensorField \
makeTemplatePointPatchTypeField \
( \
pointPatchScalarField, \
type##PointPatchScalarField \
); \
makeTemplatePointPatchTypeField \
( \
pointPatchVectorField, \
type##PointPatchVectorField \
); \
makeTemplatePointPatchTypeField \
( \
pointPatchSphericalTensorField, \
type##PointPatchSphericalTensorField \
); \
makeTemplatePointPatchTypeField \
( \
pointPatchSymmTensorField, \
type##PointPatchSymmTensorField \
); \
makeTemplatePointPatchTypeField \
( \
pointPatchTensorField, \
type##PointPatchTensorField \
);
#define makePointPatchFieldsTypeName(type) \
defineNamedTemplateTypeNameAndDebug(type##PointPatchScalarField, 0); \
defineNamedTemplateTypeNameAndDebug(type##PointPatchVectorField, 0); \
defineNamedTemplateTypeNameAndDebug \
( \
type##PointPatchSphericalTensorField, 0 \
); \
defineNamedTemplateTypeNameAndDebug(type##PointPatchSymmTensorField, 0); \
defineNamedTemplateTypeNameAndDebug(type##PointPatchTensorField, 0)
#define makePointPatchFieldTypedefs(type) \
\
typedef type##PointPatchField<scalar> type##PointPatchScalarField; \
typedef type##PointPatchField<vector> type##PointPatchVectorField; \
typedef type##PointPatchField<sphericalTensor> \
type##PointPatchSphericalTensorField; \
typedef type##PointPatchField<symmTensor> type##PointPatchSymmTensorField; \
typedef type##PointPatchField<tensor> type##PointPatchTensorField;
typedef type##PointPatchField<scalar> type##PointPatchScalarField; \
typedef type##PointPatchField<vector> type##PointPatchVectorField; \
typedef type##PointPatchField<sphericalTensor> \
type##PointPatchSphericalTensorField; \
typedef type##PointPatchField<symmTensor> type##PointPatchSymmTensorField;\
typedef type##PointPatchField<tensor> type##PointPatchTensorField;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -35,7 +35,7 @@ namespace Foam
{
typedef graph::writer graphWriter;
addToRunTimeSelectionTable(graphWriter, gnuplotGraph, word);
};
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -35,7 +35,7 @@ namespace Foam
{
typedef graph::writer graphWriter;
addToRunTimeSelectionTable(graphWriter, jplotGraph, word);
};
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -35,7 +35,7 @@ namespace Foam
{
typedef graph::writer graphWriter;
addToRunTimeSelectionTable(graphWriter, rawGraph, word);
};
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -35,7 +35,7 @@ namespace Foam
{
typedef graph::writer graphWriter;
addToRunTimeSelectionTable(graphWriter, xmgrGraph, word);
};
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -67,8 +67,12 @@ string getEnv(const word&);
//- Set an environment variable
bool setEnv(const word& name, const string& value, const bool overwrite);
//- Return the system's host name
word hostName();
//- Return the system's host name, as per hostname(1)
// Optionally with the full name (as per the '-f' option)
word hostName(const bool full=false);
//- Return the system's domain name, as per hostname(1) with the '-d' option
word domainName();
//- Return the user's login name
word userName();

View File

@ -192,7 +192,7 @@ template<class Type>
void Foam::interpolationLookUpTable<Type>::readTable
(
const word& instance,
const fvMesh& mesh
const objectRegistry& obr
)
{
IOdictionary control
@ -201,7 +201,7 @@ void Foam::interpolationLookUpTable<Type>::readTable
(
fileName_,
instance,
mesh,
obr,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
@ -240,7 +240,7 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
(
const fileName& fn,
const word& instance,
const fvMesh& mesh
const objectRegistry& obr
)
:
List<scalarField>(),
@ -255,7 +255,7 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
outputIndices_(0),
interpOutput_(0)
{
readTable(instance, mesh);
readTable(instance, obr);
}
@ -341,7 +341,7 @@ void Foam::interpolationLookUpTable<Type>::write
Ostream& os,
const fileName& fn,
const word& instance,
const fvMesh& mesh
const objectRegistry& obr
) const
{
IOdictionary control
@ -350,7 +350,7 @@ void Foam::interpolationLookUpTable<Type>::write
(
fn,
instance,
mesh,
obr,
IOobject::NO_READ,
IOobject::NO_WRITE
)

View File

@ -104,7 +104,7 @@ private:
// Private Member Functions
//- Read the table of data from file
void readTable(const word& instance, const fvMesh&);
void readTable(const word& instance, const objectRegistry&);
//- Dimension table from dictionaries input and output
void dimensionTable();
@ -147,7 +147,7 @@ public:
(
const fileName&,
const word& instance,
const fvMesh&
const objectRegistry&
);
//- Construct from dictionary
@ -171,7 +171,7 @@ public:
Ostream&,
const fileName&,
const word& instance,
const fvMesh&
const objectRegistry&
) const;

View File

@ -318,8 +318,6 @@ tmp<Field<Type> > PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
Field<Type>& result = tresult();
const pointField& points = patch_.localPoints();
const faceList& faces = patch_.localFaces();
const edgeList& edges = patch_.edges();
const labelListList& edgeFaces = patch_.edgeFaces();

View File

@ -150,7 +150,7 @@ void Foam::processorLduInterface::compressedSend
fArray[i] = sArray[i] - slast[i%nCmpts];
}
reinterpret_cast<Type&>(fArray[nm1]) = f[f.size() - 1];
reinterpret_cast<Type&>(fArray[nm1]) = f.last();
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
{
@ -235,7 +235,7 @@ void Foam::processorLduInterface::compressedReceive
const float *fArray =
reinterpret_cast<const float*>(receiveBuf_.begin());
f[f.size() - 1] = reinterpret_cast<const Type&>(fArray[nm1]);
f.last() = reinterpret_cast<const Type&>(fArray[nm1]);
scalar *sArray = reinterpret_cast<scalar*>(f.begin());
const scalar *slast = &sArray[nm1];

View File

@ -52,13 +52,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Mesh& mesh
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh));
}
}
@ -71,13 +80,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data1& d
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d));
}
}
@ -91,13 +109,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data2& d2
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d1, d2));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d1, d2));
}
}
@ -112,13 +139,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data3& d3
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d1, d2, d3));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d1, d2, d3));
}
}
@ -134,13 +170,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data4& d4
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d1, d2, d3, d4));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d1, d2, d3, d4));
}
}
@ -150,13 +195,19 @@ const Type& Foam::MeshObject<Mesh, Type>::New
template<class Mesh, class Type>
bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh)
{
if (mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return mesh.thisDb().checkOut
(
const_cast<Type&>
(
mesh.thisDb().objectRegistry::lookupObject<Type>
mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
)

View File

@ -47,7 +47,7 @@ const Foam::boundBox Foam::boundBox::invertedBox
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::boundBox::calculate(const pointField& points, const bool doReduce)
void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce)
{
if (points.empty())
{
@ -84,7 +84,7 @@ void Foam::boundBox::calculate(const pointField& points, const bool doReduce)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::boundBox::boundBox(const pointField& points, const bool doReduce)
Foam::boundBox::boundBox(const UList<point>& points, const bool doReduce)
:
min_(point::zero),
max_(point::zero)
@ -103,9 +103,43 @@ Foam::boundBox::boundBox(const tmp<pointField>& points, const bool doReduce)
}
Foam::boundBox::boundBox(Istream& is)
Foam::boundBox::boundBox
(
const UList<point>& points,
const labelUList& indices,
const bool doReduce
)
:
min_(point::zero),
max_(point::zero)
{
operator>>(is, *this);
if (points.empty() || indices.empty())
{
if (doReduce && Pstream::parRun())
{
// Use values that get overwritten by reduce minOp, maxOp below
min_ = point(VGREAT, VGREAT, VGREAT);
max_ = point(-VGREAT, -VGREAT, -VGREAT);
}
}
else
{
min_ = points[indices[0]];
max_ = points[indices[0]];
for (label i=1; i < indices.size(); ++i)
{
min_ = ::Foam::min(min_, points[indices[i]]);
max_ = ::Foam::max(max_, points[indices[i]]);
}
}
// Reduce parallel information
if (doReduce)
{
reduce(min_, minOp<point>());
reduce(max_, maxOp<point>());
}
}
@ -129,6 +163,90 @@ Foam::tmp<Foam::pointField> Foam::boundBox::points() const
}
bool Foam::boundBox::contains(const UList<point>& points) const
{
if (points.empty())
{
return true;
}
forAll(points, i)
{
if (!contains(points[i]))
{
return false;
}
}
return true;
}
bool Foam::boundBox::contains
(
const UList<point>& points,
const labelUList& indices
) const
{
if (points.empty() || indices.empty())
{
return true;
}
forAll(indices, i)
{
if (!contains(points[indices[i]]))
{
return false;
}
}
return true;
}
bool Foam::boundBox::containsAny(const UList<point>& points) const
{
if (points.empty())
{
return true;
}
forAll(points, i)
{
if (contains(points[i]))
{
return true;
}
}
return false;
}
bool Foam::boundBox::containsAny
(
const UList<point>& points,
const labelUList& indices
) const
{
if (points.empty() || indices.empty())
{
return true;
}
forAll(indices, i)
{
if (contains(points[indices[i]]))
{
return true;
}
}
return false;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
@ -172,4 +290,5 @@ Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
return is;
}
// ************************************************************************* //

View File

@ -44,7 +44,8 @@ namespace Foam
class boundBox;
template<class T> class tmp;
Ostream& operator<<(Ostream& os, const boundBox& b);
Istream& operator>>(Istream&, boundBox&);
Ostream& operator<<(Ostream&, const boundBox&);
/*---------------------------------------------------------------------------*\
@ -60,9 +61,9 @@ class boundBox
// Private Member Functions
//- Calculate the bounding box from the given pointField.
//- Calculate the bounding box from the given points.
// Does parallel communication (doReduce = true)
void calculate(const pointField&, const bool doReduce = true);
void calculate(const UList<point>&, const bool doReduce = true);
public:
@ -81,29 +82,42 @@ public:
// Constructors
//- Construct null, setting points to zero
boundBox()
:
min_(point::zero),
max_(point::zero)
{}
inline boundBox();
//- Construct from components
boundBox(const point& min, const point& max)
:
min_(min),
max_(max)
{}
inline boundBox(const point& min, const point& max);
//- Construct as the bounding box of the given pointField.
//- Construct as the bounding box of the given points
// Does parallel communication (doReduce = true)
boundBox(const pointField&, const bool doReduce = true);
boundBox(const UList<point>&, const bool doReduce = true);
//- Construct as the bounding box of the given temporary pointField.
// Does parallel communication (doReduce = true)
boundBox(const tmp<pointField>&, const bool doReduce = true);
//- Construct bounding box as subset of the pointField.
// The indices could be from cell/face etc.
// Does parallel communication (doReduce = true)
boundBox
(
const UList<point>&,
const labelUList& indices,
const bool doReduce = true
);
//- Construct bounding box as subset of the pointField.
// The indices could be from edge/triFace etc.
// Does parallel communication (doReduce = true)
template<unsigned Size>
boundBox
(
const UList<point>&,
const FixedList<label, Size>& indices,
const bool doReduce = true
);
//- Construct from Istream
boundBox(Istream&);
inline boundBox(Istream&);
// Member functions
@ -111,70 +125,37 @@ public:
// Access
//- Minimum describing the bounding box
const point& min() const
{
return min_;
}
inline const point& min() const;
//- Maximum describing the bounding box
const point& max() const
{
return max_;
}
inline const point& max() const;
//- Minimum describing the bounding box, non-const access
point& min()
{
return min_;
}
inline point& min();
//- Maximum describing the bounding box, non-const access
point& max()
{
return max_;
}
inline point& max();
//- The midpoint of the bounding box
point midpoint() const
{
return 0.5 * (max_ + min_);
}
inline point midpoint() const;
//- The bounding box span (from minimum to maximum)
vector span() const
{
return (max_ - min_);
}
inline vector span() const;
//- The magnitude of the bounding box span
scalar mag() const
{
return ::Foam::mag(max_ - min_);
}
inline scalar mag() const;
//- The volume of the bound box
scalar volume() const
{
return cmptProduct(span());
}
inline scalar volume() const;
//- Smallest length/height/width dimension
scalar minDim() const
{
return cmptMin(span());
}
inline scalar minDim() const;
//- Largest length/height/width dimension
scalar maxDim() const
{
return cmptMax(span());
}
inline scalar maxDim() const;
//- Average length/height/width dimension
scalar avgDim() const
{
return cmptAv(span());
}
inline scalar avgDim() const;
//- Return corner points in an order corresponding to a 'hex' cell
tmp<pointField> points() const;
@ -182,56 +163,65 @@ public:
// Query
//- Overlaps/touches boundingBox?
bool overlaps(const boundBox& bb) const
{
return
(
bb.max_.x() >= min_.x() && bb.min_.x() <= max_.x()
&& bb.max_.y() >= min_.y() && bb.min_.y() <= max_.y()
&& bb.max_.z() >= min_.z() && bb.min_.z() <= max_.z()
);
}
inline bool overlaps(const boundBox&) const;
//- Contains point? (inside or on edge)
bool contains(const point& pt) const
{
return
(
pt.x() >= min_.x() && pt.x() <= max_.x()
&& pt.y() >= min_.y() && pt.y() <= max_.y()
&& pt.z() >= min_.z() && pt.z() <= max_.z()
);
}
inline bool contains(const point&) const;
//- Fully contains other boundingBox?
inline bool contains(const boundBox&) const;
//- Contains point? (inside only)
bool containsInside(const point& pt) const
{
return
(
pt.x() > min_.x() && pt.x() < max_.x()
&& pt.y() > min_.y() && pt.y() < max_.y()
&& pt.z() > min_.z() && pt.z() < max_.z()
);
}
inline bool containsInside(const point&) const;
//- Contains all of the points? (inside or on edge)
bool contains(const UList<point>&) const;
//- Contains all of the points? (inside or on edge)
bool contains
(
const UList<point>&,
const labelUList& indices
) const;
//- Contains all of the points? (inside or on edge)
template<unsigned Size>
bool contains
(
const UList<point>&,
const FixedList<label, Size>& indices
) const;
//- Contains any of the points? (inside or on edge)
bool containsAny(const UList<point>&) const;
//- Contains any of the points? (inside or on edge)
bool containsAny
(
const UList<point>&,
const labelUList& indices
) const;
//- Contains any of the points? (inside or on edge)
template<unsigned Size>
bool containsAny
(
const UList<point>&,
const FixedList<label, Size>& indices
) const;
// Friend Operators
friend bool operator==(const boundBox& a, const boundBox& b)
{
return (a.min_ == b.min_) && (a.max_ == b.max_);
}
friend bool operator!=(const boundBox& a, const boundBox& b)
{
return !(a == b);
}
inline friend bool operator==(const boundBox&, const boundBox&);
inline friend bool operator!=(const boundBox&, const boundBox&);
// IOstream operator
friend Istream& operator>>(Istream& is, boundBox&);
friend Ostream& operator<<(Ostream& os, const boundBox&);
friend Istream& operator>>(Istream&, boundBox&);
friend Ostream& operator<<(Ostream&, const boundBox&);
};
@ -244,7 +234,11 @@ inline bool contiguous<boundBox>() {return contiguous<point>();}
} // End namespace Foam
// #include "boundBoxI.H"
#include "boundBoxI.H"
#ifdef NoRepository
# include "boundBoxTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "boundBox.H"
#include "pointField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::boundBox::boundBox()
:
min_(point::zero),
max_(point::zero)
{}
inline Foam::boundBox::boundBox(const point& min, const point& max)
:
min_(min),
max_(max)
{}
inline Foam::boundBox::boundBox(Istream& is)
{
operator>>(is, *this);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::boundBox::min() const
{
return min_;
}
inline const Foam::point& Foam::boundBox::max() const
{
return max_;
}
inline Foam::point& Foam::boundBox::min()
{
return min_;
}
inline Foam::point& Foam::boundBox::max()
{
return max_;
}
inline Foam::point Foam::boundBox::midpoint() const
{
return 0.5 * (max_ + min_);
}
inline Foam::vector Foam::boundBox::span() const
{
return (max_ - min_);
}
inline Foam::scalar Foam::boundBox::mag() const
{
return ::Foam::mag(max_ - min_);
}
inline Foam::scalar Foam::boundBox::volume() const
{
return cmptProduct(span());
}
inline Foam::scalar Foam::boundBox::minDim() const
{
return cmptMin(span());
}
inline Foam::scalar Foam::boundBox::maxDim() const
{
return cmptMax(span());
}
inline Foam::scalar Foam::boundBox::avgDim() const
{
return cmptAv(span());
}
inline bool Foam::boundBox::overlaps(const boundBox& bb) const
{
return
(
bb.max_.x() >= min_.x() && bb.min_.x() <= max_.x()
&& bb.max_.y() >= min_.y() && bb.min_.y() <= max_.y()
&& bb.max_.z() >= min_.z() && bb.min_.z() <= max_.z()
);
}
inline bool Foam::boundBox::contains(const point& pt) const
{
return
(
pt.x() >= min_.x() && pt.x() <= max_.x()
&& pt.y() >= min_.y() && pt.y() <= max_.y()
&& pt.z() >= min_.z() && pt.z() <= max_.z()
);
}
// this.bb fully contains bb
inline bool Foam::boundBox::contains(const boundBox& bb) const
{
return contains(bb.min()) && contains(bb.max());
}
inline bool Foam::boundBox::containsInside(const point& pt) const
{
return
(
pt.x() > min_.x() && pt.x() < max_.x()
&& pt.y() > min_.y() && pt.y() < max_.y()
&& pt.z() > min_.z() && pt.z() < max_.z()
);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline bool Foam::operator==(const boundBox& a, const boundBox& b)
{
return (a.min_ == b.min_) && (a.max_ == b.max_);
}
inline bool Foam::operator!=(const boundBox& a, const boundBox& b)
{
return !(a == b);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "boundBox.H"
#include "FixedList.H"
#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<unsigned Size>
Foam::boundBox::boundBox
(
const UList<point>& points,
const FixedList<label, Size>& indices,
const bool doReduce
)
:
min_(point::zero),
max_(point::zero)
{
// a FixedList is never empty
if (points.empty())
{
if (doReduce && Pstream::parRun())
{
// Use values that get overwritten by reduce minOp, maxOp below
min_ = point(VGREAT, VGREAT, VGREAT);
max_ = point(-VGREAT, -VGREAT, -VGREAT);
}
}
else
{
min_ = points[indices[0]];
max_ = points[indices[0]];
for (unsigned i=1; i < Size; ++i)
{
min_ = ::Foam::min(min_, points[indices[i]]);
max_ = ::Foam::max(max_, points[indices[i]]);
}
}
// Reduce parallel information
if (doReduce)
{
reduce(min_, minOp<point>());
reduce(max_, maxOp<point>());
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<unsigned Size>
bool Foam::boundBox::contains
(
const UList<point>& points,
const FixedList<label, Size>& indices
) const
{
// a FixedList is never empty
if (points.empty())
{
return false;
}
forAll(indices, i)
{
if (!contains(points[indices[i]]))
{
return false;
}
}
return true;
}
template<unsigned Size>
bool Foam::boundBox::containsAny
(
const UList<point>& points,
const FixedList<label, Size>& indices
) const
{
// a FixedList is never empty
if (points.empty())
{
return false;
}
forAll(indices, i)
{
if (contains(points[indices[i]]))
{
return true;
}
}
return false;
}
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ const char* const Foam::cell::typeName = "cell";
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelList Foam::cell::labels(const unallocFaceList& f) const
Foam::labelList Foam::cell::labels(const faceUList& f) const
{
// return the unordered list of vertex labels supporting the cell
@ -100,7 +100,7 @@ Foam::labelList Foam::cell::labels(const unallocFaceList& f) const
Foam::pointField Foam::cell::points
(
const unallocFaceList& f,
const faceUList& f,
const pointField& meshPoints
) const
{
@ -117,7 +117,7 @@ Foam::pointField Foam::cell::points
}
Foam::edgeList Foam::cell::edges(const unallocFaceList& f) const
Foam::edgeList Foam::cell::edges(const faceUList& f) const
{
// return the lisf of cell edges
@ -172,7 +172,7 @@ Foam::edgeList Foam::cell::edges(const unallocFaceList& f) const
Foam::point Foam::cell::centre
(
const pointField& p,
const unallocFaceList& f
const faceUList& f
) const
{
// When one wants to access the cell centre and magnitude, the
@ -238,7 +238,7 @@ Foam::point Foam::cell::centre
Foam::scalar Foam::cell::mag
(
const pointField& p,
const unallocFaceList& f
const faceUList& f
) const
{
// When one wants to access the cell centre and magnitude, the

View File

@ -90,26 +90,26 @@ public:
inline label nFaces() const;
//- Return labels of cell vertices
labelList labels(const unallocFaceList&) const;
labelList labels(const faceUList&) const;
//- Return the cell vertices
pointField points(const unallocFaceList&, const pointField&) const;
pointField points(const faceUList&, const pointField&) const;
//- Return cell edges
edgeList edges(const unallocFaceList&) const;
edgeList edges(const faceUList&) const;
//- Return index of opposite face
label opposingFaceLabel
(
const label masterFaceLabel,
const unallocFaceList& meshFaces
const faceUList& meshFaces
) const;
//- Return opposite face oriented the same way as the master face
oppositeFace opposingFace
(
const label masterFaceLabel,
const unallocFaceList& meshFaces
const faceUList& meshFaces
) const;
@ -122,10 +122,10 @@ public:
// future.
//- Returns cell centre
point centre(const pointField&, const unallocFaceList&) const;
point centre(const pointField&, const faceUList&) const;
//- Returns cell volume
scalar mag(const pointField&, const unallocFaceList&) const;
scalar mag(const pointField&, const faceUList&) const;
// Friend Operators

View File

@ -39,7 +39,7 @@ Description
Foam::label Foam::cell::opposingFaceLabel
(
const label masterFaceLabel,
const unallocFaceList& meshFaces
const faceUList& meshFaces
) const
{
// Algorithm:
@ -114,7 +114,7 @@ Foam::label Foam::cell::opposingFaceLabel
Foam::oppositeFace Foam::cell::opposingFace
(
const label masterFaceLabel,
const unallocFaceList& meshFaces
const faceUList& meshFaces
) const
{
// Get the label of the opposite face

View File

@ -103,6 +103,9 @@ public:
//- Return common vertex
inline label commonVertex(const edge& a) const;
//- Flip the edge in-place.
inline void flip();
//- Return reverse edge
inline edge reverseEdge() const;

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "IOstreams.H"
#include "Swap.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -135,6 +136,12 @@ inline Foam::label Foam::edge::commonVertex(const edge& a) const
}
inline void Foam::edge::flip()
{
Swap(operator[](0), operator[](1));
}
inline Foam::edge Foam::edge::reverseEdge() const
{
return edge(end(), start());

View File

@ -27,11 +27,13 @@ License
#include "triFace.H"
#include "triPointRef.H"
#include "mathematicalConstants.H"
#include "Swap.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* const Foam::face::typeName = "face";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::vectorField>
@ -475,6 +477,20 @@ Foam::label Foam::face::collapse()
}
void Foam::face::flip()
{
const label n = size();
if (n > 2)
{
for (label i=1; i < (n+1)/2; ++i)
{
Swap(operator[](i), operator[](n-i));
}
}
}
Foam::point Foam::face::centre(const pointField& meshPoints) const
{
// Calculate the centre by breaking the face into triangles and
@ -618,19 +634,17 @@ Foam::face Foam::face::reverseFace() const
Foam::label Foam::face::which(const label globalIndex) const
{
label pointInFace = -1;
const labelList& f = *this;
forAll(f, i)
forAll(f, localIdx)
{
if (f[i] == globalIndex)
if (f[localIdx] == globalIndex)
{
pointInFace = i;
break;
return localIdx;
}
}
return pointInFace;
return -1;
}
@ -654,9 +668,7 @@ Foam::scalar Foam::face::sweptVol
point nextOldPoint = centreOldPoint;
point nextNewPoint = centreNewPoint;
register label pI;
for (pI = 0; pI < nPoints; pI++)
for (register label pI = 0; pI < nPoints; ++pI)
{
if (pI < nPoints - 1)
{
@ -708,20 +720,18 @@ Foam::tensor Foam::face::inertia
).inertia(refPt, density);
}
point c = centre(p);
const point ctr = centre(p);
tensor J = tensor::zero;
forAll(*this, i)
{
triPointRef t
J += triPointRef
(
p[operator[](i)],
p[operator[](fcIndex(i))],
c
);
J += t.inertia(refPt, density);
ctr
).inertia(refPt, density);
}
return J;
@ -734,15 +744,13 @@ Foam::edgeList Foam::face::edges() const
edgeList e(points.size());
label pointI;
for (pointI = 0; pointI < points.size() - 1; pointI++)
for (label pointI = 0; pointI < points.size() - 1; ++pointI)
{
e[pointI] = edge(points[pointI], points[pointI + 1]);
}
// add last edge
e[points.size() - 1] = edge(points[points.size() - 1], points[0]);
e.last() = edge(points.last(), points[0]);
return e;
}
@ -839,9 +847,4 @@ Foam::label Foam::face::trianglesQuads
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -27,12 +27,16 @@ Class
Description
A face is a list of labels corresponding to mesh vertices.
SeeAlso
Foam::triFace
SourceFiles
faceI.H
face.C
faceIntersection.C
faceContactSphere.C
faceAreaInContact.C
faceTemplates.C
\*---------------------------------------------------------------------------*/
@ -169,6 +173,10 @@ public:
// return the collapsed size
label collapse();
//- Flip the face in-place.
// The starting points of the original and flipped face are identical.
void flip();
//- Return the points corresponding to this face
inline pointField points(const pointField& meshPoints) const;
@ -186,11 +194,13 @@ public:
vector normal(const pointField&) const;
//- Return face with reverse direction
// The starting points of the original and reverse face are identical.
face reverseFace() const;
//- Navigation through face vertices
//- Which vertex on face (face index given a global index)
// returns -1 if not found
label which(const label globalIndex) const;
//- Next vertex on face
@ -289,8 +299,8 @@ public:
//- Return number of edges
inline label nEdges() const;
//- Return edges in face point ordering, i.e. edges()[0] is edge
// between [0] and [1]
//- Return edges in face point ordering,
// i.e. edges()[0] is edge between [0] and [1]
edgeList edges() const;
//- Return n-th face edge

View File

@ -35,7 +35,7 @@ inline Foam::label Foam::face::right(const label i) const
// Edge to the left of face vertex i
inline Foam::label Foam::face::left(const label i) const
{
return i ? i-1 : size()-1;
return rcIndex(i);
}

View File

@ -21,9 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Return intersection of a line with the face
\*---------------------------------------------------------------------------*/
#include "face.H"
@ -51,6 +48,17 @@ Foam::pointHit Foam::face::ray
const intersection::direction dir
) const
{
// If the face is a triangle, do a direct calculation
if (size() == 3)
{
return triPointRef
(
meshPoints[operator[](0)],
meshPoints[operator[](1)],
meshPoints[operator[](2)]
).ray(p, n, alg, dir);
}
point ctr = Foam::average(points(meshPoints));
scalar nearestHitDist = GREAT;
@ -139,6 +147,17 @@ Foam::pointHit Foam::face::intersection
const scalar tol
) const
{
// If the face is a triangle, do a direct calculation
if (size() == 3)
{
return triPointRef
(
meshPoints[operator[](0)],
meshPoints[operator[](1)],
meshPoints[operator[](2)]
).intersection(p, q, alg, tol);
}
scalar nearestHitDist = VGREAT;
// Initialize to miss, distance = GREAT
@ -198,6 +217,17 @@ Foam::pointHit Foam::face::nearestPointClassify
label& nearLabel
) const
{
// If the face is a triangle, do a direct calculation
if (size() == 3)
{
return triPointRef
(
meshPoints[operator[](0)],
meshPoints[operator[](1)],
meshPoints[operator[](2)]
).nearestPointClassify(p, nearType, nearLabel);
}
const face& f = *this;
point ctr = centre(meshPoints);

View File

@ -39,10 +39,12 @@ Description
namespace Foam
{
class face;
typedef UList<face> unallocFaceList;
typedef UList<face> faceUList;
typedef List<face> faceList;
typedef SubList<face> faceSubList;
typedef List<faceList> faceListList;
// same as faceUList:
typedef UList<face> unallocFaceList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -50,7 +50,7 @@ template<class Type>
Type Foam::face::average
(
const pointField& meshPoints,
const Field<Type>& f
const Field<Type>& fld
) const
{
// Calculate the average by breaking the face into triangles and
@ -62,9 +62,9 @@ Type Foam::face::average
return
(1.0/3.0)
*(
f[operator[](0)]
+ f[operator[](1)]
+ f[operator[](2)]
fld[operator[](0)]
+ fld[operator[](1)]
+ fld[operator[](2)]
);
}
@ -76,7 +76,7 @@ Type Foam::face::average
for (register label pI=0; pI<nPoints; pI++)
{
centrePoint += meshPoints[operator[](pI)];
cf += f[operator[](pI)];
cf += fld[operator[](pI)];
}
centrePoint /= nPoints;
@ -90,8 +90,8 @@ Type Foam::face::average
// Calculate 3*triangle centre field value
Type ttcf =
(
f[operator[](pI)]
+ f[operator[]((pI + 1) % nPoints)]
fld[operator[](pI)]
+ fld[operator[]((pI + 1) % nPoints)]
+ cf
);
@ -116,4 +116,5 @@ Type Foam::face::average
}
}
// ************************************************************************* //

View File

@ -25,7 +25,7 @@ Class
Foam::oppositeFace
Description
Class containing opposite face for a prismatic cell with addresing
Class containing opposite face for a prismatic cell with addressing
and a possibility of failure.
SourceFiles

View File

@ -25,10 +25,15 @@ Class
Foam::triFace
Description
A triangle face primitive using a FixedList.
A triangular face using a FixedList of labels corresponding to mesh
vertices.
SeeAlso
Foam::face, Foam::triangle
SourceFiles
triFaceI.H
triFaceTemplates.C
\*---------------------------------------------------------------------------*/
@ -47,17 +52,17 @@ SourceFiles
namespace Foam
{
class face;
// Forward declaration of friend functions and operators
class face;
class triFace;
inline bool operator==(const triFace&, const triFace&);
inline bool operator!=(const triFace&, const triFace&);
/*---------------------------------------------------------------------------*\
class triFace Declaration
Class triFace Declaration
\*---------------------------------------------------------------------------*/
class triFace
@ -93,63 +98,114 @@ public:
// return the collapsed size, set collapsed point labels to -1
inline label collapse();
//- Flip the face in-place.
// The starting points of the original and flipped face are identical.
inline void flip();
//- Return the points corresponding to this face
inline pointField points(const pointField& meshPoints) const;
//- Return triangle as a face
inline face triFaceFace() const;
//- Return the triangle
inline triPointRef tri(const pointField&) const;
//- Return centre (centroid)
inline point centre(const pointField&) const;
//- Calculate average value at centroid of face
template<class Type>
Type average(const pointField&, const Field<Type>&) const;
//- Return scalar magnitude
inline scalar mag(const pointField&) const;
//- Return vector normal
inline vector normal(const pointField&) const;
//- Number of triangles after splitting
inline label nTriangles() const;
//- Return face with reverse direction
// The starting points of the original and reverse face are identical.
inline triFace reverseFace() const;
//- Return swept-volume
inline scalar sweptVol
(
const pointField& oldPoints,
const pointField& newPoints
) const;
//- Return the inertia tensor, with optional reference
// point and density specification
inline tensor inertia
(
const pointField&,
const point& refPt = vector::zero,
scalar density = 1.0
) const;
//- Return point intersection with a ray starting at p,
// with direction q.
inline pointHit ray
(
const point& p,
const vector& q,
const pointField& points,
const intersection::algorithm = intersection::FULL_RAY,
const intersection::direction dir = intersection::VECTOR
) const;
//- Fast intersection with a ray.
inline pointHit intersection
(
const point& p,
const vector& q,
const pointField& points,
const intersection::algorithm alg,
const scalar tol = 0.0
) const;
//- Return nearest point to face
inline pointHit nearestPoint
(
const point& p,
const pointField& points
) const;
//- Return nearest point to face and classify it:
// + near point (nearType=POINT, nearLabel=0, 1, 2)
// + near edge (nearType=EDGE, nearLabel=0, 1, 2)
// Note: edges are counted from starting vertex so
// e.g. edge n is from f[n] to f[0], where the face has n + 1
// points
inline pointHit nearestPointClassify
(
const point& p,
const pointField& points,
label& nearType,
label& nearLabel
) const;
//- Return number of edges
inline label nEdges() const;
//- Return edges in face point ordering,
// i.e. edges()[0] is edge between [0] and [1]
inline edgeList edges() const;
//- Return n-th face edge
inline edge faceEdge(const label n) const;
//- Return the edge direction on the face
// - +1: forward (counter-clockwise) on the face
// - -1: reverse (clockwise) on the face
// - 0: edge not found on the face
inline int edgeDirection(const edge&) const;
// Properties
//- Return the points corresponding to this face
inline pointField points(const pointField& points) const;
//- Return triangle as a face
inline face triFaceFace() const;
//- Return number of edges
inline label nEdges() const;
//- Return edges
inline edgeList edges() const;
//- Return centre (centroid)
inline point centre(const pointField&) const;
//- Return scalar magnitude
inline scalar mag(const pointField&) const;
//- Return vector normal
inline vector normal(const pointField&) const;
//- Number of triangles after splitting
inline label nTriangles() const;
//- Return face with reverse direction
inline triFace reverseFace() const;
//- Return swept-volume
inline scalar sweptVol
(
const pointField& oldPoints,
const pointField& newPoints
) const;
//- Return point intersection with a ray starting at p, with
// direction n.
inline pointHit ray
(
const point& p,
const vector& q,
const pointField& points,
const intersection::algorithm = intersection::FULL_RAY,
const intersection::direction dir = intersection::VECTOR
) const;
//- Return the triangle
inline triPointRef tri(const pointField&) const;
//- compare triFaces
// - 0: different
// - +1: identical
@ -158,8 +214,8 @@ public:
// Friend Operators
friend bool operator==(const triFace&, const triFace&);
friend bool operator!=(const triFace&, const triFace&);
inline friend bool operator==(const triFace&, const triFace&);
inline friend bool operator!=(const triFace&, const triFace&);
};
@ -199,6 +255,10 @@ inline bool contiguous<triFace>() {return true;}
#include "triFaceI.H"
#ifdef NoRepository
# include "triFaceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -26,6 +26,7 @@ License
#include "IOstreams.H"
#include "face.H"
#include "triPointRef.H"
#include "Swap.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -118,6 +119,12 @@ inline Foam::label Foam::triFace::collapse()
}
inline void Foam::triFace::flip()
{
Swap(operator[](1), operator[](2));
}
inline Foam::pointField Foam::triFace::points(const pointField& points) const
{
pointField p(3);
@ -142,57 +149,14 @@ inline Foam::face Foam::triFace::triFaceFace() const
}
inline Foam::label Foam::triFace::nEdges() const
inline Foam::triPointRef Foam::triFace::tri(const pointField& points) const
{
return 3;
}
inline Foam::edgeList Foam::triFace::edges() const
{
edgeList e(3);
e[0].start() = operator[](0);
e[0].end() = operator[](1);
e[1].start() = operator[](1);
e[1].end() = operator[](2);
e[2].start() = operator[](2);
e[2].end() = operator[](0);
return e;
}
// return
// - +1: forward (counter-clockwise) on the face
// - -1: reverse (clockwise) on the face
// - 0: edge not found on the face
inline int Foam::triFace::edgeDirection(const edge& e) const
{
if
return triPointRef
(
(operator[](0) == e.start() && operator[](1) == e.end())
|| (operator[](1) == e.start() && operator[](2) == e.end())
|| (operator[](2) == e.start() && operator[](0) == e.end())
)
{
return 1;
}
else if
(
(operator[](0) == e.end() && operator[](1) == e.start())
|| (operator[](1) == e.end() && operator[](2) == e.start())
|| (operator[](2) == e.end() && operator[](0) == e.start())
)
{
return -1;
}
else
{
return 0;
}
points[operator[](0)],
points[operator[](1)],
points[operator[](2)]
);
}
@ -269,6 +233,18 @@ inline Foam::scalar Foam::triFace::sweptVol
}
Foam::tensor Foam::triFace::inertia
(
const pointField& points,
const point& refPt,
scalar density
) const
{
// a triangle, do a direct calculation
return this->tri(points).inertia(refPt, density);
}
inline Foam::pointHit Foam::triFace::ray
(
const point& p,
@ -278,23 +254,103 @@ inline Foam::pointHit Foam::triFace::ray
const intersection::direction dir
) const
{
return triPointRef
(
points[operator[](0)],
points[operator[](1)],
points[operator[](2)]
).ray(p, q, alg, dir);
return this->tri(points).ray(p, q, alg, dir);
}
inline Foam::triPointRef Foam::triFace::tri(const pointField& points) const
inline Foam::pointHit Foam::triFace::intersection
(
const point& p,
const vector& q,
const pointField& points,
const intersection::algorithm alg,
const scalar tol
) const
{
return triPointRef
return this->tri(points).intersection(p, q, alg, tol);
}
inline Foam::pointHit Foam::triFace::nearestPoint
(
const point& p,
const pointField& points
) const
{
return this->tri(points).nearestPoint(p);
}
inline Foam::pointHit Foam::triFace::nearestPointClassify
(
const point& p,
const pointField& points,
label& nearType,
label& nearLabel
) const
{
return this->tri(points).nearestPointClassify(p, nearType, nearLabel);
}
inline Foam::label Foam::triFace::nEdges() const
{
return 3;
}
inline Foam::edgeList Foam::triFace::edges() const
{
edgeList e(3);
e[0].start() = operator[](0);
e[0].end() = operator[](1);
e[1].start() = operator[](1);
e[1].end() = operator[](2);
e[2].start() = operator[](2);
e[2].end() = operator[](0);
return e;
}
inline Foam::edge Foam::triFace::faceEdge(const label n) const
{
return edge(operator[](n), operator[](fcIndex(n)));
}
// return
// - +1: forward (counter-clockwise) on the face
// - -1: reverse (clockwise) on the face
// - 0: edge not found on the face
inline int Foam::triFace::edgeDirection(const edge& e) const
{
if
(
points[operator[](0)],
points[operator[](1)],
points[operator[](2)]
);
(operator[](0) == e.start() && operator[](1) == e.end())
|| (operator[](1) == e.start() && operator[](2) == e.end())
|| (operator[](2) == e.start() && operator[](0) == e.end())
)
{
return 1;
}
else if
(
(operator[](0) == e.end() && operator[](1) == e.start())
|| (operator[](1) == e.end() && operator[](2) == e.start())
|| (operator[](2) == e.end() && operator[](0) == e.start())
)
{
return -1;
}
else
{
return 0;
}
}

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "triFace.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::triFace::average
(
const pointField& meshPoints,
const Field<Type>& fld
) const
{
// a triangle, do a direct calculation
return
(
(1.0/3.0)
*
(
fld[operator[](0)]
+ fld[operator[](1)]
+ fld[operator[](2)]
)
);
}
// ************************************************************************* //

View File

@ -443,11 +443,19 @@ Foam::label Foam::cyclicPolyPatch::getConsistentRotationFace
const pointField& faceCentres
) const
{
const scalarField magRadSqr =
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_);
scalarField axisLen = (faceCentres - rotationCentre_) & rotationAxis_;
axisLen = axisLen - min(axisLen);
const scalarField magLenSqr = magRadSqr + axisLen*axisLen;
const scalarField magRadSqr
(
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_)
);
scalarField axisLen
(
(faceCentres - rotationCentre_) & rotationAxis_
);
axisLen -= min(axisLen);
const scalarField magLenSqr
(
magRadSqr + axisLen*axisLen
);
label rotFace = -1;
scalar maxMagLenSqr = -GREAT;

View File

@ -44,19 +44,21 @@ namespace Foam
addToRunTimeSelectionTable(polyPatch, oldCyclicPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, oldCyclicPolyPatch, dictionary);
template<>
const char* NamedEnum<oldCyclicPolyPatch::transformType, 3>::names[] =
{
"unknown",
"rotational",
"translational"
};
const NamedEnum<oldCyclicPolyPatch::transformType, 3>
oldCyclicPolyPatch::transformTypeNames;
template<>
const char* Foam::NamedEnum
<
Foam::oldCyclicPolyPatch::transformType,
3
>::names[] =
{
"unknown",
"rotational",
"translational"
};
}
const Foam::NamedEnum<Foam::oldCyclicPolyPatch::transformType, 3>
Foam::oldCyclicPolyPatch::transformTypeNames;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -536,11 +538,19 @@ Foam::label Foam::oldCyclicPolyPatch::getConsistentRotationFace
const pointField& faceCentres
) const
{
const scalarField magRadSqr =
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_);
scalarField axisLen = (faceCentres - rotationCentre_) & rotationAxis_;
const scalarField magRadSqr
(
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_)
);
scalarField axisLen
(
(faceCentres - rotationCentre_) & rotationAxis_
);
axisLen = axisLen - min(axisLen);
const scalarField magLenSqr = magRadSqr + axisLen*axisLen;
const scalarField magLenSqr
(
magRadSqr + axisLen*axisLen
);
label rotFace = -1;
scalar maxMagLenSqr = -GREAT;

View File

@ -57,6 +57,7 @@ SourceFiles
#include "point.H"
#include "intersection.H"
#include "HashSet.H"
#include "objectHit.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,7 +65,6 @@ namespace Foam
{
class face;
class objectHit;
template<class T> class Map;
/*---------------------------------------------------------------------------*\

View File

@ -302,7 +302,7 @@ bool Foam::primitiveMesh::checkFaceAreas
<< "checking face area magnitudes" << endl;
}
const scalarField magFaceAreas = mag(faceAreas());
const scalarField magFaceAreas(mag(faceAreas()));
scalar minArea = GREAT;
scalar maxArea = -GREAT;

View File

@ -38,6 +38,8 @@ SourceFiles
#include "vector.H"
#include "PointHit.H"
#include "point2D.H"
#include "FixedList.H"
#include "UList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -80,6 +82,14 @@ public:
//- Construct from two points
inline line(const Point& start, const Point& end);
//- Construct from two points in the list of points
// The indices could be from edge etc.
inline line
(
const UList<Point>&,
const FixedList<label, 2>& indices
);
//- Construct from Istream
inline line(Istream&);

View File

@ -25,15 +25,10 @@ License
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline line<Point, PointRef>::line(const Point& start, const Point& end)
inline Foam::line<Point, PointRef>::line(const Point& start, const Point& end)
:
a_(start),
b_(end)
@ -41,59 +36,65 @@ inline line<Point, PointRef>::line(const Point& start, const Point& end)
template<class Point, class PointRef>
inline line<Point, PointRef>::line(Istream& is)
inline Foam::line<Point, PointRef>::line
(
const UList<Point>& points,
const FixedList<label, 2>& indices
)
:
a_(points[indices[0]]),
b_(points[indices[1]])
{}
template<class Point, class PointRef>
inline Foam::line<Point, PointRef>::line(Istream& is)
{
// Read beginning of line point pair
is.readBegin("line");
is >> a_ >> b_;
// Read end of line point pair
is.readEnd("line");
// Check state of Istream
is.check("line::line(Istream& is)");
is >> *this;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline PointRef line<Point, PointRef>::start() const
inline PointRef Foam::line<Point, PointRef>::start() const
{
return a_;
}
template<class Point, class PointRef>
inline PointRef line<Point, PointRef>::end() const
inline PointRef Foam::line<Point, PointRef>::end() const
{
return b_;
}
template<class Point, class PointRef>
inline Point line<Point, PointRef>::centre() const
inline Point Foam::line<Point, PointRef>::centre() const
{
return 0.5*(a_ + b_);
}
template<class Point, class PointRef>
inline scalar line<Point, PointRef>::mag() const
inline Foam::scalar Foam::line<Point, PointRef>::mag() const
{
return ::Foam::mag(vec());
}
template<class Point, class PointRef>
inline Point line<Point, PointRef>::vec() const
inline Point Foam::line<Point, PointRef>::vec() const
{
return b_ - a_;
}
template<class Point, class PointRef>
PointHit<Point> line<Point, PointRef>::nearestDist(const Point& p) const
Foam::PointHit<Point> Foam::line<Point, PointRef>::nearestDist
(
const Point& p
) const
{
Point v = vec();
@ -122,7 +123,7 @@ PointHit<Point> line<Point, PointRef>::nearestDist(const Point& p) const
template<class Point, class PointRef>
scalar line<Point, PointRef>::nearestDist
Foam::scalar Foam::line<Point, PointRef>::nearestDist
(
const line<Point, const Point&>& edge,
Point& thisPt,
@ -259,33 +260,34 @@ scalar line<Point, PointRef>::nearestDist
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline Istream& operator>>(Istream& is, line<Point, PointRef>& l)
inline Foam::Istream& Foam::operator>>
(
Istream& is,
line<Point, PointRef>& l
)
{
// Read beginning of line point pair
is.readBegin("line");
is >> l.a_ >> l.b_;
// Read end of line point pair
is >> l.a_ >> l.b_;
is.readEnd("line");
// Check state of Ostream
is.check("Istream& operator>>(Istream&, line&)");
return is;
}
template<class Point, class PointRef>
inline Ostream& operator<<(Ostream& os, const line<Point, PointRef>& l)
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,
const line<Point, PointRef>& l
)
{
os << token::BEGIN_LIST << l.a_ << token::SPACE << l.b_ << token::END_LIST;
os << token::BEGIN_LIST
<< l.a_ << token::SPACE
<< l.b_
<< token::END_LIST;
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -40,14 +40,6 @@ Description
namespace Foam
{
// Forward declaration of friend functions and operators
class objectHit;
inline bool operator==(const objectHit& a, const objectHit& b);
inline bool operator!=(const objectHit& a, const objectHit& b);
inline Ostream& operator<<(Ostream& os, const objectHit& b);
/*---------------------------------------------------------------------------*\
Class objectHit Declaration
\*---------------------------------------------------------------------------*/
@ -106,22 +98,22 @@ public:
// Friend Operators
friend bool operator==(const objectHit& a, const objectHit& b)
inline friend bool operator==(const objectHit& a, const objectHit& b)
{
return ((a.hit_ == b.hit_) && (a.hitObject_ == b.hitObject_));
return (a.hit_ == b.hit_) && (a.hitObject_ == b.hitObject_);
}
friend bool operator!=(const objectHit& a, const objectHit& b)
inline friend bool operator!=(const objectHit& a, const objectHit& b)
{
return (!(a == b));
return !(a == b);
}
// Ostream operator
friend Ostream& operator<<(Ostream& os, const objectHit& b)
inline friend Ostream& operator<<(Ostream& os, const objectHit& obj)
{
return os << b.hit() << token::SPACE << b.hitObject();
return os << obj.hit() << token::SPACE << obj.hitObject();
}
};

View File

@ -27,15 +27,10 @@ Description
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Point, class PointRef, class polygonRef>
inline pyramid<Point, PointRef, polygonRef>::pyramid
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid
(
polygonRef base,
const Point& apex
@ -47,30 +42,30 @@ inline pyramid<Point, PointRef, polygonRef>::pyramid
template<class Point, class PointRef, class polygonRef>
inline pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
{
is >> base_ >> apex_;
is.check("pyramid::pyramid(Istream& is)");
is.check("pyramid::pyramid(Istream&)");
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef, class polygonRef>
inline const Point& pyramid<Point, PointRef, polygonRef>::apex() const
inline const Point& Foam::pyramid<Point, PointRef, polygonRef>::apex() const
{
return apex_;
}
template<class Point, class PointRef, class polygonRef>
inline polygonRef pyramid<Point, PointRef, polygonRef>::base() const
inline polygonRef Foam::pyramid<Point, PointRef, polygonRef>::base() const
{
return base_;
}
template<class Point, class PointRef, class polygonRef>
inline Point pyramid<Point, PointRef, polygonRef>::centre
inline Point Foam::pyramid<Point, PointRef, polygonRef>::centre
(
const pointField& points
) const
@ -80,7 +75,7 @@ inline Point pyramid<Point, PointRef, polygonRef>::centre
template<class Point, class PointRef, class polygonRef>
inline vector pyramid<Point, PointRef, polygonRef>::height
inline Foam::vector Foam::pyramid<Point, PointRef, polygonRef>::height
(
const pointField& points
) const
@ -91,7 +86,7 @@ inline vector pyramid<Point, PointRef, polygonRef>::height
template<class Point, class PointRef, class polygonRef>
inline scalar pyramid<Point, PointRef, polygonRef>::mag
inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
(
const pointField& points
) const
@ -103,32 +98,28 @@ inline scalar pyramid<Point, PointRef, polygonRef>::mag
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
template<class Point, class PointRef, class polygonRef>
inline Istream& operator>>
inline Foam::Istream& Foam::operator>>
(
Istream& is,
pyramid<Point, PointRef, polygonRef>& p
)
{
is >> p.base_ >> p.apex_;
is >> p.base_ >> p.apex_;
is.check("Istream& operator>>(Istream&, pyramid&)");
return is;
}
template<class Point, class PointRef, class polygonRef>
inline Ostream& operator<<
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,
const pyramid<Point, PointRef, polygonRef>& p
)
{
os << p.base_ << tab << p.apex_ << nl;
os << p.base_ << tab << p.apex_ << nl;
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -43,6 +43,8 @@ SourceFiles
#include "primitiveFieldsFwd.H"
#include "pointHit.H"
#include "Random.H"
#include "FixedList.H"
#include "UList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -105,6 +107,13 @@ public:
const Point& d
);
//- Construct from four points in the list of points
inline tetrahedron
(
const UList<Point>&,
const FixedList<label, 4>& indices
);
//- Construct from Istream
inline tetrahedron(Istream&);

View File

@ -27,15 +27,10 @@ License
#include "IOstreams.H"
#include "triPointRef.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline tetrahedron<Point, PointRef>::tetrahedron
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
(
const Point& a,
const Point& b,
@ -51,95 +46,100 @@ inline tetrahedron<Point, PointRef>::tetrahedron
template<class Point, class PointRef>
inline tetrahedron<Point, PointRef>::tetrahedron(Istream& is)
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
(
const UList<Point>& points,
const FixedList<label, 4>& indices
)
:
a_(points[indices[0]]),
b_(points[indices[1]]),
c_(points[indices[2]]),
d_(points[indices[3]])
{}
template<class Point, class PointRef>
inline Foam::tetrahedron<Point, PointRef>::tetrahedron(Istream& is)
{
// Read beginning of tetrahedron point pair
is.readBegin("tetrahedron");
is >> a_ >> b_ >> c_ >> d_;
// Read end of tetrahedron point pair
is.readEnd("tetrahedron");
// Check state of Istream
is.check("tetrahedron::tetrahedron(Istream& is)");
is >> *this;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline const Point& tetrahedron<Point, PointRef>::a() const
inline const Point& Foam::tetrahedron<Point, PointRef>::a() const
{
return a_;
}
template<class Point, class PointRef>
inline const Point& tetrahedron<Point, PointRef>::b() const
inline const Point& Foam::tetrahedron<Point, PointRef>::b() const
{
return b_;
}
template<class Point, class PointRef>
inline const Point& tetrahedron<Point, PointRef>::c() const
inline const Point& Foam::tetrahedron<Point, PointRef>::c() const
{
return c_;
}
template<class Point, class PointRef>
inline const Point& tetrahedron<Point, PointRef>::d() const
inline const Point& Foam::tetrahedron<Point, PointRef>::d() const
{
return d_;
}
template<class Point, class PointRef>
inline vector tetrahedron<Point, PointRef>::Sa() const
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sa() const
{
return triangle<Point, PointRef>(b_, c_, d_).normal();
}
template<class Point, class PointRef>
inline vector tetrahedron<Point, PointRef>::Sb() const
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sb() const
{
return triangle<Point, PointRef>(a_, d_, c_).normal();
}
template<class Point, class PointRef>
inline vector tetrahedron<Point, PointRef>::Sc() const
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sc() const
{
return triangle<Point, PointRef>(a_, b_, d_).normal();
}
template<class Point, class PointRef>
inline vector tetrahedron<Point, PointRef>::Sd() const
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sd() const
{
return triangle<Point, PointRef>(a_, c_, b_).normal();
}
template<class Point, class PointRef>
inline Point tetrahedron<Point, PointRef>::centre() const
inline Point Foam::tetrahedron<Point, PointRef>::centre() const
{
return 0.25*(a_ + b_ + c_ + d_);
}
template<class Point, class PointRef>
inline scalar tetrahedron<Point, PointRef>::mag() const
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::mag() const
{
return (1.0/6.0)*(((b_ - a_) ^ (c_ - a_)) & (d_ - a_));
}
template<class Point, class PointRef>
inline Point tetrahedron<Point, PointRef>::circumCentre() const
inline Point Foam::tetrahedron<Point, PointRef>::circumCentre() const
{
vector a = b_ - a_;
vector b = c_ - a_;
@ -166,7 +166,7 @@ inline Point tetrahedron<Point, PointRef>::circumCentre() const
template<class Point, class PointRef>
inline scalar tetrahedron<Point, PointRef>::circumRadius() const
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::circumRadius() const
{
vector a = b_ - a_;
vector b = c_ - a_;
@ -192,7 +192,7 @@ inline scalar tetrahedron<Point, PointRef>::circumRadius() const
template<class Point, class PointRef>
inline scalar tetrahedron<Point, PointRef>::quality() const
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::quality() const
{
return
mag()
@ -205,7 +205,10 @@ inline scalar tetrahedron<Point, PointRef>::quality() const
template<class Point, class PointRef>
inline Point tetrahedron<Point, PointRef>::randomPoint(Random& rndGen) const
inline Point Foam::tetrahedron<Point, PointRef>::randomPoint
(
Random& rndGen
) const
{
// Adapted from
// http://vcg.isti.cnr.it/activities/geometryegraphics/pointintetraedro.html
@ -238,7 +241,7 @@ inline Point tetrahedron<Point, PointRef>::randomPoint(Random& rndGen) const
template<class Point, class PointRef>
scalar tetrahedron<Point, PointRef>::barycentric
Foam::scalar Foam::tetrahedron<Point, PointRef>::barycentric
(
const point& pt,
List<scalar>& bary
@ -283,7 +286,7 @@ scalar tetrahedron<Point, PointRef>::barycentric
template<class Point, class PointRef>
inline pointHit tetrahedron<Point, PointRef>::nearestPoint
inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
(
const point& p
) const
@ -379,18 +382,17 @@ inline pointHit tetrahedron<Point, PointRef>::nearestPoint
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class point, class pointRef>
inline Istream& operator>>(Istream& is, tetrahedron<point, pointRef>& t)
template<class Point, class PointRef>
inline Foam::Istream& Foam::operator>>
(
Istream& is,
tetrahedron<Point, PointRef>& t
)
{
// Read beginning of tetrahedron point pair
is.readBegin("tetrahedron");
is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
// Read end of tetrahedron point pair
is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
is.readEnd("tetrahedron");
// Check state of Ostream
is.check("Istream& operator>>(Istream&, tetrahedron&)");
return is;
@ -398,20 +400,22 @@ inline Istream& operator>>(Istream& is, tetrahedron<point, pointRef>& t)
template<class Point, class PointRef>
inline Ostream& operator<<(Ostream& os, const tetrahedron<Point, PointRef>& t)
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,
const tetrahedron<Point, PointRef>& t
)
{
os << nl
<< token::BEGIN_LIST
<< t.a_ << token::SPACE << t.b_
<< token::SPACE << t.c_ << token::SPACE << t.d_
<< t.a_ << token::SPACE
<< t.b_ << token::SPACE
<< t.c_ << token::SPACE
<< t.d_
<< token::END_LIST;
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -32,14 +32,22 @@ Foam::scalar Foam::intersection::planarTol_ = 0.2;
namespace Foam
{
template<>
const char* Foam::NamedEnum<Foam::intersection::direction, 2>::names[] =
const char* Foam::NamedEnum
<
Foam::intersection::direction,
2
>::names[] =
{
"vector",
"contactSphere"
};
template<>
const char* Foam::NamedEnum<Foam::intersection::algorithm, 3>::names[] =
const char* Foam::NamedEnum
<
Foam::intersection::algorithm,
3
>::names[] =
{
"fullRay",
"halfRay",

View File

@ -40,6 +40,8 @@ SourceFiles
#include "tensor.H"
#include "pointHit.H"
#include "Random.H"
#include "FixedList.H"
#include "UList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,7 +71,7 @@ inline Ostream& operator<<
/*---------------------------------------------------------------------------*\
class triangle Declaration
Class triangle Declaration
\*---------------------------------------------------------------------------*/
template<class Point, class PointRef>
@ -96,6 +98,14 @@ public:
//- Construct from three points
inline triangle(const Point& a, const Point& b, const Point& c);
//- Construct from three points in the list of points
// The indices could be from triFace etc.
inline triangle
(
const UList<Point>&,
const FixedList<label, 3>& indices
);
//- Construct from Istream
inline triangle(Istream&);

View File

@ -27,15 +27,10 @@ License
#include "pointHit.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline triangle<Point, PointRef>::triangle
inline Foam::triangle<Point, PointRef>::triangle
(
const Point& a,
const Point& b,
@ -49,65 +44,70 @@ inline triangle<Point, PointRef>::triangle
template<class Point, class PointRef>
inline triangle<Point, PointRef>::triangle(Istream& is)
inline Foam::triangle<Point, PointRef>::triangle
(
const UList<Point>& points,
const FixedList<label, 3>& indices
)
:
a_(points[indices[0]]),
b_(points[indices[1]]),
c_(points[indices[2]])
{}
template<class Point, class PointRef>
inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
{
// Read beginning of triangle point pair
is.readBegin("triangle");
is >> a_ >> b_ >> c_;
// Read end of triangle point pair
is.readEnd("triangle");
// Check state of Istream
is.check("triangle::triangle(Istream& is)");
is >> *this;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline const Point& triangle<Point, PointRef>::a() const
inline const Point& Foam::triangle<Point, PointRef>::a() const
{
return a_;
}
template<class Point, class PointRef>
inline const Point& triangle<Point, PointRef>::b() const
inline const Point& Foam::triangle<Point, PointRef>::b() const
{
return b_;
}
template<class Point, class PointRef>
inline const Point& triangle<Point, PointRef>::c() const
inline const Point& Foam::triangle<Point, PointRef>::c() const
{
return c_;
}
template<class Point, class PointRef>
inline Point triangle<Point, PointRef>::centre() const
inline Point Foam::triangle<Point, PointRef>::centre() const
{
return (1.0/3.0)*(a_ + b_ + c_);
}
template<class Point, class PointRef>
inline scalar triangle<Point, PointRef>::mag() const
inline Foam::scalar Foam::triangle<Point, PointRef>::mag() const
{
return Foam::mag(normal());
}
template<class Point, class PointRef>
inline vector triangle<Point, PointRef>::normal() const
inline Foam::vector Foam::triangle<Point, PointRef>::normal() const
{
return 0.5*((b_ - a_)^(c_ - a_));
}
template<class Point, class PointRef>
inline Point triangle<Point, PointRef>::circumCentre() const
inline Point Foam::triangle<Point, PointRef>::circumCentre() const
{
scalar d1 = (c_ - a_) & (b_ - a_);
scalar d2 = -(c_ - b_) & (b_ - a_);
@ -134,7 +134,7 @@ inline Point triangle<Point, PointRef>::circumCentre() const
template<class Point, class PointRef>
inline scalar triangle<Point, PointRef>::circumRadius() const
inline Foam::scalar Foam::triangle<Point, PointRef>::circumRadius() const
{
scalar d1 = (c_ - a_) & (b_ - a_);
scalar d2 = -(c_ - b_) & (b_ - a_);
@ -158,14 +158,17 @@ inline scalar triangle<Point, PointRef>::circumRadius() const
template<class Point, class PointRef>
inline scalar triangle<Point, PointRef>::quality() const
inline Foam::scalar Foam::triangle<Point, PointRef>::quality() const
{
return mag()/(Foam::sqr(circumRadius())*3.0*sqrt(3.0)/4.0 + VSMALL);
}
template<class Point, class PointRef>
inline scalar triangle<Point, PointRef>::sweptVol(const triangle& t) const
inline Foam::scalar Foam::triangle<Point, PointRef>::sweptVol
(
const triangle& t
) const
{
return (1.0/12.0)*
(
@ -181,7 +184,7 @@ inline scalar triangle<Point, PointRef>::sweptVol(const triangle& t) const
template<class Point, class PointRef>
inline tensor triangle<Point, PointRef>::inertia
inline Foam::tensor Foam::triangle<Point, PointRef>::inertia
(
PointRef refPt,
scalar density
@ -218,7 +221,7 @@ inline tensor triangle<Point, PointRef>::inertia
template<class Point, class PointRef>
inline Point triangle<Point, PointRef>::randomPoint(Random& rndGen) const
inline Point Foam::triangle<Point, PointRef>::randomPoint(Random& rndGen) const
{
// Generating Random Points in Triangles
// by Greg Turk
@ -234,7 +237,7 @@ inline Point triangle<Point, PointRef>::randomPoint(Random& rndGen) const
template<class Point, class PointRef>
scalar triangle<Point, PointRef>::barycentric
Foam::scalar Foam::triangle<Point, PointRef>::barycentric
(
const point& pt,
List<scalar>& bary
@ -275,7 +278,7 @@ scalar triangle<Point, PointRef>::barycentric
template<class Point, class PointRef>
inline pointHit triangle<Point, PointRef>::ray
inline Foam::pointHit Foam::triangle<Point, PointRef>::ray
(
const point& p,
const vector& q,
@ -391,7 +394,7 @@ inline pointHit triangle<Point, PointRef>::ray
// From "Fast, Minimum Storage Ray/Triangle Intersection"
// Moeller/Trumbore.
template<class Point, class PointRef>
inline pointHit triangle<Point, PointRef>::intersection
inline Foam::pointHit Foam::triangle<Point, PointRef>::intersection
(
const point& orig,
const vector& dir,
@ -474,7 +477,7 @@ inline pointHit triangle<Point, PointRef>::intersection
template<class Point, class PointRef>
pointHit triangle<Point, PointRef>::nearestPointClassify
Foam::pointHit Foam::triangle<Point, PointRef>::nearestPointClassify
(
const point& p,
label& nearType,
@ -623,7 +626,7 @@ pointHit triangle<Point, PointRef>::nearestPointClassify
template<class Point, class PointRef>
inline pointHit triangle<Point, PointRef>::nearestPoint
inline Foam::pointHit Foam::triangle<Point, PointRef>::nearestPoint
(
const point& p
) const
@ -637,7 +640,7 @@ inline pointHit triangle<Point, PointRef>::nearestPoint
template<class Point, class PointRef>
inline bool triangle<Point, PointRef>::classify
inline bool Foam::triangle<Point, PointRef>::classify
(
const point& p,
label& nearType,
@ -650,38 +653,38 @@ inline bool triangle<Point, PointRef>::classify
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class point, class pointRef>
inline Istream& operator>>(Istream& is, triangle<point, pointRef>& t)
template<class Point, class PointRef>
inline Foam::Istream& Foam::operator>>
(
Istream& is,
triangle<Point, PointRef>& t
)
{
// Read beginning of triangle point pair
is.readBegin("triangle");
is >> t.a_ >> t.b_ >> t.c_;
// Read end of triangle point pair
is >> t.a_ >> t.b_ >> t.c_;
is.readEnd("triangle");
// Check state of Ostream
is.check("Istream& operator>>(Istream&, triangle&)");
return is;
}
template<class Point, class PointRef>
inline Ostream& operator<<(Ostream& os, const triangle<Point, PointRef>& t)
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,
const triangle<Point, PointRef>& t
)
{
os << nl
<< token::BEGIN_LIST
<< t.a_ << token::SPACE << t.b_ << token::SPACE << t.c_
<< t.a_ << token::SPACE
<< t.b_ << token::SPACE
<< t.c_
<< token::END_LIST;
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -119,9 +119,6 @@ public:
//- Assignment operator.
inline void operator=(const hashedWordList&);
//- Allow readonly access to list of words
inline operator const Foam::UList<word>&() const;
//- Return name corresponding to specified index
inline const word& operator[](const label index) const;

View File

@ -91,7 +91,8 @@ namespace Foam
const bool invert=false
)
{
return findStrings(regExp(rePattern), lst, invert);
const regExp re(rePattern);
return findStrings(re, lst, invert);
}
//- Return list indices for strings matching the regular expression
@ -104,7 +105,8 @@ namespace Foam
const bool invert=false
)
{
return findMatchingStrings(regExp(rePattern), lst, invert);
const regExp re(rePattern);
return findMatchingStrings(re, lst, invert);
}
//- Return list indices for strings matching the regular expression
@ -171,7 +173,8 @@ namespace Foam
const bool invert=false
)
{
return subsetMatchingStrings(regExp(rePattern), lst, invert);
const regExp re(rePattern);
return subsetMatchingStrings(re, lst, invert);
}
//- Extract elements of StringList when regular expression matches
@ -184,7 +187,8 @@ namespace Foam
const bool invert=false
)
{
return subsetMatchingStrings(regExp(rePattern), lst, invert);
const regExp re(rePattern);
return subsetMatchingStrings(re, lst, invert);
}
//- Extract elements of StringList when regular expression matches
@ -249,7 +253,8 @@ namespace Foam
const bool invert=false
)
{
inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert);
const regExp re(rePattern);
inplaceSubsetMatchingStrings(re, lst, invert);
}
//- Inplace extract elements of StringList when regular expression matches
@ -262,7 +267,8 @@ namespace Foam
const bool invert=false
)
{
inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert);
const regExp re(rePattern);
inplaceSubsetMatchingStrings(re, lst, invert);
}
//- Inplace extract elements of StringList when regular expression matches

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -490,7 +490,7 @@ unsigned Foam::Hasher
const short endianTest = 0x0100;
// yields 0x01 for big endian
if (*(reinterpret_cast<const char *>(&endianTest)))
if (*(reinterpret_cast<const char*>(&endianTest)))
{
return jenkins_hashbig(key, length, initval);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

Some files were not shown because too many files have changed in this diff Show More