Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
commit
8033592eb1
@ -62,15 +62,8 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
class hash
|
||||
:
|
||||
public Hash<interfacePair>
|
||||
struct hash
|
||||
{
|
||||
public:
|
||||
|
||||
hash()
|
||||
{}
|
||||
|
||||
label operator()(const interfacePair& key) const
|
||||
{
|
||||
return word::hash()(key.first()) + word::hash()(key.second());
|
||||
@ -80,8 +73,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
interfacePair()
|
||||
{}
|
||||
interfacePair() {} // = default
|
||||
|
||||
interfacePair(const word& alpha1Name, const word& alpha2Name)
|
||||
:
|
||||
|
@ -74,30 +74,16 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
class symmHash
|
||||
:
|
||||
public Hash<interfacePair>
|
||||
struct symmHash
|
||||
{
|
||||
public:
|
||||
|
||||
symmHash()
|
||||
{}
|
||||
|
||||
label operator()(const interfacePair& key) const
|
||||
{
|
||||
return word::hash()(key.first()) + word::hash()(key.second());
|
||||
}
|
||||
};
|
||||
|
||||
class hash
|
||||
:
|
||||
public Hash<interfacePair>
|
||||
struct hash
|
||||
{
|
||||
public:
|
||||
|
||||
hash()
|
||||
{}
|
||||
|
||||
label operator()(const interfacePair& key) const
|
||||
{
|
||||
return word::hash()(key.first(), word::hash()(key.second()));
|
||||
@ -107,8 +93,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
interfacePair()
|
||||
{}
|
||||
interfacePair() {} // = default
|
||||
|
||||
interfacePair(const word& alpha1Name, const word& alpha2Name)
|
||||
:
|
||||
@ -233,8 +218,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~multiphaseSystem()
|
||||
{}
|
||||
virtual ~multiphaseSystem() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -71,15 +71,8 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
class hash
|
||||
:
|
||||
public Hash<interfacePair>
|
||||
struct hash
|
||||
{
|
||||
public:
|
||||
|
||||
hash()
|
||||
{}
|
||||
|
||||
label operator()(const interfacePair& key) const
|
||||
{
|
||||
return word::hash()(key.first()) + word::hash()(key.second());
|
||||
@ -89,8 +82,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
interfacePair()
|
||||
{}
|
||||
interfacePair() {} // = default
|
||||
|
||||
interfacePair(const word& alpha1Name, const word& alpha2Name)
|
||||
:
|
||||
@ -196,8 +188,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~multiphaseMixture()
|
||||
{}
|
||||
virtual ~multiphaseMixture() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -27,14 +27,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phasePairKey::hash::hash()
|
||||
{}
|
||||
|
||||
|
||||
Foam::phasePairKey::phasePairKey()
|
||||
{}
|
||||
|
||||
|
||||
Foam::phasePairKey::phasePairKey
|
||||
(
|
||||
const word& name1,
|
||||
@ -47,12 +39,6 @@ Foam::phasePairKey::phasePairKey
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phasePairKey::~phasePairKey()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::phasePairKey::ordered() const
|
||||
@ -94,13 +80,13 @@ bool Foam::operator==
|
||||
const phasePairKey& b
|
||||
)
|
||||
{
|
||||
const label c = Pair<word>::compare(a,b);
|
||||
const label cmp = Pair<word>::compare(a,b);
|
||||
|
||||
return
|
||||
(a.ordered_ == b.ordered_)
|
||||
&& (
|
||||
(a.ordered_ && (c == 1))
|
||||
|| (!a.ordered_ && (c != 0))
|
||||
(a.ordered_ && (cmp == 1))
|
||||
|| (!a.ordered_ && (cmp != 0))
|
||||
);
|
||||
}
|
||||
|
||||
@ -127,7 +113,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
|
||||
{
|
||||
key.ordered_ = false;
|
||||
}
|
||||
else if(temp[1] == "in")
|
||||
else if (temp[1] == "in")
|
||||
{
|
||||
key.ordered_ = true;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
// Forward declarations
|
||||
|
||||
class phasePairKey;
|
||||
|
||||
@ -59,41 +59,24 @@ class phasePairKey
|
||||
:
|
||||
public Pair<word>
|
||||
{
|
||||
public:
|
||||
|
||||
class hash
|
||||
:
|
||||
public Hash<phasePairKey>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
// Construct null
|
||||
hash();
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
// Generate a hash from a phase pair key
|
||||
label operator()(const phasePairKey& key) const;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Flag to indicate whether ordering is important
|
||||
bool ordered_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
struct hash
|
||||
{
|
||||
// Generate a hash from a phase pair key
|
||||
label operator()(const phasePairKey& key) const;
|
||||
};
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
phasePairKey();
|
||||
phasePairKey() {} // = default
|
||||
|
||||
//- Construct from names and the ordering flag
|
||||
phasePairKey
|
||||
@ -105,7 +88,7 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
virtual ~phasePairKey();
|
||||
virtual ~phasePairKey() = default;
|
||||
|
||||
|
||||
// Access
|
||||
|
@ -27,14 +27,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phasePairKey::hash::hash()
|
||||
{}
|
||||
|
||||
|
||||
Foam::phasePairKey::phasePairKey()
|
||||
{}
|
||||
|
||||
|
||||
Foam::phasePairKey::phasePairKey
|
||||
(
|
||||
const word& name1,
|
||||
@ -47,12 +39,6 @@ Foam::phasePairKey::phasePairKey
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phasePairKey::~phasePairKey()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::phasePairKey::hash::operator()
|
||||
@ -86,13 +72,13 @@ bool Foam::operator==
|
||||
const phasePairKey& b
|
||||
)
|
||||
{
|
||||
const label c = Pair<word>::compare(a,b);
|
||||
const label cmp = Pair<word>::compare(a,b);
|
||||
|
||||
return
|
||||
(a.ordered_ == b.ordered_)
|
||||
&& (
|
||||
(a.ordered_ && (c == 1))
|
||||
|| (!a.ordered_ && (c != 0))
|
||||
(a.ordered_ && (cmp == 1))
|
||||
|| (!a.ordered_ && (cmp != 0))
|
||||
);
|
||||
}
|
||||
|
||||
@ -119,7 +105,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
|
||||
{
|
||||
key.ordered_ = false;
|
||||
}
|
||||
else if(temp[1] == "in")
|
||||
else if (temp[1] == "in")
|
||||
{
|
||||
key.ordered_ = true;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
// Forward declarations
|
||||
|
||||
class phasePairKey;
|
||||
|
||||
@ -59,48 +59,36 @@ class phasePairKey
|
||||
:
|
||||
public Pair<word>
|
||||
{
|
||||
public:
|
||||
|
||||
class hash
|
||||
:
|
||||
public Hash<phasePairKey>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
// Construct null
|
||||
hash();
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
// Generate a hash from a phase pair key
|
||||
label operator()(const phasePairKey& key) const;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Flag to indicate whether ordering is important
|
||||
bool ordered_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
struct hash
|
||||
{
|
||||
// Generate a hash from a phase pair key
|
||||
label operator()(const phasePairKey& key) const;
|
||||
};
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
phasePairKey();
|
||||
phasePairKey() {} // = default
|
||||
|
||||
//- Construct from names and the ordering flag
|
||||
phasePairKey(const word& name1, const word& name2, const bool ordered);
|
||||
phasePairKey
|
||||
(
|
||||
const word& name1,
|
||||
const word& name2,
|
||||
const bool ordered
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
virtual ~phasePairKey();
|
||||
virtual ~phasePairKey() = default;
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
setA = { "kjhk", "kjhk2", "abced" };
|
||||
|
||||
HashTable<label, word> tableA
|
||||
HashTable<label> tableA
|
||||
{
|
||||
{ "value1", 1 },
|
||||
{ "value2", 2 },
|
||||
|
@ -48,6 +48,23 @@ See also
|
||||
|
||||
#include <list>
|
||||
#include <numeric>
|
||||
#include <functional>
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Verify inheritance
|
||||
class MyStrings
|
||||
:
|
||||
public List<string>
|
||||
{
|
||||
public:
|
||||
|
||||
using List<string>::List;
|
||||
};
|
||||
|
||||
} // end namespace Foam
|
||||
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -66,6 +83,14 @@ void testFind(const T& val, const ListType& lst)
|
||||
}
|
||||
|
||||
|
||||
void printMyString(const UList<string>& lst)
|
||||
{
|
||||
MyStrings slist2(lst);
|
||||
|
||||
Info<<slist2 << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
@ -76,6 +101,7 @@ int main(int argc, char *argv[])
|
||||
argList::addOption("wordList", "wordList");
|
||||
argList::addOption("stringList", "stringList");
|
||||
argList::addOption("float", "xx");
|
||||
argList::addBoolOption("transform", "Test List::createList functionality");
|
||||
argList::addBoolOption("flag");
|
||||
|
||||
#include "setRootCase.H"
|
||||
@ -336,6 +362,85 @@ int main(int argc, char *argv[])
|
||||
Info<<"-flag:" << args["flag"] << endl;
|
||||
}
|
||||
|
||||
if (args.found("transform"))
|
||||
{
|
||||
Info<< nl << "Test List::createList functionality" << nl;
|
||||
|
||||
const auto labels = identity(15);
|
||||
Info<< "labels: " << flatOutput(labels) << endl;
|
||||
|
||||
{
|
||||
auto scalars = List<scalar>::createList
|
||||
(
|
||||
labels,
|
||||
[](const label& val){ return scalar(1.5*val); }
|
||||
);
|
||||
Info<< "scalars: " << flatOutput(scalars) << endl;
|
||||
}
|
||||
|
||||
{
|
||||
auto vectors = List<vector>::createList
|
||||
(
|
||||
labels,
|
||||
[](const label& val){ return vector(1.2*val, -1.2*val, 0); }
|
||||
);
|
||||
Info<< "vectors: " << flatOutput(vectors) << endl;
|
||||
}
|
||||
|
||||
{
|
||||
auto longs = List<long>::createList
|
||||
(
|
||||
labels,
|
||||
[](const label& val){ return val; }
|
||||
);
|
||||
Info<< "longs: " << flatOutput(longs) << endl;
|
||||
}
|
||||
{
|
||||
auto negs = List<label>::createList
|
||||
(
|
||||
labels,
|
||||
std::negate<label>()
|
||||
);
|
||||
Info<< "negs: " << flatOutput(negs) << endl;
|
||||
}
|
||||
|
||||
{
|
||||
auto scalars = List<scalar>::createList
|
||||
(
|
||||
labelRange::null.cbegin(),
|
||||
labelRange::identity(15).cend(),
|
||||
[](const label& val){ return scalar(-1.125*val); }
|
||||
);
|
||||
Info<< "scalars: " << flatOutput(scalars) << endl;
|
||||
}
|
||||
|
||||
#if WM_LABEL_SIZE == 32
|
||||
{
|
||||
List<int64_t> input(10);
|
||||
std::iota(input.begin(), input.end(), 0);
|
||||
|
||||
auto output = List<label>::createList
|
||||
(
|
||||
input,
|
||||
toLabel<int64_t>()
|
||||
);
|
||||
Info<< "label (from int64): " << flatOutput(output) << endl;
|
||||
}
|
||||
#elif WM_LABEL_SIZE == 64
|
||||
{
|
||||
List<int32_t> input(10);
|
||||
std::iota(input.begin(), input.end(), 0);
|
||||
|
||||
auto output = List<label>::createList
|
||||
(
|
||||
input,
|
||||
toLabel<int32_t>()
|
||||
);
|
||||
Info<< "label (from int32): " << flatOutput(output) << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (args.readIfPresent<scalar>("float", xxx))
|
||||
{
|
||||
Info<<"read float " << xxx << endl;
|
||||
@ -354,6 +459,8 @@ int main(int argc, char *argv[])
|
||||
if (args.found("stringList"))
|
||||
{
|
||||
sLst = args.readList<string>("stringList");
|
||||
|
||||
printMyString(sLst);
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
|
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
entry* e = dict1.add
|
||||
(
|
||||
Foam::name("entry%d", i),
|
||||
word::printf("entry%d", i),
|
||||
string("entry" + Foam::name(i))
|
||||
);
|
||||
entryInfo(e);
|
||||
@ -76,7 +76,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
entry* e = tmpdict.add
|
||||
(
|
||||
Foam::name("subentry%d", i),
|
||||
word::printf("subentry%d", i),
|
||||
string("subentry" + Foam::name(i))
|
||||
);
|
||||
entryInfo(e);
|
||||
@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
entry* e = dict1.add
|
||||
(
|
||||
Foam::name("dict%d", i),
|
||||
word::printf("dict%d", i),
|
||||
tmpdict
|
||||
);
|
||||
entryInfo(e);
|
||||
|
@ -64,14 +64,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Test Foam::name with formatting string
|
||||
{
|
||||
word formatted = Foam::name("formatted=<%X>", 0xdeadbeef);
|
||||
word formatted = word::printf("formatted=<%X>", 0xdeadbeef);
|
||||
Info<<"formatted: " << formatted << nl;
|
||||
}
|
||||
|
||||
Info<<"formatted: "
|
||||
<< Foam::name("formatted not checked for validity=<%X>", 0xdeadbeef)
|
||||
<< word::printf("formatted not checked for validity=<%X>", 0xdeadbeef)
|
||||
<< nl
|
||||
<< endl
|
||||
<< endl;
|
||||
|
||||
|
||||
Info<< "string:" << test << nl << "hash:"
|
||||
@ -227,7 +227,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
cout<< "\ntest Foam::name()\n";
|
||||
|
||||
Info<< "hash: = " << Foam::name("0x%012X", string::hash()(s2)) << endl;
|
||||
Info<< "hash: = " << word::printf("0x%012X", string::hash()(s2)) << endl;
|
||||
|
||||
// test formatting on int
|
||||
{
|
||||
@ -236,7 +236,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "int " << val << " as word >"
|
||||
<< Foam::name(val) << "< or "
|
||||
<< Foam::name("formatted >%08d<", val) << "\n";
|
||||
<< word::printf("formatted >%08d<", val) << "\n";
|
||||
}
|
||||
|
||||
// test formatting on scalar
|
||||
@ -244,7 +244,7 @@ int main(int argc, char *argv[])
|
||||
scalar val = 3.1415926535897931;
|
||||
Info<< "scalar " << val << " as word >"
|
||||
<< Foam::name(val) << "< or "
|
||||
<< Foam::name("formatted >%.9f<", val) << "\n";
|
||||
<< word::printf("formatted >%.9f<", val) << "\n";
|
||||
}
|
||||
|
||||
// test formatting on uint
|
||||
@ -254,7 +254,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "uint64 " << val << " as word >"
|
||||
<< Foam::name(val) << "< or "
|
||||
<< Foam::name("formatted >%08d<", val) << "\n";
|
||||
<< word::printf("formatted >%08d<", val) << "\n";
|
||||
}
|
||||
|
||||
// test startsWith, endsWith methods
|
||||
|
@ -853,7 +853,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
labelList own(boundaryFaces.size(), -1);
|
||||
labelList nei(boundaryFaces.size(), -1);
|
||||
HashTable<label, label> faceToCell[2];
|
||||
Map<label> faceToCell[2];
|
||||
|
||||
{
|
||||
HashTable<label, face, Hash<face>> faceToFaceID(boundaryFaces.size());
|
||||
|
@ -54,13 +54,6 @@ Foam::PrintTable<KeyType, DataType>::PrintTable
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class KeyType, class DataType>
|
||||
Foam::PrintTable<KeyType, DataType>::~PrintTable()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class KeyType, class DataType>
|
||||
@ -71,7 +64,7 @@ void Foam::PrintTable<KeyType, DataType>::print
|
||||
const bool printAverage
|
||||
) const
|
||||
{
|
||||
HashTable<HashTable<DataType, label>, KeyType> combinedTable;
|
||||
HashTable<Map<DataType>, KeyType> combinedTable;
|
||||
|
||||
List<HashTableData> procData(Pstream::nProcs(), HashTableData());
|
||||
|
||||
@ -90,36 +83,25 @@ void Foam::PrintTable<KeyType, DataType>::print
|
||||
{
|
||||
const HashTableData& procIData = procData[proci];
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTableData::const_iterator iter = procIData.begin();
|
||||
iter != procIData.end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIters(procIData, iter)
|
||||
{
|
||||
if (!combinedTable.found(iter.key()))
|
||||
{
|
||||
combinedTable.insert
|
||||
(
|
||||
iter.key(),
|
||||
HashTable<DataType, label>()
|
||||
Map<DataType>()
|
||||
);
|
||||
}
|
||||
|
||||
HashTable<DataType, label>& key = combinedTable[iter.key()];
|
||||
Map<DataType>& key = combinedTable[iter.key()];
|
||||
|
||||
key.insert(proci, iter());
|
||||
key.insert(proci, iter.object());
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<DataType, label>
|
||||
::const_iterator dataIter = key.begin();
|
||||
dataIter != key.end();
|
||||
++dataIter
|
||||
)
|
||||
forAllConstIters(key, dataIter)
|
||||
{
|
||||
std::ostringstream buf;
|
||||
buf << dataIter();
|
||||
buf << dataIter.object();
|
||||
|
||||
largestDataLength = max
|
||||
(
|
||||
@ -172,7 +154,7 @@ void Foam::PrintTable<KeyType, DataType>::print
|
||||
|
||||
forAll(sortedTable, keyI)
|
||||
{
|
||||
const HashTable<DataType, label>& procDataList
|
||||
const Map<DataType>& procDataList
|
||||
= combinedTable[sortedTable[keyI]];
|
||||
|
||||
os.width(largestKeyLength);
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~PrintTable();
|
||||
~PrintTable() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -33,18 +33,12 @@ Foam::pointFeatureEdgesTypes::pointFeatureEdgesTypes
|
||||
const label pointLabel
|
||||
)
|
||||
:
|
||||
HashTable<label, extendedFeatureEdgeMesh::edgeStatus>(),
|
||||
HashTable<label, extendedFeatureEdgeMesh::edgeStatus, Hash<label>>(),
|
||||
feMesh_(feMesh),
|
||||
pointLabel_(pointLabel)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointFeatureEdgesTypes::~pointFeatureEdgesTypes()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::List<Foam::extendedFeatureEdgeMesh::edgeStatus>
|
||||
@ -79,18 +73,12 @@ Foam::Ostream& Foam::operator<<
|
||||
{
|
||||
os << "Point = " << p.pointLabel_ << endl;
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<label, extendedFeatureEdgeMesh::edgeStatus>
|
||||
::const_iterator iter = p.cbegin();
|
||||
iter != p.cend();
|
||||
++iter
|
||||
)
|
||||
forAllConstIters(p, iter)
|
||||
{
|
||||
os << " "
|
||||
<< extendedFeatureEdgeMesh::edgeStatusNames_[iter.key()]
|
||||
<< " = "
|
||||
<< iter()
|
||||
<< iter.object()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ Ostream& operator<<(Ostream&, const pointFeatureEdgesTypes&);
|
||||
//- Hold the types of feature edges attached to the point.
|
||||
class pointFeatureEdgesTypes
|
||||
:
|
||||
public HashTable<label, extendedFeatureEdgeMesh::edgeStatus>
|
||||
public HashTable<label, extendedFeatureEdgeMesh::edgeStatus, Hash<label>>
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -82,7 +82,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~pointFeatureEdgesTypes();
|
||||
~pointFeatureEdgesTypes() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -1007,7 +1007,11 @@ Foam::label Foam::checkGeometry
|
||||
globalFaces().gather
|
||||
(
|
||||
UPstream::worldComm,
|
||||
labelList(UPstream::procID(UPstream::worldComm)),
|
||||
labelList::createList
|
||||
(
|
||||
UPstream::procID(UPstream::worldComm),
|
||||
toLabel<int>() // int -> label
|
||||
),
|
||||
ami.srcWeightsSum(),
|
||||
mergedWeights
|
||||
);
|
||||
@ -1057,7 +1061,11 @@ Foam::label Foam::checkGeometry
|
||||
globalFaces().gather
|
||||
(
|
||||
UPstream::worldComm,
|
||||
labelList(UPstream::procID(UPstream::worldComm)),
|
||||
labelList::createList
|
||||
(
|
||||
UPstream::procID(UPstream::worldComm),
|
||||
toLabel<int>() // int -> label
|
||||
),
|
||||
ami.tgtWeightsSum(),
|
||||
mergedWeights
|
||||
);
|
||||
|
@ -84,7 +84,11 @@ void writeWeights
|
||||
globalFaces().gather
|
||||
(
|
||||
UPstream::worldComm,
|
||||
labelList(UPstream::procID(UPstream::worldComm)),
|
||||
labelList::createList
|
||||
(
|
||||
UPstream::procID(UPstream::worldComm),
|
||||
toLabel<int>() // int -> label
|
||||
),
|
||||
wghtSum,
|
||||
mergedWeights
|
||||
);
|
||||
|
@ -162,13 +162,13 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime)
|
||||
}
|
||||
|
||||
|
||||
// Reduction for non-empty strings
|
||||
class uniqueEqOp
|
||||
// Reduction for non-empty strings.
|
||||
template<class StringType>
|
||||
struct uniqueEqOp
|
||||
{
|
||||
public:
|
||||
void operator()(stringList& x, const stringList& y) const
|
||||
void operator()(List<StringType>& x, const List<StringType>& y) const
|
||||
{
|
||||
stringList newX(x.size()+y.size());
|
||||
List<StringType> newX(x.size()+y.size());
|
||||
label n = 0;
|
||||
forAll(x, i)
|
||||
{
|
||||
@ -215,8 +215,8 @@ bool writeOptionalMeshObject
|
||||
bool haveFile = io.typeHeaderOk<IOField<label>>(false);
|
||||
|
||||
// Make sure all know if there is a valid class name
|
||||
stringList classNames(1, io.headerClassName());
|
||||
combineReduce(classNames, uniqueEqOp());
|
||||
wordList classNames(1, io.headerClassName());
|
||||
combineReduce(classNames, uniqueEqOp<word>());
|
||||
|
||||
// Check for correct type
|
||||
if (classNames[0] == T::typeName)
|
||||
@ -395,7 +395,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Check for lagrangian
|
||||
stringList lagrangianDirs
|
||||
fileNameList lagrangianDirs
|
||||
(
|
||||
1,
|
||||
fileHandler().filePath
|
||||
@ -406,7 +406,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
combineReduce(lagrangianDirs, uniqueEqOp());
|
||||
combineReduce(lagrangianDirs, uniqueEqOp<fileName>());
|
||||
|
||||
if (!lagrangianDirs.empty())
|
||||
{
|
||||
@ -434,7 +434,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
stringList cloudDirs
|
||||
fileNameList cloudDirs
|
||||
(
|
||||
fileHandler().readDir
|
||||
(
|
||||
@ -443,7 +443,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
combineReduce(cloudDirs, uniqueEqOp());
|
||||
combineReduce(cloudDirs, uniqueEqOp<fileName>());
|
||||
|
||||
forAll(cloudDirs, i)
|
||||
{
|
||||
@ -464,13 +464,11 @@ int main(int argc, char *argv[])
|
||||
IOobjectList sprayObjs(runTime, runTime.timeName(), dir);
|
||||
|
||||
// Combine with all other cloud objects
|
||||
stringList sprayFields(sprayObjs.sortedToc());
|
||||
combineReduce(sprayFields, uniqueEqOp());
|
||||
wordList sprayFields(sprayObjs.sortedToc());
|
||||
combineReduce(sprayFields, uniqueEqOp<word>());
|
||||
|
||||
forAll(sprayFields, fieldi)
|
||||
for (const word& name : sprayFields)
|
||||
{
|
||||
const word& name = sprayFields[fieldi];
|
||||
|
||||
// Note: try the various field types. Make sure to
|
||||
// exit once sucessful conversion to avoid re-read
|
||||
// converted file.
|
||||
|
@ -1,14 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Optional unit: continue-on-error
|
||||
export WM_CONTINUE_ON_ERROR=true
|
||||
|
||||
# Parse arguments for library compilation
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
# Source CMake functions
|
||||
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
export WM_CONTINUE_ON_ERROR=true # Optional unit
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # Parse arguments
|
||||
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions # The CMake functions
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
|
||||
if (withVTK && Pstream::master())
|
||||
{
|
||||
const word outputName =
|
||||
Foam::name("forces_%06d.vtp", runTime.timeIndex());
|
||||
word::printf("forces_%06d.vtp", runTime.timeIndex());
|
||||
|
||||
Info<<" " << outputName << endl;
|
||||
|
||||
|
@ -226,14 +226,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
// State/response = what comes back from FEM
|
||||
{
|
||||
const word outputName = Foam::name("state_%06d.vtp", index);
|
||||
const word outputName = word::printf("state_%06d.vtp", index);
|
||||
|
||||
Info<<" " << outputName << endl;
|
||||
|
||||
state.writeVTP(outputName, movement().axis());
|
||||
}
|
||||
|
||||
{
|
||||
const word outputName = Foam::name("geom_%06d.vtp", index);
|
||||
const word outputName = word::printf("geom_%06d.vtp", index);
|
||||
|
||||
Info<<" " << outputName << endl;
|
||||
|
||||
movement().writeVTP(outputName, state, mesh, patchLst, points0);
|
||||
|
31
bin/foamTags
31
bin/foamTags
@ -46,21 +46,34 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for cmd in etags ctags-exuberant
|
||||
unset etags
|
||||
for cmd in ctags-exuberant etags
|
||||
do
|
||||
type $cmd >/dev/null 2>&1 || {
|
||||
echo "${0##*/} cannot build tag files: '$cmd' command not found"
|
||||
exit 1
|
||||
}
|
||||
command -v $cmd >/dev/null 2>&1 && { etags=$cmd; break; }
|
||||
done
|
||||
|
||||
[ -n "$etags" ] || {
|
||||
exec 1>&2
|
||||
echo "${0##*/} cannot build tag files: no suitable command found"
|
||||
echo " No ctags-exuberant"
|
||||
echo " No etags"
|
||||
exit 1
|
||||
}
|
||||
|
||||
case "$etags" in
|
||||
ctags-exuberant)
|
||||
etags="$etags -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -"
|
||||
;;
|
||||
etags)
|
||||
etags="$etags --declarations -l c++ -o .tags/etags -"
|
||||
;;
|
||||
esac
|
||||
|
||||
cd $WM_PROJECT_DIR || exit 1
|
||||
mkdir .tags 2>/dev/null
|
||||
|
||||
#etagsCmd="etags --declarations -l c++ -o .tags/etags -"
|
||||
etagsCmd="ctags-exuberant -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -"
|
||||
|
||||
find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsCmd
|
||||
echo "building tags..." 1>&2
|
||||
find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etags
|
||||
|
||||
#gtags -i --gtagsconf bin/tools/gtagsrc .tags
|
||||
|
||||
|
@ -133,7 +133,7 @@ void printSourceFileAndLine
|
||||
else
|
||||
{
|
||||
string cwdLine(line.replaceAll(cwd() + '/', ""));
|
||||
string homeLine(cwdLine.replaceAll(home(), '~'));
|
||||
string homeLine(cwdLine.replaceAll(home(), "~"));
|
||||
|
||||
os << " at " << homeLine.c_str();
|
||||
}
|
||||
|
@ -122,10 +122,7 @@ Foam::HashSet<Key, Hash>::HashSet
|
||||
:
|
||||
parent_type(tbl.capacity())
|
||||
{
|
||||
using other_iter =
|
||||
typename HashTable<AnyType, Key, AnyHash>::const_iterator;
|
||||
|
||||
for (other_iter iter = tbl.cbegin(); iter != tbl.cend(); ++iter)
|
||||
for (auto iter = tbl.cbegin(); iter != tbl.cend(); ++iter)
|
||||
{
|
||||
this->insert(iter.key());
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ Note
|
||||
The HashSet iterator dereferences to the key, so the following
|
||||
range-for works as expected:
|
||||
\code
|
||||
HashSet<label> someLabels{10, 20, 30, 40, ...};
|
||||
labelHashSet someLabels{10, 20, 30, 40, ...};
|
||||
for (const label i : someLabels)
|
||||
{
|
||||
Info<< "val:" << i << nl;
|
||||
@ -55,7 +55,7 @@ Typedef
|
||||
Foam::labelHashSet
|
||||
|
||||
Description
|
||||
A HashSet with label keys.
|
||||
A HashSet with label keys and label hasher.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -162,18 +162,6 @@ public:
|
||||
parent_type(std::move(hs))
|
||||
{}
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
HashSet(const Xfer<this_type>& hs)
|
||||
:
|
||||
parent_type(hs)
|
||||
{}
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
HashSet(const Xfer<parent_type>& hs)
|
||||
:
|
||||
parent_type(hs)
|
||||
{}
|
||||
|
||||
//- Construct from the keys of another HashTable,
|
||||
//- the type of values held is arbitrary.
|
||||
template<class AnyType, class AnyHash>
|
||||
@ -427,7 +415,7 @@ HashSet<Key,Hash> operator^
|
||||
//- A HashSet with word keys.
|
||||
typedef HashSet<> wordHashSet;
|
||||
|
||||
//- A HashSet with label keys.
|
||||
//- A HashSet with label keys and label hasher.
|
||||
typedef HashSet<label, Hash<label>> labelHashSet;
|
||||
|
||||
|
||||
|
@ -108,18 +108,6 @@ Foam::HashTable<T, Key, Hash>::HashTable(HashTable<T, Key, Hash>&& ht)
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashTable<T, Key, Hash>::HashTable
|
||||
(
|
||||
const Xfer<HashTable<T, Key, Hash>>& ht
|
||||
)
|
||||
:
|
||||
HashTable<T, Key, Hash>(0)
|
||||
{
|
||||
transfer(ht());
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashTable<T, Key, Hash>::HashTable
|
||||
(
|
||||
|
@ -83,7 +83,6 @@ SourceFiles
|
||||
|
||||
#include "word.H"
|
||||
#include "zero.H"
|
||||
#include "Xfer.H"
|
||||
#include "Hash.H"
|
||||
#include "HashTableCore.H"
|
||||
|
||||
@ -343,9 +342,6 @@ public:
|
||||
//- Move construct
|
||||
HashTable(this_type&& ht);
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
HashTable(const Xfer<this_type>& ht);
|
||||
|
||||
//- Construct from an initializer list
|
||||
HashTable(std::initializer_list<std::pair<Key, T>> lst);
|
||||
|
||||
@ -602,9 +598,6 @@ public:
|
||||
// and annul the argument table.
|
||||
void transfer(HashTable<T, Key, Hash>& ht);
|
||||
|
||||
//- Transfer contents to the Xfer container
|
||||
inline Xfer<HashTable<T, Key, Hash>> xfer();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -622,9 +615,6 @@ public:
|
||||
//- Return existing entry or insert a new entry.
|
||||
inline T& operator()(const Key& key, const T& deflt);
|
||||
|
||||
//- Return hashed entry if it exists, or return the given default
|
||||
inline const T& operator()(const Key& key, const T& deflt) const;
|
||||
|
||||
//- Assignment
|
||||
void operator=(const HashTable<T, Key, Hash>& rhs);
|
||||
|
||||
|
@ -136,14 +136,6 @@ inline bool Foam::HashTable<T, Key, Hash>::set
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline Foam::Xfer<Foam::HashTable<T, Key, Hash>>
|
||||
Foam::HashTable<T, Key, Hash>::xfer()
|
||||
{
|
||||
return xferMove(*this);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const T& Foam::HashTable<T, Key, Hash>::lookup
|
||||
(
|
||||
@ -226,17 +218,6 @@ inline T& Foam::HashTable<T, Key, Hash>::operator()
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const T& Foam::HashTable<T, Key, Hash>::operator()
|
||||
(
|
||||
const Key& key,
|
||||
const T& deflt
|
||||
) const
|
||||
{
|
||||
return this->lookup(key, deflt);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
|
@ -100,18 +100,6 @@ public:
|
||||
parent_type(std::move(map))
|
||||
{}
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
Map(const Xfer<this_type>& map)
|
||||
:
|
||||
parent_type(map)
|
||||
{}
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
Map(const Xfer<parent_type>& map)
|
||||
:
|
||||
parent_type(map)
|
||||
{}
|
||||
|
||||
//- Construct from an initializer list
|
||||
Map(std::initializer_list<std::pair<label, T>> map)
|
||||
:
|
||||
|
@ -101,12 +101,8 @@ public:
|
||||
//- Hashing function class.
|
||||
// Use Hasher directly for contiguous data. Otherwise hash incrementally.
|
||||
template<class HashT=Hash<T>>
|
||||
class Hash
|
||||
struct Hash
|
||||
{
|
||||
public:
|
||||
Hash()
|
||||
{}
|
||||
|
||||
inline unsigned operator()
|
||||
(
|
||||
const FixedList<T, Size>&,
|
||||
|
@ -546,18 +546,16 @@ inline unsigned Foam::FixedList<T, Size>::Hash<HashT>::operator()
|
||||
// Hash directly
|
||||
return Hasher(lst.v_, sizeof(lst.v_), seed);
|
||||
}
|
||||
else
|
||||
|
||||
// Hash incrementally
|
||||
unsigned val = seed;
|
||||
|
||||
for (unsigned i=0; i<Size; ++i)
|
||||
{
|
||||
// Hash incrementally
|
||||
unsigned val = seed;
|
||||
|
||||
for (unsigned i=0; i<Size; ++i)
|
||||
{
|
||||
val = HashT()(lst[i], val);
|
||||
}
|
||||
|
||||
return val;
|
||||
val = HashT()(lst[i], val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,17 +35,76 @@ License
|
||||
|
||||
#include <utility>
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
template<class T2, class UnaryOperation>
|
||||
Foam::List<T> Foam::List<T>::createList
|
||||
(
|
||||
const UList<T2>& input,
|
||||
const UnaryOperation& op
|
||||
)
|
||||
{
|
||||
const label len = input.size();
|
||||
|
||||
List<T> output(len);
|
||||
|
||||
if (len)
|
||||
{
|
||||
List_ACCESS(T, output, out);
|
||||
List_CONST_ACCESS(T2, input, in);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
out[i] = op(in[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class InputIterator, class UnaryOperation>
|
||||
Foam::List<T> Foam::List<T>::createList
|
||||
(
|
||||
InputIterator begIter,
|
||||
InputIterator endIter,
|
||||
const UnaryOperation& op
|
||||
)
|
||||
{
|
||||
const label len = std::distance(begIter, endIter);
|
||||
|
||||
List<T> output(len);
|
||||
|
||||
if (len)
|
||||
{
|
||||
List_ACCESS(T, output, out);
|
||||
|
||||
InputIterator iter = begIter;
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
out[i] = op(*iter);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::List<T>::List(const label s)
|
||||
Foam::List<T>::List(const label len)
|
||||
:
|
||||
UList<T>(nullptr, s)
|
||||
UList<T>(nullptr, len)
|
||||
{
|
||||
if (this->size_ < 0)
|
||||
if (len < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "bad size " << this->size_
|
||||
<< "bad size " << len
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -54,23 +113,23 @@ Foam::List<T>::List(const label s)
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::List<T>::List(const label s, const T& val)
|
||||
Foam::List<T>::List(const label len, const T& val)
|
||||
:
|
||||
UList<T>(nullptr, s)
|
||||
UList<T>(nullptr, len)
|
||||
{
|
||||
if (this->size_ < 0)
|
||||
if (len < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "bad size " << this->size_
|
||||
<< "bad size " << len
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
alloc();
|
||||
|
||||
if (this->size_)
|
||||
if (len)
|
||||
{
|
||||
alloc();
|
||||
|
||||
List_ACCESS(T, (*this), vp);
|
||||
List_FOR_ALL((*this), i)
|
||||
for (label i=0; i < len; ++i)
|
||||
{
|
||||
vp[i] = val;
|
||||
}
|
||||
@ -79,23 +138,23 @@ Foam::List<T>::List(const label s, const T& val)
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::List<T>::List(const label s, const zero)
|
||||
Foam::List<T>::List(const label len, const zero)
|
||||
:
|
||||
UList<T>(nullptr, s)
|
||||
UList<T>(nullptr, len)
|
||||
{
|
||||
if (this->size_ < 0)
|
||||
if (len < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "bad size " << this->size_
|
||||
<< "bad size " << len
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
alloc();
|
||||
|
||||
if (this->size_)
|
||||
if (len)
|
||||
{
|
||||
alloc();
|
||||
|
||||
List_ACCESS(T, (*this), vp);
|
||||
List_FOR_ALL((*this), i)
|
||||
for (label i=0; i < len; ++i)
|
||||
{
|
||||
vp[i] = Zero;
|
||||
}
|
||||
@ -103,6 +162,34 @@ Foam::List<T>::List(const label s, const zero)
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::List<T>::List(const UList<T>& a)
|
||||
:
|
||||
UList<T>(nullptr, a.size_)
|
||||
{
|
||||
if (this->size_)
|
||||
{
|
||||
alloc();
|
||||
|
||||
#ifdef USEMEMCPY
|
||||
if (contiguous<T>())
|
||||
{
|
||||
memcpy(this->v_, a.v_, this->byteSize());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
List_ACCESS(T, (*this), vp);
|
||||
List_CONST_ACCESS(T, a, ap);
|
||||
List_FOR_ALL((*this), i)
|
||||
{
|
||||
vp[i] = ap[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::List<T>::List(const List<T>& a)
|
||||
:
|
||||
@ -131,26 +218,6 @@ Foam::List<T>::List(const List<T>& a)
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class T2>
|
||||
Foam::List<T>::List(const List<T2>& a)
|
||||
:
|
||||
UList<T>(nullptr, a.size())
|
||||
{
|
||||
if (this->size_)
|
||||
{
|
||||
alloc();
|
||||
|
||||
List_ACCESS(T, (*this), vp);
|
||||
List_CONST_ACCESS(T2, a, ap);
|
||||
List_FOR_ALL((*this), i)
|
||||
{
|
||||
vp[i] = T(ap[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::List<T>::List(List<T>& a, bool reuse)
|
||||
:
|
||||
@ -191,13 +258,14 @@ Foam::List<T>::List(const UList<T>& lst, const labelUList& mapAddressing)
|
||||
:
|
||||
UList<T>(nullptr, mapAddressing.size())
|
||||
{
|
||||
if (this->size_)
|
||||
const label len = mapAddressing.size();
|
||||
|
||||
if (len)
|
||||
{
|
||||
alloc();
|
||||
|
||||
List_ACCESS(T, (*this), vp);
|
||||
|
||||
const label len = (*this).size();
|
||||
for (label i=0; i < len; ++i)
|
||||
{
|
||||
vp[i] = lst[mapAddressing[i]];
|
||||
@ -220,7 +288,8 @@ Foam::List<T>::List(const FixedList<T, Size>& lst)
|
||||
:
|
||||
UList<T>(nullptr, Size)
|
||||
{
|
||||
allocCopyList(lst);
|
||||
alloc();
|
||||
copyList(lst);
|
||||
}
|
||||
|
||||
|
||||
@ -229,7 +298,8 @@ Foam::List<T>::List(const PtrList<T>& lst)
|
||||
:
|
||||
UList<T>(nullptr, lst.size())
|
||||
{
|
||||
allocCopyList(lst);
|
||||
alloc();
|
||||
copyList(lst);
|
||||
}
|
||||
|
||||
|
||||
@ -245,7 +315,8 @@ Foam::List<T>::List(const UIndirectList<T>& lst)
|
||||
:
|
||||
UList<T>(nullptr, lst.size())
|
||||
{
|
||||
allocCopyList(lst);
|
||||
alloc();
|
||||
copyList(lst);
|
||||
}
|
||||
|
||||
|
||||
@ -254,7 +325,8 @@ Foam::List<T>::List(const BiIndirectList<T>& lst)
|
||||
:
|
||||
UList<T>(nullptr, lst.size())
|
||||
{
|
||||
allocCopyList(lst);
|
||||
alloc();
|
||||
copyList(lst);
|
||||
}
|
||||
|
||||
|
||||
@ -329,7 +401,7 @@ void Foam::List<T>::setSize(const label newSize)
|
||||
{
|
||||
if (newSize > 0)
|
||||
{
|
||||
T* nv = new T[label(newSize)];
|
||||
T* nv = new T[newSize];
|
||||
|
||||
const label overlap = min(this->size_, newSize);
|
||||
|
||||
@ -367,7 +439,7 @@ void Foam::List<T>::setSize(const label newSize)
|
||||
template<class T>
|
||||
void Foam::List<T>::setSize(const label newSize, const T& val)
|
||||
{
|
||||
const label oldSize = label(this->size_);
|
||||
const label oldSize = this->size_;
|
||||
this->setSize(newSize);
|
||||
|
||||
List_ACCESS(T, *this, vp);
|
||||
@ -474,28 +546,58 @@ void Foam::List<T>::operator=(const SLList<T>& lst)
|
||||
template<class T>
|
||||
void Foam::List<T>::operator=(const UIndirectList<T>& lst)
|
||||
{
|
||||
reAlloc(lst.size());
|
||||
copyList(lst);
|
||||
const label len = lst.size();
|
||||
|
||||
reAlloc(len);
|
||||
|
||||
if (len)
|
||||
{
|
||||
List_ACCESS(T, (*this), vp);
|
||||
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
vp[i] = lst[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::List<T>::operator=(const BiIndirectList<T>& lst)
|
||||
{
|
||||
reAlloc(lst.size());
|
||||
copyList(lst);
|
||||
const label len = lst.size();
|
||||
|
||||
reAlloc(len);
|
||||
|
||||
if (len)
|
||||
{
|
||||
List_ACCESS(T, (*this), vp);
|
||||
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
vp[i] = lst[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::List<T>::operator=(std::initializer_list<T> lst)
|
||||
{
|
||||
reAlloc(lst.size());
|
||||
const label len = lst.size();
|
||||
|
||||
label i = 0;
|
||||
for (const auto& val : lst)
|
||||
reAlloc(len);
|
||||
|
||||
if (len)
|
||||
{
|
||||
this->operator[](i++) = val;
|
||||
List_ACCESS(T, (*this), vp);
|
||||
|
||||
label i = 0;
|
||||
for (const auto& val : lst)
|
||||
{
|
||||
vp[i] = val;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,16 +50,12 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward declarations
|
||||
|
||||
class Istream;
|
||||
class Ostream;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class T> class List;
|
||||
|
||||
template<class T> Istream& operator>>(Istream& is, List<T>& L);
|
||||
|
||||
template<class T, unsigned Size> class FixedList;
|
||||
template<class T> class PtrList;
|
||||
|
||||
@ -75,8 +71,11 @@ template<class T> class IndirectList;
|
||||
template<class T> class UIndirectList;
|
||||
template<class T> class BiIndirectList;
|
||||
|
||||
template<class T> Istream& operator>>(Istream& is, List<T>& L);
|
||||
|
||||
typedef List<char> charList;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class List Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -92,16 +91,12 @@ class List
|
||||
inline void alloc();
|
||||
|
||||
//- Reallocate list storage to the given size
|
||||
inline void reAlloc(const label s);
|
||||
inline void reAlloc(const label len);
|
||||
|
||||
//- Copy list of given type
|
||||
//- Copy list of given type.
|
||||
template<class List2>
|
||||
inline void copyList(const List2& lst);
|
||||
|
||||
//- Allocate storage and copy list of given type
|
||||
template<class List2>
|
||||
inline void allocCopyList(const List2& lst);
|
||||
|
||||
//- Construct given begin/end iterators and number of elements
|
||||
// Since the size is provided, the end iterator is actually ignored.
|
||||
template<class InputIterator>
|
||||
@ -109,7 +104,7 @@ class List
|
||||
(
|
||||
InputIterator begIter,
|
||||
InputIterator endIter,
|
||||
const label s
|
||||
const label len
|
||||
);
|
||||
|
||||
|
||||
@ -120,6 +115,44 @@ public:
|
||||
//- Return a null List
|
||||
inline static const List<T>& null();
|
||||
|
||||
//- Create from a list of a dissimilar type.
|
||||
// Eg, convert a list of ints to floats, vectors etc.
|
||||
// For example,
|
||||
// \code
|
||||
// auto vectors = List<vector>::createList
|
||||
// (
|
||||
// ints,
|
||||
// [](const int& val){ return vector(1.5*val, 0, 0); }
|
||||
// );
|
||||
//
|
||||
// auto neg = labelList::createList
|
||||
// (
|
||||
// ints,
|
||||
// std::negate<label>()
|
||||
// );
|
||||
// auto labels = labelList::createList
|
||||
// (
|
||||
// ints,
|
||||
// toLabel<int>()
|
||||
// );
|
||||
// \endcode
|
||||
template<class T2, class UnaryOperation>
|
||||
static List<T> createList
|
||||
(
|
||||
const UList<T2>& input,
|
||||
const UnaryOperation& op
|
||||
);
|
||||
|
||||
//- Create from an iterator range (uses std::distance for the size).
|
||||
// The unary operation can be used to convert to other types.
|
||||
template<class InputIterator, class UnaryOperation>
|
||||
static List<T> createList
|
||||
(
|
||||
InputIterator begIter,
|
||||
InputIterator endIter,
|
||||
const UnaryOperation& op
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -127,22 +160,19 @@ public:
|
||||
inline List();
|
||||
|
||||
//- Construct with given size
|
||||
explicit List(const label s);
|
||||
explicit List(const label len);
|
||||
|
||||
//- Construct with given size and value for all elements
|
||||
List(const label s, const T& val);
|
||||
List(const label len, const T& val);
|
||||
|
||||
//- Construct with given size initializing all elements to zero
|
||||
List(const label s, const zero);
|
||||
List(const label len, const zero);
|
||||
|
||||
//- Copy constructor from list
|
||||
//- Copy construct from list
|
||||
List(const List<T>& a);
|
||||
|
||||
//- Copy constructor from list containing another type.
|
||||
// This is primarily useful to convert a list of ints into floats,
|
||||
// for example.
|
||||
template<class T2>
|
||||
explicit List(const List<T2>& a);
|
||||
//- Copy construct contents from list
|
||||
explicit List(const UList<T>& a);
|
||||
|
||||
//- Construct as copy or re-use as specified
|
||||
List(List<T>& a, bool reuse);
|
||||
@ -151,7 +181,7 @@ public:
|
||||
List(const UList<T>& lst, const labelUList& mapAddressing);
|
||||
|
||||
//- Construct given begin/end iterators.
|
||||
// Uses std::distance to determine the size.
|
||||
// Uses std::distance for the size.
|
||||
template<class InputIterator>
|
||||
List(InputIterator begIter, InputIterator endIter);
|
||||
|
||||
|
@ -36,12 +36,12 @@ inline void Foam::List<T>::alloc()
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::List<T>::reAlloc(const label s)
|
||||
inline void Foam::List<T>::reAlloc(const label len)
|
||||
{
|
||||
if (this->size_ != s)
|
||||
if (this->size_ != len)
|
||||
{
|
||||
clear();
|
||||
this->size_ = s;
|
||||
this->size_ = len;
|
||||
alloc();
|
||||
}
|
||||
}
|
||||
@ -51,24 +51,11 @@ template<class T>
|
||||
template<class List2>
|
||||
inline void Foam::List<T>::copyList(const List2& lst)
|
||||
{
|
||||
if (this->size_)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i) = lst[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
const label len = this->size_;
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class List2>
|
||||
inline void Foam::List<T>::allocCopyList(const List2& lst)
|
||||
{
|
||||
if (this->size_)
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
alloc();
|
||||
copyList(lst);
|
||||
this->operator[](i) = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,17 +66,17 @@ inline Foam::List<T>::List
|
||||
(
|
||||
InputIterator begIter,
|
||||
InputIterator endIter,
|
||||
const label s
|
||||
const label len
|
||||
)
|
||||
:
|
||||
UList<T>(nullptr, s)
|
||||
UList<T>(nullptr, len)
|
||||
{
|
||||
if (this->size_)
|
||||
{
|
||||
alloc();
|
||||
|
||||
InputIterator iter = begIter;
|
||||
for (label i = 0; i < s; ++i)
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
this->operator[](i) = *iter;
|
||||
++iter;
|
||||
@ -135,16 +122,16 @@ inline void Foam::List<T>::clear()
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::List<T>::resize(const label newSize)
|
||||
inline void Foam::List<T>::resize(const label len)
|
||||
{
|
||||
this->setSize(newSize);
|
||||
this->setSize(len);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::List<T>::resize(const label newSize, const T& val)
|
||||
inline void Foam::List<T>::resize(const label len, const T& val)
|
||||
{
|
||||
this->setSize(newSize, val);
|
||||
this->setSize(len, val);
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "ListOps.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::labelList Foam::emptyLabelList;
|
||||
|
@ -33,6 +33,14 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Convert a single character to a word with length 1
|
||||
inline static Foam::word charToWord(char c)
|
||||
{
|
||||
return Foam::word(std::string(1, c), false);
|
||||
}
|
||||
|
||||
|
||||
// Adjust stream format based on the flagMask
|
||||
inline static void processFlags(Istream& is, int flagMask)
|
||||
{
|
||||
@ -45,7 +53,8 @@ inline static void processFlags(Istream& is, int flagMask)
|
||||
is.format(IOstream::BINARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -315,7 +324,7 @@ Foam::Istream& Foam::UIPstream::read(token& t)
|
||||
{
|
||||
if (isalpha(c))
|
||||
{
|
||||
t = word(c);
|
||||
t = charToWord(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,19 @@ License
|
||||
// Truncate error message for readability
|
||||
static const unsigned errLen = 80;
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// Convert a single character to a word with length 1
|
||||
inline static Foam::word charToWord(char c)
|
||||
{
|
||||
return Foam::word(std::string(1, c), false);
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
@ -210,7 +223,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
|
||||
if (read(nextC).bad())
|
||||
{
|
||||
// Return lone '#' as word
|
||||
t = token(word(c));
|
||||
t = charToWord(c);
|
||||
}
|
||||
else if (nextC == token::BEGIN_BLOCK)
|
||||
{
|
||||
@ -246,7 +259,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
|
||||
if (read(nextC).bad())
|
||||
{
|
||||
// Return lone '$' as word
|
||||
t = token(word(c));
|
||||
t = charToWord(c);
|
||||
}
|
||||
else if (nextC == token::BEGIN_BLOCK)
|
||||
{
|
||||
|
@ -141,10 +141,10 @@ void Foam::Time::readDict()
|
||||
)
|
||||
{
|
||||
// Remove the old watches since destroying the file
|
||||
fileNameList oldWatchedFiles(controlDict_.watchIndices());
|
||||
fileNameList oldWatchedFiles(controlDict_.watchIndices().size());
|
||||
forAllReverse(controlDict_.watchIndices(), i)
|
||||
{
|
||||
label watchi = controlDict_.watchIndices()[i];
|
||||
const label watchi = controlDict_.watchIndices()[i];
|
||||
oldWatchedFiles[i] = fileHandler().getFile(watchi);
|
||||
fileHandler().removeWatch(watchi);
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ Foam::error::operator Foam::dictionary() const
|
||||
dictionary errDict;
|
||||
|
||||
string oneLineMessage(message());
|
||||
oneLineMessage.replaceAll('\n', ' ');
|
||||
oneLineMessage.replaceAll("\n", " ");
|
||||
|
||||
errDict.add("type", word("Foam::error"));
|
||||
errDict.add("message", oneLineMessage);
|
||||
|
@ -45,9 +45,9 @@ namespace Foam
|
||||
Foam::word Foam::graph::wordify(const Foam::string& sname)
|
||||
{
|
||||
string wname = sname;
|
||||
wname.replace(' ', '_');
|
||||
wname.replace('(', '_');
|
||||
wname.replace(')', "");
|
||||
wname.replace(" ", "_");
|
||||
wname.replace("(", "_");
|
||||
wname.replace(")", "");
|
||||
|
||||
return word(wname);
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ void Foam::globalPoints::remove
|
||||
// those points where the equivalence list is only me and my (face)neighbour
|
||||
|
||||
// Save old ones.
|
||||
Map<label> oldMeshToProcPoint(meshToProcPoint_.xfer());
|
||||
Map<label> oldMeshToProcPoint(std::move(meshToProcPoint_));
|
||||
meshToProcPoint_.resize(oldMeshToProcPoint.size());
|
||||
DynamicList<labelPairList> oldProcPoints(procPoints_.xfer());
|
||||
procPoints_.setCapacity(oldProcPoints.size());
|
||||
|
@ -23,8 +23,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -64,18 +62,6 @@ word name(const Scalar val)
|
||||
}
|
||||
|
||||
|
||||
word name(const char* fmt, const Scalar val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
word name(const std::string& fmt, const Scalar val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
Scalar ScalarRead(const char* buf)
|
||||
{
|
||||
char* endptr = nullptr;
|
||||
|
@ -105,17 +105,10 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * IO/Conversion * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Return a string representation of a Scalar
|
||||
//- Return a word representation of a Scalar.
|
||||
// Uses stringstream instead of std::to_string for more consistent formatting.
|
||||
word name(const Scalar val);
|
||||
|
||||
//- Return a word representation of a Scalar, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const char* fmt, const Scalar val);
|
||||
|
||||
//- Return a word representation of a Scalar, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const std::string& fmt, const Scalar val);
|
||||
|
||||
//- Parse entire buffer as a float/double, skipping leading/trailing whitespace.
|
||||
// \return Parsed value or FatalIOError on any problem
|
||||
Scalar ScalarRead(const char* buf);
|
||||
|
@ -44,21 +44,16 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
//template<class Type> class Hash;
|
||||
//template<> class Hash<label>;
|
||||
//template<class Type> struct Hash;
|
||||
//template<> struct Hash<label>;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Hash Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class PrimitiveType>
|
||||
class Hash
|
||||
struct Hash
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
unsigned operator()(const PrimitiveType& p, unsigned seed) const
|
||||
{
|
||||
return Hasher(&p, sizeof(p), seed);
|
||||
@ -76,13 +71,8 @@ public:
|
||||
|
||||
//- Hash specialization for hashing labels
|
||||
template<>
|
||||
class Hash<Foam::label>
|
||||
struct Hash<Foam::label>
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
//- Incrementally hash a label.
|
||||
// This will necessarily return a different value than the
|
||||
// non-incremental version.
|
||||
@ -103,13 +93,8 @@ public:
|
||||
|
||||
//- Hash specialization for hashing strings
|
||||
template<>
|
||||
class Hash<Foam::string>
|
||||
struct Hash<Foam::string>
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
unsigned operator()(const string& p, unsigned seed) const
|
||||
{
|
||||
return string::hash()(p, seed);
|
||||
@ -123,13 +108,8 @@ public:
|
||||
|
||||
//- Hash specialization for hashing words
|
||||
template<>
|
||||
class Hash<Foam::word>
|
||||
struct Hash<Foam::word>
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
unsigned operator()(const word& p, unsigned seed) const
|
||||
{
|
||||
return word::hash()(p, seed);
|
||||
@ -143,13 +123,8 @@ public:
|
||||
|
||||
//- Hash specialization for hashing fileNames
|
||||
template<>
|
||||
class Hash<Foam::fileName>
|
||||
struct Hash<Foam::fileName>
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
unsigned operator()(const fileName& p, unsigned seed) const
|
||||
{
|
||||
return fileName::hash()(p, seed);
|
||||
@ -163,13 +138,8 @@ public:
|
||||
|
||||
//- Hash specialization for hashing wordRes
|
||||
template<>
|
||||
class Hash<Foam::wordRe>
|
||||
struct Hash<Foam::wordRe>
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
unsigned operator()(const wordRe& p, unsigned seed) const
|
||||
{
|
||||
return wordRe::hash()(p, seed);
|
||||
@ -183,13 +153,8 @@ public:
|
||||
|
||||
//- Hash specialization for hashing keyTypes
|
||||
template<>
|
||||
class Hash<Foam::keyType>
|
||||
struct Hash<Foam::keyType>
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
unsigned operator()(const keyType& p, unsigned seed) const
|
||||
{
|
||||
return keyType::hash()(p, seed);
|
||||
@ -201,18 +166,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
//- Hash specialization for hashing pointer addresses.
|
||||
// Treat a pointer like a long.
|
||||
// This should work for both 32-bit and 64-bit pointers.
|
||||
template<>
|
||||
class Hash<void*>
|
||||
struct Hash<void*>
|
||||
{
|
||||
public:
|
||||
|
||||
Hash()
|
||||
{}
|
||||
|
||||
unsigned operator()(const void* const& p, unsigned seed) const
|
||||
{
|
||||
return Hash<long>()(long(p), seed);
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,21 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "int32.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::name(const char* fmt, const int32_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::name(const std::string& fmt, const int32_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -62,16 +62,6 @@ inline word name(const int32_t val)
|
||||
}
|
||||
|
||||
|
||||
//- Return a word representation of an int32, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const char* fmt, const int32_t val);
|
||||
|
||||
|
||||
//- Return a word representation of an int32, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const std::string& fmt, const int32_t val);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
//- Read int32_t from stream
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,21 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "int64.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::name(const char* fmt, const int64_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::name(const std::string& fmt, const int64_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -63,16 +63,6 @@ inline word name(const int64_t val)
|
||||
}
|
||||
|
||||
|
||||
//- Return a word representation of an int64, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const char* fmt, const int64_t);
|
||||
|
||||
|
||||
//- Return a word representation of an int64, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const std::string& fmt, const int64_t);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
//- Read int64_t from stream
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -120,6 +120,40 @@ inline label component(const label l, const direction)
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Struct toLabel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Conversion to label structure
|
||||
template<class Type> struct toLabel {};
|
||||
|
||||
//- Convert (likely promote) from int32_t to label
|
||||
template<>
|
||||
struct toLabel<int32_t>
|
||||
{
|
||||
constexpr label operator()(const int32_t& val) const noexcept
|
||||
{
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//- Convert (possibly truncate) from int64_t to label
|
||||
template<>
|
||||
struct toLabel<int64_t>
|
||||
{
|
||||
constexpr label operator()(const int64_t& val) const noexcept
|
||||
{
|
||||
#if WM_LABEL_SIZE == 32
|
||||
return label(val);
|
||||
#elif WM_LABEL_SIZE == 64
|
||||
return val;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
@ -24,21 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "uint32.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::name(const char* fmt, const uint32_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::name(const std::string& fmt, const uint32_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -62,16 +62,6 @@ inline word name(const uint32_t val)
|
||||
}
|
||||
|
||||
|
||||
//- Return a word representation of a uint32, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const char* fmt, const uint32_t);
|
||||
|
||||
|
||||
//- Return a word representation of a uint32, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const std::string& fmt, const uint32_t);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
//- Read uint32_t from stream
|
||||
|
@ -24,21 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "uint64.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::name(const char* fmt, const uint64_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::name(const std::string& fmt, const uint64_t val)
|
||||
{
|
||||
return stringOps::name(fmt, val);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -62,16 +62,6 @@ inline word name(const uint64_t val)
|
||||
}
|
||||
|
||||
|
||||
//- Return a word representation of a uint64_t, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const char* fmt, const uint64_t);
|
||||
|
||||
|
||||
//- Return a word representation of a uint64_t, using printf-style formatter.
|
||||
// The representation is not checked for valid word characters.
|
||||
word name(const std::string& fmt, const uint64_t);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
//- Read uint64_t from stream.
|
||||
|
@ -42,8 +42,7 @@ inline void Foam::hashedWordList::rehash(const bool unique)
|
||||
|
||||
inline Foam::hashedWordList::hashedWordList()
|
||||
:
|
||||
List<word>(),
|
||||
indices_()
|
||||
List<word>()
|
||||
{}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,6 +39,7 @@ See also
|
||||
SourceFiles
|
||||
string.C
|
||||
stringIO.C
|
||||
stringTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -90,6 +91,24 @@ protected:
|
||||
// A wrapped version of find_last_of("./") with additional logic.
|
||||
inline std::string::size_type find_ext() const;
|
||||
|
||||
//- A printf-style formatter for a primitive.
|
||||
template<class PrimitiveType>
|
||||
static std::string::size_type string_printf
|
||||
(
|
||||
std::string& output,
|
||||
const char* fmt,
|
||||
const PrimitiveType& val
|
||||
);
|
||||
|
||||
//- A printf-style formatter for a primitive.
|
||||
template<class PrimitiveType>
|
||||
static std::string::size_type string_printf
|
||||
(
|
||||
std::string& output,
|
||||
const std::string& fmt,
|
||||
const PrimitiveType& val
|
||||
);
|
||||
|
||||
//- Return file name extension (part after last .)
|
||||
word ext() const;
|
||||
|
||||
@ -124,16 +143,14 @@ public:
|
||||
static const string null;
|
||||
|
||||
|
||||
//- Hashing function class, shared by all the derived classes
|
||||
class hash
|
||||
//- Hashing function for string and derived string classes
|
||||
struct hash
|
||||
{
|
||||
public:
|
||||
hash()
|
||||
{}
|
||||
|
||||
//- Hash for string.
|
||||
// Uses Foam::string instead of std::string for automatic conversions.
|
||||
inline unsigned operator()(const string& str, unsigned seed = 0) const;
|
||||
inline unsigned operator()
|
||||
(
|
||||
const std::string& str,
|
||||
unsigned seed = 0
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -152,9 +169,9 @@ public:
|
||||
inline string(const char* str, const size_type len);
|
||||
|
||||
//- Construct from a single character
|
||||
inline string(const char c);
|
||||
inline explicit string(const char c);
|
||||
|
||||
//- Construct from copies of a single character
|
||||
//- Construct fill copies of a single character
|
||||
inline string(const size_type len, const char c);
|
||||
|
||||
//- Move construct from std::string
|
||||
@ -292,6 +309,10 @@ public:
|
||||
|
||||
#include "stringI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "stringTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
@ -23,7 +23,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
inline std::string::size_type Foam::string::find_ext(const std::string& str)
|
||||
@ -68,6 +67,8 @@ inline bool Foam::string::removeExt()
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::string::string()
|
||||
:
|
||||
std::string()
|
||||
{}
|
||||
|
||||
|
||||
@ -253,7 +254,7 @@ inline bool Foam::string::operator()(const std::string& text) const
|
||||
|
||||
inline unsigned Foam::string::hash::operator()
|
||||
(
|
||||
const string& str,
|
||||
const std::string& str,
|
||||
unsigned seed
|
||||
) const
|
||||
{
|
||||
|
72
src/OpenFOAM/primitives/strings/string/stringTemplates.C
Normal file
72
src/OpenFOAM/primitives/strings/string/stringTemplates.C
Normal file
@ -0,0 +1,72 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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 <cstdio>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Could also consider generalizing with C++11 variadic templates
|
||||
|
||||
template<class PrimitiveType>
|
||||
std::string::size_type Foam::string::string_printf
|
||||
(
|
||||
std::string& output,
|
||||
const char* fmt,
|
||||
const PrimitiveType& val
|
||||
)
|
||||
{
|
||||
// Use snprintf with zero to establish the size (without '\0') required
|
||||
int n = ::snprintf(nullptr, 0, fmt, val);
|
||||
if (n > 0)
|
||||
{
|
||||
output.resize(n+1);
|
||||
char* buf = &(output[0]);
|
||||
|
||||
// Print directly into buffer, no stripping desired
|
||||
n = ::snprintf(buf, n+1, fmt, val);
|
||||
output.resize(n);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.clear();
|
||||
}
|
||||
|
||||
return output.size();
|
||||
}
|
||||
|
||||
|
||||
template<class PrimitiveType>
|
||||
std::string::size_type Foam::string::string_printf
|
||||
(
|
||||
std::string& output,
|
||||
const std::string& fmt,
|
||||
const PrimitiveType& val
|
||||
)
|
||||
{
|
||||
return string_printf(output, fmt.c_str(), val);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -457,7 +457,7 @@ Foam::string Foam::stringOps::expand
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(string(s[index]));
|
||||
out.append(1, s[index]); // append char
|
||||
}
|
||||
++index;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -321,19 +321,6 @@ namespace stringOps
|
||||
void inplaceUpper(std::string& s);
|
||||
|
||||
|
||||
//- Using printf-formatter for a word representation of the primitive.
|
||||
// The representation is not checked for valid word characters -
|
||||
// it is assumed that the caller knows what they are doing
|
||||
template<class PrimitiveType>
|
||||
Foam::word name(const char* fmt, const PrimitiveType& val);
|
||||
|
||||
//- Using printf-formatter for a word representation of the primitive.
|
||||
// The representation is not checked for valid word characters -
|
||||
// it is assumed that the caller knows what they are doing
|
||||
template<class PrimitiveType>
|
||||
Foam::word name(const std::string& fmt, const PrimitiveType& val);
|
||||
|
||||
|
||||
//- Split string into sub-strings at the delimiter character.
|
||||
// Empty sub-strings are normally suppressed.
|
||||
// Behaviour is ill-defined if delim is a NUL character.
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,49 +23,8 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// NOTE: with C++11 could consider variadic templates for a more general
|
||||
// sprintf implementation
|
||||
|
||||
template<class PrimitiveType>
|
||||
Foam::word Foam::stringOps::name
|
||||
(
|
||||
const char* fmt,
|
||||
const PrimitiveType& val
|
||||
)
|
||||
{
|
||||
word output;
|
||||
|
||||
// snprintf with zero to find size (without '\0') required
|
||||
int n = ::snprintf(nullptr, 0, fmt, val);
|
||||
if (n > 0)
|
||||
{
|
||||
output.resize(n+1);
|
||||
char* buf = &(output[0]);
|
||||
|
||||
// Print directly into buffer, no stripping desired
|
||||
n = ::snprintf(buf, n+1, fmt, val);
|
||||
output.resize(n);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
template<class PrimitiveType>
|
||||
Foam::word Foam::stringOps::name
|
||||
(
|
||||
const std::string& fmt,
|
||||
const PrimitiveType& val
|
||||
)
|
||||
{
|
||||
return stringOps::name(fmt.c_str(), val);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
Foam::SubStrings<StringType> Foam::stringOps::split
|
||||
(
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -117,7 +117,28 @@ public:
|
||||
word(Istream& is);
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Use a printf-style formatter for a primitive.
|
||||
// The representation is not checked for valid characters -
|
||||
// it is assumed that the caller knows what they are doing
|
||||
template<class PrimitiveType>
|
||||
inline static word printf
|
||||
(
|
||||
const char* fmt,
|
||||
const PrimitiveType& val
|
||||
);
|
||||
|
||||
//- Use a printf-style formatter for a primitive.
|
||||
// The representation is not checked for valid characters -
|
||||
// it is assumed that the caller knows what they are doing
|
||||
template<class PrimitiveType>
|
||||
inline static word printf
|
||||
(
|
||||
const std::string& fmt,
|
||||
const PrimitiveType& val
|
||||
);
|
||||
|
||||
|
||||
//- Is this character valid for a word?
|
||||
inline static bool valid(char c);
|
||||
@ -128,7 +149,7 @@ public:
|
||||
static word validate(const std::string& s, const bool prefix=false);
|
||||
|
||||
|
||||
// File-like functions
|
||||
// File-like Functions
|
||||
|
||||
//- Return word without extension (part before last .)
|
||||
word lessExt() const;
|
||||
@ -156,7 +177,7 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
// Assignment
|
||||
// Assignment
|
||||
|
||||
//- Copy assignment, no character validation required
|
||||
inline void operator=(const word& w);
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,6 +26,34 @@ License
|
||||
#include <cctype>
|
||||
#include <iostream> // for std::cerr
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class PrimitiveType>
|
||||
inline Foam::word Foam::word::printf
|
||||
(
|
||||
const char* fmt,
|
||||
const PrimitiveType& val
|
||||
)
|
||||
{
|
||||
word output;
|
||||
string_printf(output, fmt, val);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
template<class PrimitiveType>
|
||||
inline Foam::word Foam::word::printf
|
||||
(
|
||||
const std::string& fmt,
|
||||
const PrimitiveType& val
|
||||
)
|
||||
{
|
||||
word output;
|
||||
string_printf(output, fmt, val);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
inline void Foam::word::stripInvalid()
|
||||
|
@ -60,7 +60,7 @@ diffusionMulticomponent<CombThermoType, ThermoType>::init()
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Rijk" + name(k),
|
||||
"Rijk" + Foam::name(k),
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
@ -160,14 +160,6 @@ diffusionMulticomponent
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CombThermoType, class ThermoType>
|
||||
Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>::
|
||||
~diffusionMulticomponent()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CombThermoType, class ThermoType>
|
||||
@ -200,7 +192,7 @@ diffusionMulticomponent<CombThermoType, ThermoType>::correct()
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Rijl" + word(k),
|
||||
"Rijl" + Foam::name(k),
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
@ -258,7 +250,7 @@ diffusionMulticomponent<CombThermoType, ThermoType>::correct()
|
||||
|
||||
const volScalarField ft
|
||||
(
|
||||
"ft" + name(k),
|
||||
"ft" + Foam::name(k),
|
||||
(
|
||||
s_[k]*Yfuel - (Yox - YoxStream_[k])
|
||||
)
|
||||
@ -279,7 +271,7 @@ diffusionMulticomponent<CombThermoType, ThermoType>::correct()
|
||||
|
||||
const volScalarField preExp
|
||||
(
|
||||
"preExp" + name(k),
|
||||
"preExp" + Foam::name(k),
|
||||
1.0 + sqr(OAvailScaled)
|
||||
);
|
||||
|
||||
@ -291,7 +283,7 @@ diffusionMulticomponent<CombThermoType, ThermoType>::correct()
|
||||
|
||||
const volScalarField topHatFilter(pos(filter - 1e-3));
|
||||
|
||||
const volScalarField prob("prob" + name(k), preExp*filter);
|
||||
const volScalarField prob("prob" + Foam::name(k), preExp*filter);
|
||||
|
||||
const volScalarField RijkDiff
|
||||
(
|
||||
@ -438,10 +430,8 @@ diffusionMulticomponent<CombThermoType, ThermoType>::read()
|
||||
this->coeffs().readIfPresent("laminarIgn", laminarIgn_);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -177,7 +177,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~diffusionMulticomponent();
|
||||
virtual ~diffusionMulticomponent() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "FIREMeshWriter.H"
|
||||
#include "Time.H"
|
||||
#include "HashTable.H"
|
||||
#include "Map.H"
|
||||
#include "OFstream.H"
|
||||
#include "processorPolyPatch.H"
|
||||
|
||||
@ -117,8 +117,8 @@ bool Foam::fileFormats::FIREMeshWriter::writeSelections(OSstream& os) const
|
||||
|
||||
// remap name between patches and cell-zones conflicts!
|
||||
|
||||
HashTable<word, label> patchNames;
|
||||
HashTable<word, label> zoneNames;
|
||||
Map<word> patchNames;
|
||||
Map<word> zoneNames;
|
||||
|
||||
wordHashSet usedPatchNames;
|
||||
wordHashSet usedZoneNames;
|
||||
@ -245,12 +245,6 @@ Foam::fileFormats::FIREMeshWriter::FIREMeshWriter
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileFormats::FIREMeshWriter::~FIREMeshWriter()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fileFormats::FIREMeshWriter::write(const fileName& meshName) const
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~FIREMeshWriter();
|
||||
virtual ~FIREMeshWriter() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -59,12 +59,6 @@ Foam::vtk::vtuSizing::vtuSizing()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vtk::vtuSizing::~vtuSizing()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::vtk::vtuSizing::reset
|
||||
@ -83,7 +77,7 @@ void Foam::vtk::vtuSizing::reset
|
||||
const cellShapeList& shapes = mesh.cellShapes();
|
||||
|
||||
// Unique vertex labels per polyhedral
|
||||
HashSet<label> hashUniqId(2*256);
|
||||
labelHashSet hashUniqId(2*256);
|
||||
|
||||
decompose_ = decompose;
|
||||
nCells_ = mesh.nCells();
|
||||
|
@ -203,7 +203,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~vtuSizing();
|
||||
~vtuSizing() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -224,7 +224,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
||||
const labelList& owner = mesh.faceOwner();
|
||||
|
||||
// Unique vertex labels per polyhedral
|
||||
HashSet<label> hashUniqId(2*256);
|
||||
labelHashSet hashUniqId(2*256);
|
||||
|
||||
// Index into vertLabels, faceLabels for normal cells
|
||||
label nVertLabels = 0;
|
||||
|
@ -535,7 +535,7 @@ void Foam::ensightCase::write() const
|
||||
{
|
||||
// moving
|
||||
*os_
|
||||
<< Foam::name("model: %-9d", tsGeom) // width 16
|
||||
<< word::printf("model: %-9d", tsGeom) // width 16 (no quotes)
|
||||
<< (dataMask/geometryName).c_str()
|
||||
<< nl;
|
||||
}
|
||||
@ -554,7 +554,7 @@ void Foam::ensightCase::write() const
|
||||
);
|
||||
|
||||
*os_
|
||||
<< Foam::name("measured: %-6d", tsCloud) // width 16
|
||||
<< word::printf("measured: %-6d", tsCloud) // width 16 (no quotes)
|
||||
<< (masked/"positions").c_str()
|
||||
<< nl;
|
||||
}
|
||||
@ -617,7 +617,7 @@ void Foam::ensightCase::write() const
|
||||
// prefix variables with 'c' (cloud) and cloud index
|
||||
*os_
|
||||
<< ensType.c_str() << " per "
|
||||
<< Foam::name("measured node: %-5d", tsCloud) // width 20
|
||||
<< word::printf("measured node: %-5d", tsCloud) // width 20
|
||||
<< setw(15)
|
||||
<< ("c" + Foam::name(cloudNo) + varName).c_str() << ' '
|
||||
<< (masked/varName).c_str()
|
||||
|
@ -48,6 +48,7 @@ Foam::IOstream::streamFormat Foam::ensightCase::options::format() const
|
||||
return format_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::word& Foam::ensightCase::options::mask() const
|
||||
{
|
||||
return mask_;
|
||||
@ -56,7 +57,7 @@ const Foam::word& Foam::ensightCase::options::mask() const
|
||||
|
||||
Foam::word Foam::ensightCase::options::padded(const label i) const
|
||||
{
|
||||
// As per Foam::name, but with fixed length
|
||||
// As per word::printf(), but with fixed length
|
||||
char buf[32];
|
||||
|
||||
::snprintf(buf, 32, printf_.c_str(), static_cast<int>(i));
|
||||
@ -85,7 +86,7 @@ void Foam::ensightCase::options::width(const label n)
|
||||
mask_.resize(n, '*');
|
||||
|
||||
// appropriate printf format
|
||||
printf_ = "%0" + Foam::name(n) + "d";
|
||||
printf_ = "%0" + std::to_string(n) + "d";
|
||||
}
|
||||
|
||||
|
||||
|
@ -1100,9 +1100,9 @@ void Foam::isoAdvection::writeIsoFaces
|
||||
mesh_.time().path()/".."/"isoFaces"
|
||||
: mesh_.time().path()/"isoFaces"
|
||||
);
|
||||
const string fName
|
||||
const word fName
|
||||
(
|
||||
"isoFaces_" + Foam::name("%012d", mesh_.time().timeIndex())
|
||||
word::printf("isoFaces_%012d", mesh_.time().timeIndex())
|
||||
);
|
||||
|
||||
if (Pstream::parRun())
|
||||
|
@ -146,7 +146,7 @@ bool Foam::functionObjects::particleDistribution::write()
|
||||
// Tag field present - generate distribution per tag
|
||||
const IOField<label>& tag =
|
||||
cloudObr.lookupObject<IOField<label>>(tagFieldName_);
|
||||
const HashSet<label> tagMap(tag);
|
||||
const labelHashSet tagMap(tag);
|
||||
const label tagMax = tagMap.size();
|
||||
|
||||
List<DynamicList<label>> tagAddr(tagMax);
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Source CMake functions
|
||||
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions # The CMake functions
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@ -23,7 +21,7 @@ if [ -n "$depend" ]
|
||||
then
|
||||
if [ "$targetType" != objects ]
|
||||
then
|
||||
if type cmake > /dev/null 2>&1
|
||||
if command -v cmake > /dev/null 2>&1
|
||||
then
|
||||
cmakeVersioned "$depend" $PWD || {
|
||||
echo
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,6 +46,36 @@ namespace functionObjects
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::functionObjects::systemCall::dispatch(const stringList& calls)
|
||||
{
|
||||
if (calls.empty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
label nCalls = 0;
|
||||
|
||||
if (!masterOnly_ || Pstream::master())
|
||||
{
|
||||
for (const string& call : calls)
|
||||
{
|
||||
Foam::system(call); // Handles empty command as a successful no-op.
|
||||
++nCalls;
|
||||
}
|
||||
}
|
||||
|
||||
// MPI barrier
|
||||
if (masterOnly_)
|
||||
{
|
||||
Pstream::scatter(nCalls);
|
||||
}
|
||||
|
||||
return nCalls;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::systemCall::systemCall
|
||||
@ -58,27 +88,27 @@ Foam::functionObjects::systemCall::systemCall
|
||||
functionObject(name),
|
||||
executeCalls_(),
|
||||
endCalls_(),
|
||||
writeCalls_()
|
||||
writeCalls_(),
|
||||
masterOnly_(false)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::systemCall::~systemCall()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::systemCall::read(const dictionary& dict)
|
||||
{
|
||||
functionObject::read(dict);
|
||||
|
||||
executeCalls_.clear();
|
||||
writeCalls_.clear();
|
||||
endCalls_.clear();
|
||||
|
||||
dict.readIfPresent("executeCalls", executeCalls_);
|
||||
dict.readIfPresent("endCalls", endCalls_);
|
||||
dict.readIfPresent("writeCalls", writeCalls_);
|
||||
dict.readIfPresent("endCalls", endCalls_);
|
||||
masterOnly_ = dict.lookupOrDefault("master", false);
|
||||
|
||||
if (executeCalls_.empty() && endCalls_.empty() && writeCalls_.empty())
|
||||
{
|
||||
@ -89,8 +119,8 @@ bool Foam::functionObjects::systemCall::read(const dictionary& dict)
|
||||
else if (!dynamicCode::allowSystemOperations)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Executing user-supplied system calls is not enabled by "
|
||||
<< "default because of " << nl
|
||||
<< "Executing user-supplied system calls may not be enabled by "
|
||||
<< "default due to potential " << nl
|
||||
<< "security issues. If you trust the case you can enable this "
|
||||
<< "facility by " << nl
|
||||
<< "adding to the InfoSwitches setting in the system controlDict:"
|
||||
@ -109,33 +139,21 @@ bool Foam::functionObjects::systemCall::read(const dictionary& dict)
|
||||
|
||||
bool Foam::functionObjects::systemCall::execute()
|
||||
{
|
||||
forAll(executeCalls_, calli)
|
||||
{
|
||||
Foam::system(executeCalls_[calli]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::systemCall::end()
|
||||
{
|
||||
forAll(endCalls_, calli)
|
||||
{
|
||||
Foam::system(endCalls_[calli]);
|
||||
}
|
||||
|
||||
dispatch(executeCalls_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::systemCall::write()
|
||||
{
|
||||
forAll(writeCalls_, calli)
|
||||
{
|
||||
Foam::system(writeCalls_[calli]);
|
||||
}
|
||||
dispatch(writeCalls_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::systemCall::end()
|
||||
{
|
||||
dispatch(endCalls_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
Executes system calls, entered in the form of a string lists.
|
||||
Executes system calls, entered in the form of string lists.
|
||||
|
||||
Calls can be made at the following points in the calculation:
|
||||
- every time step
|
||||
@ -36,7 +36,7 @@ Description
|
||||
- end of the calculation
|
||||
|
||||
Usage
|
||||
Example of function object specification:
|
||||
Example of the function object specification:
|
||||
\verbatim
|
||||
systemCall1
|
||||
{
|
||||
@ -49,11 +49,11 @@ Usage
|
||||
);
|
||||
writeCalls
|
||||
(
|
||||
"echo \*\*\* writing data \*\*\*"
|
||||
"echo === writing data ==="
|
||||
);
|
||||
endCalls
|
||||
(
|
||||
"echo \*\*\* writing .bashrc \*\*\*"
|
||||
"echo === echoing .bashrc ==="
|
||||
"cat ~/.bashrc"
|
||||
"echo \*\*\* done \*\*\*"
|
||||
);
|
||||
@ -67,6 +67,7 @@ Usage
|
||||
executeCalls | list of calls on execute | yes |
|
||||
writeCalls | list of calls on write | yes |
|
||||
endCalls | list of calls on end | yes |
|
||||
master | execute on master only | no | false
|
||||
\endtable
|
||||
|
||||
Note
|
||||
@ -75,6 +76,9 @@ Note
|
||||
\c allowSystemOperations must be set to '1'; otherwise, system calls will
|
||||
not be allowed.
|
||||
|
||||
Additionally, since the system commands are normally sent via the shell,
|
||||
special shell character may require backslash escaping.
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::timeControl
|
||||
@ -118,16 +122,20 @@ protected:
|
||||
//- List of calls to execute - write steps
|
||||
stringList writeCalls_;
|
||||
|
||||
//- Perform system calls on the master only
|
||||
bool masterOnly_;
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- Dispatch specified calls
|
||||
label dispatch(const stringList& calls);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
systemCall(const systemCall&);
|
||||
systemCall(const systemCall&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const systemCall&);
|
||||
void operator=(const systemCall&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -148,22 +156,22 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~systemCall();
|
||||
virtual ~systemCall() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the system calls
|
||||
virtual bool read(const dictionary&);
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Execute the "executeCalls" at each time-step
|
||||
virtual bool execute();
|
||||
|
||||
//- Execute the "endCalls" at the final time-loop
|
||||
virtual bool end();
|
||||
|
||||
//- Write, execute the "writeCalls"
|
||||
virtual bool write();
|
||||
|
||||
//- Execute the "endCalls" at the final time-loop
|
||||
virtual bool end();
|
||||
};
|
||||
|
||||
|
||||
|
@ -451,8 +451,8 @@ void Foam::triSurfaceTools::getMergedEdges
|
||||
const triSurface& surf,
|
||||
const label edgeI,
|
||||
const labelHashSet& collapsedFaces,
|
||||
HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
HashTable<label, label, Hash<label>>& edgeToFace
|
||||
Map<label>& edgeToEdge,
|
||||
Map<label>& edgeToFace
|
||||
)
|
||||
{
|
||||
const edge& e = surf.edges()[edgeI];
|
||||
@ -534,8 +534,8 @@ Foam::scalar Foam::triSurfaceTools::edgeCosAngle
|
||||
const label v1,
|
||||
const point& pt,
|
||||
const labelHashSet& collapsedFaces,
|
||||
const HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
const HashTable<label, label, Hash<label>>& edgeToFace,
|
||||
const Map<label>& edgeToEdge,
|
||||
const Map<label>& edgeToFace,
|
||||
const label facei,
|
||||
const label edgeI
|
||||
)
|
||||
@ -630,8 +630,8 @@ Foam::scalar Foam::triSurfaceTools::collapseMinCosAngle
|
||||
const label v1,
|
||||
const point& pt,
|
||||
const labelHashSet& collapsedFaces,
|
||||
const HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
const HashTable<label, label, Hash<label>>& edgeToFace
|
||||
const Map<label>& edgeToEdge,
|
||||
const Map<label>& edgeToFace
|
||||
)
|
||||
{
|
||||
const labelList& v1Faces = surf.pointFaces()[v1];
|
||||
@ -684,8 +684,8 @@ bool Foam::triSurfaceTools::collapseCreatesFold
|
||||
const label v1,
|
||||
const point& pt,
|
||||
const labelHashSet& collapsedFaces,
|
||||
const HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
const HashTable<label, label, Hash<label>>& edgeToFace,
|
||||
const Map<label>& edgeToEdge,
|
||||
const Map<label>& edgeToFace,
|
||||
const scalar minCos
|
||||
)
|
||||
{
|
||||
@ -749,7 +749,7 @@ bool Foam::triSurfaceTools::collapseCreatesFold
|
||||
// // neighbours actually contains the
|
||||
// // edge with which triangle connects to collapsedFaces.
|
||||
//
|
||||
// HashTable<label, label, Hash<label>> neighbours;
|
||||
// Map<label> neighbours;
|
||||
//
|
||||
// labelList collapsed = collapsedFaces.toc();
|
||||
//
|
||||
|
@ -54,6 +54,7 @@ SourceFiles
|
||||
#include "triadFieldFwd.H"
|
||||
#include "DynamicList.H"
|
||||
#include "HashSet.H"
|
||||
#include "Map.H"
|
||||
#include "FixedList.H"
|
||||
#include "Pair.H"
|
||||
#include "vector2D.H"
|
||||
@ -159,8 +160,8 @@ class triSurfaceTools
|
||||
const triSurface& surf,
|
||||
const label edgeI,
|
||||
const labelHashSet& collapsedFaces,
|
||||
HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
HashTable<label, label, Hash<label>>& edgeToFace
|
||||
Map<label>& edgeToEdge,
|
||||
Map<label>& edgeToFace
|
||||
);
|
||||
|
||||
//- Calculates (cos of) angle across edgeI of facei,
|
||||
@ -172,8 +173,8 @@ class triSurfaceTools
|
||||
const label v1,
|
||||
const point& pt,
|
||||
const labelHashSet& collapsedFaces,
|
||||
const HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
const HashTable<label, label, Hash<label>>& edgeToFace,
|
||||
const Map<label>& edgeToEdge,
|
||||
const Map<label>& edgeToFace,
|
||||
const label facei,
|
||||
const label edgeI
|
||||
);
|
||||
@ -188,8 +189,8 @@ class triSurfaceTools
|
||||
const label v1,
|
||||
const point& pt,
|
||||
const labelHashSet& collapsedFaces,
|
||||
const HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
const HashTable<label, label, Hash<label>>& edgeToFace
|
||||
const Map<label>& edgeToEdge,
|
||||
const Map<label>& edgeToFace
|
||||
);
|
||||
|
||||
//- Like collapseMinCosAngle but return true for value < minCos
|
||||
@ -199,8 +200,8 @@ class triSurfaceTools
|
||||
const label v1,
|
||||
const point& pt,
|
||||
const labelHashSet& collapsedFaces,
|
||||
const HashTable<label, label, Hash<label>>& edgeToEdge,
|
||||
const HashTable<label, label, Hash<label>>& edgeToFace,
|
||||
const Map<label>& edgeToEdge,
|
||||
const Map<label>& edgeToFace,
|
||||
const scalar minCos
|
||||
);
|
||||
|
||||
@ -210,7 +211,7 @@ class triSurfaceTools
|
||||
//(
|
||||
// const triSurface& surf,
|
||||
// const label edgeI,
|
||||
// const HashTable<bool, label, Hash<label>>& collapsedFaces
|
||||
// const Map<bool>& collapsedFaces
|
||||
//);
|
||||
|
||||
// Tracking
|
||||
|
@ -312,7 +312,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
|
||||
patchi,
|
||||
(
|
||||
patches[patchi].name().empty()
|
||||
? Foam::name("patch%d", patchi)
|
||||
? word::printf("patch%d", patchi)
|
||||
: patches[patchi].name()
|
||||
)
|
||||
);
|
||||
@ -345,7 +345,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
|
||||
zoneNames.set
|
||||
(
|
||||
regionid,
|
||||
Foam::name("patch%d", regionid)
|
||||
word::printf("patch%d", regionid)
|
||||
);
|
||||
}
|
||||
|
||||
@ -393,7 +393,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
|
||||
}
|
||||
if (name.empty())
|
||||
{
|
||||
name = ::Foam::name("patch%d", regionid);
|
||||
name = word::printf("patch%d", regionid);
|
||||
}
|
||||
|
||||
zoneLst[zoneI] = surfZone
|
||||
|
@ -306,7 +306,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
|
||||
patchi,
|
||||
(
|
||||
patches[patchi].name().empty()
|
||||
? Foam::name("patch%d", patchi)
|
||||
? word::printf("patch%d", patchi)
|
||||
: patches[patchi].name()
|
||||
)
|
||||
);
|
||||
@ -339,7 +339,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
|
||||
zoneNames.set
|
||||
(
|
||||
regionid,
|
||||
Foam::name("patch%d", regionid)
|
||||
word::printf("patch%d", regionid)
|
||||
);
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
|
||||
}
|
||||
if (name.empty())
|
||||
{
|
||||
name = ::Foam::name("patch%d", regionid);
|
||||
name = word::printf("patch%d", regionid);
|
||||
}
|
||||
|
||||
zoneLst[zoneI] = surfZone
|
||||
|
@ -220,7 +220,7 @@ private:
|
||||
}
|
||||
else if (elementName[0] == 'E')
|
||||
{
|
||||
elementName = 'e';
|
||||
elementName = "e";
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,8 +314,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~chemkinReader()
|
||||
{}
|
||||
virtual ~chemkinReader() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
52
tutorials/IO/systemCall/0.orig/U
Normal file
52
tutorials/IO/systemCall/0.orig/U
Normal file
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
location "0";
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform $flowVelocity;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
#include "include/fixedInlet"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue uniform (0 0 0);
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type noSlip;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
15
tutorials/IO/systemCall/0.orig/include/fixedInlet
Normal file
15
tutorials/IO/systemCall/0.orig/include/fixedInlet
Normal file
@ -0,0 +1,15 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
19
tutorials/IO/systemCall/0.orig/include/frontBackUpperPatches
Normal file
19
tutorials/IO/systemCall/0.orig/include/frontBackUpperPatches
Normal file
@ -0,0 +1,19 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
upperWall
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
14
tutorials/IO/systemCall/0.orig/include/initialConditions
Normal file
14
tutorials/IO/systemCall/0.orig/include/initialConditions
Normal file
@ -0,0 +1,14 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
flowVelocity (20 0 0);
|
||||
pressure 0;
|
||||
turbulentKE 0.24;
|
||||
turbulentOmega 1.78;
|
||||
|
||||
// ************************************************************************* //
|
53
tutorials/IO/systemCall/0.orig/k
Normal file
53
tutorials/IO/systemCall/0.orig/k
Normal file
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object k;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 2 -2 0 0 0 0];
|
||||
|
||||
internalField uniform $turbulentKE;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
//- Define inlet conditions
|
||||
#include "include/fixedInlet"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
64
tutorials/IO/systemCall/0.orig/nut
Normal file
64
tutorials/IO/systemCall/0.orig/nut
Normal file
@ -0,0 +1,64 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object nut;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -1 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
inlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type nutkWallFunction;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
upperWall
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type nutkWallFunction;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
52
tutorials/IO/systemCall/0.orig/omega
Normal file
52
tutorials/IO/systemCall/0.orig/omega
Normal file
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object omega;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 0 -1 0 0 0 0];
|
||||
|
||||
internalField uniform $turbulentOmega;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
#include "include/fixedInlet"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type omegaWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type omegaWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
51
tutorials/IO/systemCall/0.orig/p
Normal file
51
tutorials/IO/systemCall/0.orig/p
Normal file
@ -0,0 +1,51 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 2 -2 0 0 0 0];
|
||||
|
||||
internalField uniform $pressure;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
inlet
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
13
tutorials/IO/systemCall/Allrun
Executable file
13
tutorials/IO/systemCall/Allrun
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication decomposePar
|
||||
|
||||
#- For parallel running: set the initial fields
|
||||
restore0Dir -processor
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
#------------------------------------------------------------------------------
|
21
tutorials/IO/systemCall/constant/transportProperties
Normal file
21
tutorials/IO/systemCall/constant/transportProperties
Normal file
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
transportModel Newtonian;
|
||||
|
||||
nu 1.5e-05;
|
||||
|
||||
// ************************************************************************* //
|
28
tutorials/IO/systemCall/constant/turbulenceProperties
Normal file
28
tutorials/IO/systemCall/constant/turbulenceProperties
Normal file
@ -0,0 +1,28 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel kOmegaSST;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
86
tutorials/IO/systemCall/system/blockMeshDict
Normal file
86
tutorials/IO/systemCall/system/blockMeshDict
Normal file
@ -0,0 +1,86 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(-5 -4 0)
|
||||
(15 -4 0)
|
||||
(15 4 0)
|
||||
(-5 4 0)
|
||||
(-5 -4 8)
|
||||
(15 -4 8)
|
||||
(15 4 8)
|
||||
(-5 4 8)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (20 8 8) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
frontAndBack
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
(1 5 4 0)
|
||||
);
|
||||
}
|
||||
inlet
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(0 4 7 3)
|
||||
);
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(2 6 5 1)
|
||||
);
|
||||
}
|
||||
lowerWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(0 3 2 1)
|
||||
);
|
||||
}
|
||||
upperWall
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
53
tutorials/IO/systemCall/system/controlDict
Normal file
53
tutorials/IO/systemCall/system/controlDict
Normal file
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application simpleFoam;
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 4;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 100;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
functions
|
||||
{
|
||||
#include "systemCall"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
26
tutorials/IO/systemCall/system/decomposeParDict
Normal file
26
tutorials/IO/systemCall/system/decomposeParDict
Normal file
@ -0,0 +1,26 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 6;
|
||||
|
||||
method hierarchical;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (3 2 1);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
58
tutorials/IO/systemCall/system/fvSchemes
Normal file
58
tutorials/IO/systemCall/system/fvSchemes
Normal file
@ -0,0 +1,58 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(U) cellLimited Gauss linear 1;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) bounded Gauss linearUpwindV grad(U);
|
||||
div(phi,k) bounded Gauss upwind;
|
||||
div(phi,omega) bounded Gauss upwind;
|
||||
div((nuEff*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
wallDist
|
||||
{
|
||||
method meshWave;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
86
tutorials/IO/systemCall/system/fvSolution
Normal file
86
tutorials/IO/systemCall/system/fvSolution
Normal file
@ -0,0 +1,86 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p
|
||||
{
|
||||
solver GAMG;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-7;
|
||||
relTol 0.01;
|
||||
}
|
||||
|
||||
Phi
|
||||
{
|
||||
$p;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
k
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
omega
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
}
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
consistent yes;
|
||||
}
|
||||
|
||||
potentialFlow
|
||||
{
|
||||
nNonOrthogonalCorrectors 10;
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
equations
|
||||
{
|
||||
U 0.9;
|
||||
k 0.7;
|
||||
omega 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
cache
|
||||
{
|
||||
grad(U);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
29
tutorials/IO/systemCall/system/systemCall
Normal file
29
tutorials/IO/systemCall/system/systemCall
Normal file
@ -0,0 +1,29 @@
|
||||
// -*- C++ -*-
|
||||
// An example of using systemCall
|
||||
system
|
||||
{
|
||||
type systemCall;
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
|
||||
// Execute on the master process only
|
||||
master true;
|
||||
|
||||
executeCalls
|
||||
(
|
||||
"echo execute: shell $$"
|
||||
);
|
||||
|
||||
writeCalls
|
||||
(
|
||||
"echo \*\*\* writing data \*\*\*"
|
||||
);
|
||||
|
||||
endCalls
|
||||
(
|
||||
"echo \*\*\* end of run \*\*\*"
|
||||
"grep application system/controlDict"
|
||||
"echo \*\*\* done \*\*\*"
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -100,11 +100,9 @@ cmakeVersioned()
|
||||
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||
|
||||
mkdir -p $objectsDir && \
|
||||
(
|
||||
cd $objectsDir && _cmake $sourceDir && make \
|
||||
&& echo "$depend" > ${sentinel:-/dev/null}
|
||||
)
|
||||
mkdir -p $objectsDir \
|
||||
&& (cd $objectsDir && _cmake $sourceDir && make) \
|
||||
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user