mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: for-range, forAllIters() ... in OpenFOAM/
- reduced clutter when iterating over containers
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -32,12 +32,7 @@ License
|
|||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
void Foam::DictionaryBase<IDLListType, T>::addEntries()
|
void Foam::DictionaryBase<IDLListType, T>::addEntries()
|
||||||
{
|
{
|
||||||
for
|
for (auto iter = this->begin(); iter != this->end(); ++iter)
|
||||||
(
|
|
||||||
typename IDLListType::iterator iter = this->begin();
|
|
||||||
iter != this->end();
|
|
||||||
++iter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
this->hashedTs_.insert((*iter).keyword(), &(*iter));
|
this->hashedTs_.insert((*iter).keyword(), &(*iter));
|
||||||
}
|
}
|
||||||
@ -103,41 +98,37 @@ const T* Foam::DictionaryBase<IDLListType, T>::lookupPtr
|
|||||||
const word& keyword
|
const word& keyword
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
|
const auto iter = hashedTs_.cfind(keyword);
|
||||||
|
|
||||||
if (iter != hashedTs_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return nullptr;
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
T* Foam::DictionaryBase<IDLListType, T>::lookupPtr(const word& keyword)
|
T* Foam::DictionaryBase<IDLListType, T>::lookupPtr(const word& keyword)
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
auto iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
if (iter != hashedTs_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return nullptr;
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
|
const auto iter = hashedTs_.cfind(keyword);
|
||||||
|
|
||||||
if (iter == hashedTs_.end())
|
if (!iter.found())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "'" << keyword << "' not found"
|
<< "'" << keyword << "' not found"
|
||||||
@ -151,9 +142,9 @@ const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
|||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
auto iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
if (iter == hashedTs_.end())
|
if (!iter.found())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "'" << keyword << "' not found"
|
<< "'" << keyword << "' not found"
|
||||||
@ -170,12 +161,7 @@ Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
|
|||||||
wordList keywords(this->size());
|
wordList keywords(this->size());
|
||||||
|
|
||||||
label i = 0;
|
label i = 0;
|
||||||
for
|
for (auto iter = this->cbegin(); iter != this->cend(); ++iter)
|
||||||
(
|
|
||||||
typename IDLListType::const_iterator iter = this->begin();
|
|
||||||
iter != this->end();
|
|
||||||
++iter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
keywords[i++] = iter().keyword();
|
keywords[i++] = iter().keyword();
|
||||||
}
|
}
|
||||||
@ -223,18 +209,16 @@ void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
|||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
T* Foam::DictionaryBase<IDLListType, T>::remove(const word& keyword)
|
T* Foam::DictionaryBase<IDLListType, T>::remove(const word& keyword)
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
auto iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
if (iter != hashedTs_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
T* tPtr = IDLListType::remove(iter());
|
T* ptr = IDLListType::remove(iter());
|
||||||
hashedTs_.erase(iter);
|
hashedTs_.erase(iter);
|
||||||
return tPtr;
|
return ptr;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -265,7 +249,6 @@ void Foam::DictionaryBase<IDLListType, T>::operator=
|
|||||||
const DictionaryBase<IDLListType, T>& dict
|
const DictionaryBase<IDLListType, T>& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Check for assignment to self
|
|
||||||
if (this == &dict)
|
if (this == &dict)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011 OpenFOAM Foundation
|
| Copyright (C) 2011 OpenFOAM Foundation
|
||||||
@ -42,7 +42,7 @@ Foam::CallbackRegistry<CallbackType>::CallbackRegistry()
|
|||||||
template<class CallbackType>
|
template<class CallbackType>
|
||||||
Foam::CallbackRegistry<CallbackType>::~CallbackRegistry()
|
Foam::CallbackRegistry<CallbackType>::~CallbackRegistry()
|
||||||
{
|
{
|
||||||
forAllIter(typename CallbackRegistry<CallbackType>, *this, iter)
|
forAllIters(*this, iter)
|
||||||
{
|
{
|
||||||
iter().Callback<CallbackType>::checkOut();
|
iter().Callback<CallbackType>::checkOut();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011, 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -290,7 +290,7 @@ void Foam::Time::readDict()
|
|||||||
|
|
||||||
IStringStream dummyIs("");
|
IStringStream dummyIs("");
|
||||||
|
|
||||||
forAllConstIter(simpleObjectRegistry, objs, iter)
|
forAllConstIters(objs, iter)
|
||||||
{
|
{
|
||||||
const List<simpleRegIOobject*>& objects = *iter;
|
const List<simpleRegIOobject*>& objects = *iter;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2012 OpenFOAM Foundation
|
| Copyright (C) 2012 OpenFOAM Foundation
|
||||||
@ -49,7 +49,7 @@ void MapDimensionedFields(const MeshMapper& mapper)
|
|||||||
|
|
||||||
TableType fields(mapper.thisDb().template lookupClass<FieldType>(true));
|
TableType fields(mapper.thisDb().template lookupClass<FieldType>(true));
|
||||||
|
|
||||||
forAllConstIter(typename TableType, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
FieldType& field = const_cast<FieldType&>(*fieldIter());
|
FieldType& field = const_cast<FieldType&>(*fieldIter());
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010, 2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -87,7 +87,7 @@ void MapGeometricFields
|
|||||||
// old-time-level field is mapped before the field itself, sizes
|
// old-time-level field is mapped before the field itself, sizes
|
||||||
// will not match.
|
// will not match.
|
||||||
|
|
||||||
forAllConstIter(typename HashTable<const FieldType*>, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
FieldType& field = const_cast<FieldType&>(*fieldIter());
|
FieldType& field = const_cast<FieldType&>(*fieldIter());
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ void MapGeometricFields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter(typename HashTable<const FieldType*>, fields, fieldIter)
|
forAllConstIters(fields, fieldIter)
|
||||||
{
|
{
|
||||||
FieldType& field = const_cast<FieldType&>(*fieldIter());
|
FieldType& field = const_cast<FieldType&>(*fieldIter());
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011 OpenFOAM Foundation
|
| Copyright (C) 2011 OpenFOAM Foundation
|
||||||
@ -51,7 +51,7 @@ inline void mapClouds(const objectRegistry& db, const mapPolyMesh& mapper)
|
|||||||
{
|
{
|
||||||
HashTable<const cloud*> clouds(db.lookupClass<cloud>());
|
HashTable<const cloud*> clouds(db.lookupClass<cloud>());
|
||||||
|
|
||||||
forAllIter(HashTable<const cloud*>, clouds, iter)
|
forAllIters(clouds, iter)
|
||||||
{
|
{
|
||||||
cloud& c = const_cast<cloud&>(*iter());
|
cloud& c = const_cast<cloud&>(*iter());
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2017-2018 OpenFOAM Foundation
|
| Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||||
@ -261,7 +261,7 @@ void Foam::OFstreamCollator::waitForBufferSpace(const off_t wantedSize) const
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(mutex_);
|
std::lock_guard<std::mutex> guard(mutex_);
|
||||||
forAllConstIter(FIFOStack<writeData*>, objects_, iter)
|
forAllConstIters(objects_, iter)
|
||||||
{
|
{
|
||||||
totalSize += iter()->size();
|
totalSize += iter()->size();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -258,12 +258,11 @@ Foam::fileOperation::lookupAndCacheProcessorsPath
|
|||||||
{
|
{
|
||||||
const fileName procPath(path/pDir);
|
const fileName procPath(path/pDir);
|
||||||
|
|
||||||
HashTable<dirIndexList>::const_iterator iter =
|
const auto iter = procsDirs_.cfind(procPath);
|
||||||
procsDirs_.find(procPath);
|
|
||||||
|
|
||||||
if (iter != procsDirs_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
return iter();
|
return iter.val();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read all directories to see any beginning with processor
|
// Read all directories to see any beginning with processor
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2017-2018 OpenFOAM Foundation
|
| Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||||
@ -254,14 +254,9 @@ Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
|
|||||||
|
|
||||||
// Check for approximately same time. E.g. if time = 1e-2 and
|
// Check for approximately same time. E.g. if time = 1e-2 and
|
||||||
// directory is 0.01 (due to different time formats)
|
// directory is 0.01 (due to different time formats)
|
||||||
HashPtrTable<instantList>::const_iterator pathFnd
|
const auto pathFnd = times_.cfind(io.time().path());
|
||||||
(
|
|
||||||
times_.find
|
if (search && pathFnd.found())
|
||||||
(
|
|
||||||
io.time().path()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (search && (pathFnd != times_.end()))
|
|
||||||
{
|
{
|
||||||
newInstancePath = findInstancePath
|
newInstancePath = findInstancePath
|
||||||
(
|
(
|
||||||
@ -2307,8 +2302,8 @@ Foam::instantList Foam::fileOperations::masterUncollatedFileOperation::findTimes
|
|||||||
const word& constantName
|
const word& constantName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
HashPtrTable<instantList>::const_iterator iter = times_.find(directory);
|
const auto iter = times_.cfind(directory);
|
||||||
if (iter != times_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -2358,8 +2353,8 @@ void Foam::fileOperations::masterUncollatedFileOperation::setTime
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashPtrTable<instantList>::const_iterator iter = times_.find(tm.path());
|
const auto iter = times_.cfind(tm.path());
|
||||||
if (iter != times_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
instantList& times = *iter();
|
instantList& times = *iter();
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2015 OpenFOAM Foundation
|
| Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
@ -197,7 +197,7 @@ void Foam::graph::setXRange(const scalar x0, const scalar x1)
|
|||||||
scalarField xNew(SubField<scalar>(x_, nX, i0));
|
scalarField xNew(SubField<scalar>(x_, nX, i0));
|
||||||
x_.transfer(xNew);
|
x_.transfer(xNew);
|
||||||
|
|
||||||
forAllIter(HashPtrTable<curve>, *this, iter)
|
forAllIters(*this, iter)
|
||||||
{
|
{
|
||||||
curve* c = iter();
|
curve* c = iter();
|
||||||
scalarField cNew(SubField<scalar>(*c, nX, i0));
|
scalarField cNew(SubField<scalar>(*c, nX, i0));
|
||||||
@ -254,7 +254,7 @@ void Foam::graph::writeTable(Ostream& os) const
|
|||||||
{
|
{
|
||||||
os << setw(10) << x_[xi];
|
os << setw(10) << x_[xi];
|
||||||
|
|
||||||
forAllConstIter(graph, *this, iter)
|
forAllConstIters(*this, iter)
|
||||||
{
|
{
|
||||||
os << token::SPACE << setw(10) << (*iter())[xi];
|
os << token::SPACE << setw(10) << (*iter())[xi];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2012 OpenFOAM Foundation
|
| Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
@ -53,7 +53,7 @@ void Foam::gnuplotGraph::write(const graph& g, Ostream& os) const
|
|||||||
|
|
||||||
bool firstField = true;
|
bool firstField = true;
|
||||||
|
|
||||||
forAllConstIter(graph, g, iter)
|
forAllConstIters(g, iter)
|
||||||
{
|
{
|
||||||
if (!firstField)
|
if (!firstField)
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@ void Foam::gnuplotGraph::write(const graph& g, Ostream& os) const
|
|||||||
os << "; pause -1" << endl;
|
os << "; pause -1" << endl;
|
||||||
|
|
||||||
|
|
||||||
forAllConstIter(graph, g, iter)
|
forAllConstIters(g, iter)
|
||||||
{
|
{
|
||||||
os << endl;
|
os << endl;
|
||||||
writeXY(g.x(), *iter(), os);
|
writeXY(g.x(), *iter(), os);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -49,7 +49,7 @@ void Foam::jplotGraph::write(const graph& g, Ostream& os) const
|
|||||||
|
|
||||||
label fieldi = 0;
|
label fieldi = 0;
|
||||||
|
|
||||||
forAllConstIter(graph, g, iter)
|
forAllConstIters(g, iter)
|
||||||
{
|
{
|
||||||
os << "# column " << fieldi + 2 << ": " << (*iter()).name() << endl;
|
os << "# column " << fieldi + 2 << ": " << (*iter()).name() << endl;
|
||||||
fieldi++;
|
fieldi++;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -50,7 +50,7 @@ void Foam::xmgrGraph::write(const graph& g, Ostream& os) const
|
|||||||
|
|
||||||
label fieldi = 0;
|
label fieldi = 0;
|
||||||
|
|
||||||
forAllConstIter(graph, g, iter)
|
forAllConstIters(g, iter)
|
||||||
{
|
{
|
||||||
os << "@s" << fieldi << " legend "
|
os << "@s" << fieldi << " legend "
|
||||||
<< iter()->name() << nl
|
<< iter()->name() << nl
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -682,23 +682,23 @@ void Foam::GAMGAgglomeration::calculateRegionMaster
|
|||||||
|
|
||||||
forAll(procAgglomMap, proci)
|
forAll(procAgglomMap, proci)
|
||||||
{
|
{
|
||||||
label coarseI = procAgglomMap[proci];
|
const label coarsei = procAgglomMap[proci];
|
||||||
|
|
||||||
Map<label>::iterator fnd = agglomToMaster.find(coarseI);
|
auto iter = agglomToMaster.find(coarsei);
|
||||||
if (fnd == agglomToMaster.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
agglomToMaster.insert(coarseI, proci);
|
iter.val() = min(iter.val(), proci);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fnd() = min(fnd(), proci);
|
agglomToMaster.insert(coarsei, proci);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
masterProcs.setSize(agglomToMaster.size());
|
masterProcs.setSize(agglomToMaster.size());
|
||||||
forAllConstIter(Map<label>, agglomToMaster, iter)
|
forAllConstIters(agglomToMaster, iter)
|
||||||
{
|
{
|
||||||
masterProcs[iter.key()] = iter();
|
masterProcs[iter.key()] = iter.val();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -709,6 +709,7 @@ void Foam::GAMGAgglomeration::calculateRegionMaster
|
|||||||
// Get all processors agglomerating to the same coarse
|
// Get all processors agglomerating to the same coarse
|
||||||
// processor
|
// processor
|
||||||
agglomProcIDs = findIndices(procAgglomMap, myAgglom);
|
agglomProcIDs = findIndices(procAgglomMap, myAgglom);
|
||||||
|
|
||||||
// Make sure the master is the first element.
|
// Make sure the master is the first element.
|
||||||
const label index =
|
const label index =
|
||||||
agglomProcIDs.find(agglomToMaster[myAgglom]);
|
agglomProcIDs.find(agglomToMaster[myAgglom]);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2013-2016 OpenFOAM Foundation
|
| Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
@ -104,7 +104,7 @@ Foam::procFacesGAMGProcAgglomeration::singleCellMesh
|
|||||||
// Add all the higher processors
|
// Add all the higher processors
|
||||||
nbrs.clear();
|
nbrs.clear();
|
||||||
weights.clear();
|
weights.clear();
|
||||||
forAllConstIter(Map<label>, neighbours, iter)
|
forAllConstIters(neighbours, iter)
|
||||||
{
|
{
|
||||||
if (iter.key() > proci)
|
if (iter.key() > proci)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -124,9 +124,14 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
labelPairLookup::const_iterator fnd = cellsToCoarseFace.find(cellPair);
|
const auto fnd = cellsToCoarseFace.cfind(cellPair);
|
||||||
|
|
||||||
if (fnd == cellsToCoarseFace.end())
|
if (fnd.found())
|
||||||
|
{
|
||||||
|
// Already have coarse face
|
||||||
|
dynFaceRestrictAddressing.append(fnd.val());
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// New coarse face
|
// New coarse face
|
||||||
label coarseI = dynFaceCells.size();
|
label coarseI = dynFaceCells.size();
|
||||||
@ -134,11 +139,6 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
|
|||||||
dynFaceCells.append(localRestrictAddressing[ffi]);
|
dynFaceCells.append(localRestrictAddressing[ffi]);
|
||||||
cellsToCoarseFace.insert(cellPair, coarseI);
|
cellsToCoarseFace.insert(cellPair, coarseI);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Already have coarse face
|
|
||||||
dynFaceRestrictAddressing.append(fnd());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
faceCells_.transfer(dynFaceCells);
|
faceCells_.transfer(dynFaceCells);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -112,9 +112,14 @@ Foam::processorGAMGInterface::processorGAMGInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
labelPairLookup::const_iterator fnd = cellsToCoarseFace.find(cellPair);
|
const auto fnd = cellsToCoarseFace.cfind(cellPair);
|
||||||
|
|
||||||
if (fnd == cellsToCoarseFace.end())
|
if (fnd.found())
|
||||||
|
{
|
||||||
|
// Already have coarse face
|
||||||
|
dynFaceRestrictAddressing.append(fnd.val());
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// New coarse face
|
// New coarse face
|
||||||
label coarseI = dynFaceCells.size();
|
label coarseI = dynFaceCells.size();
|
||||||
@ -122,11 +127,6 @@ Foam::processorGAMGInterface::processorGAMGInterface
|
|||||||
dynFaceCells.append(localRestrictAddressing[ffi]);
|
dynFaceCells.append(localRestrictAddressing[ffi]);
|
||||||
cellsToCoarseFace.insert(cellPair, coarseI);
|
cellsToCoarseFace.insert(cellPair, coarseI);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Already have coarse face
|
|
||||||
dynFaceRestrictAddressing.append(fnd());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
faceCells_.transfer(dynFaceCells);
|
faceCells_.transfer(dynFaceCells);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -72,10 +72,8 @@ void Foam::solution::read(const dictionary& dict)
|
|||||||
// backwards compatibility
|
// backwards compatibility
|
||||||
fieldRelaxDict_.clear();
|
fieldRelaxDict_.clear();
|
||||||
|
|
||||||
const wordList entryNames(relaxDict.toc());
|
for (const word& e : relaxDict.toc())
|
||||||
forAll(entryNames, i)
|
|
||||||
{
|
{
|
||||||
const word& e = entryNames[i];
|
|
||||||
scalar value = relaxDict.get<scalar>(e);
|
scalar value = relaxDict.get<scalar>(e);
|
||||||
|
|
||||||
if (e.startsWith("p"))
|
if (e.startsWith("p"))
|
||||||
@ -98,15 +96,12 @@ void Foam::solution::read(const dictionary& dict)
|
|||||||
eqnRelaxDefault_ =
|
eqnRelaxDefault_ =
|
||||||
eqnRelaxDict_.lookupOrDefault<scalar>("default", 0.0);
|
eqnRelaxDict_.lookupOrDefault<scalar>("default", 0.0);
|
||||||
|
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Relaxation factors:" << nl
|
||||||
Info<< "Relaxation factors:" << nl
|
<< "fields: " << fieldRelaxDict_ << nl
|
||||||
<< "fields: " << fieldRelaxDict_ << nl
|
<< "equations: " << eqnRelaxDict_ << endl;
|
||||||
<< "equations: " << eqnRelaxDict_ << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dict.found("solvers"))
|
if (dict.found("solvers"))
|
||||||
{
|
{
|
||||||
solvers_ = dict.subDict("solvers");
|
solvers_ = dict.subDict("solvers");
|
||||||
@ -171,11 +166,11 @@ Foam::label Foam::solution::upgradeSolverDict
|
|||||||
|
|
||||||
// backward compatibility:
|
// backward compatibility:
|
||||||
// recast primitive entries into dictionary entries
|
// recast primitive entries into dictionary entries
|
||||||
forAllIter(dictionary, dict, iter)
|
for (const entry& dEntry : dict)
|
||||||
{
|
{
|
||||||
if (!iter().isDict())
|
if (!dEntry.isDict())
|
||||||
{
|
{
|
||||||
Istream& is = iter().stream();
|
Istream& is = dEntry.stream();
|
||||||
word name(is);
|
word name(is);
|
||||||
dictionary subdict;
|
dictionary subdict;
|
||||||
|
|
||||||
@ -210,13 +205,13 @@ Foam::label Foam::solution::upgradeSolverDict
|
|||||||
if (verbose && Pstream::master())
|
if (verbose && Pstream::master())
|
||||||
{
|
{
|
||||||
Info<< "// using new solver syntax:\n"
|
Info<< "// using new solver syntax:\n"
|
||||||
<< iter().keyword() << subdict << endl;
|
<< dEntry.keyword() << subdict << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// overwrite with dictionary entry
|
// overwrite with dictionary entry
|
||||||
dict.set(iter().keyword(), subdict);
|
dict.set(dEntry.keyword(), subdict);
|
||||||
|
|
||||||
nChanged++;
|
++nChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,10 +223,8 @@ bool Foam::solution::cache(const word& name) const
|
|||||||
{
|
{
|
||||||
if (caching_)
|
if (caching_)
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Cache: find entry for " << name << endl;
|
||||||
Info<< "Cache: find entry for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cache_.found(name);
|
return cache_.found(name);
|
||||||
}
|
}
|
||||||
@ -242,12 +235,9 @@ bool Foam::solution::cache(const word& name) const
|
|||||||
|
|
||||||
bool Foam::solution::relaxField(const word& name) const
|
bool Foam::solution::relaxField(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Field relaxation factor for " << name
|
||||||
Info<< "Field relaxation factor for " << name
|
<< " is " << (fieldRelaxDict_.found(name) ? "set" : "unset") << endl;
|
||||||
<< " is " << (fieldRelaxDict_.found(name) ? "set" : "unset")
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fieldRelaxDict_.found(name) || fieldRelaxDict_.found("default");
|
return fieldRelaxDict_.found(name) || fieldRelaxDict_.found("default");
|
||||||
}
|
}
|
||||||
@ -255,10 +245,8 @@ bool Foam::solution::relaxField(const word& name) const
|
|||||||
|
|
||||||
bool Foam::solution::relaxEquation(const word& name) const
|
bool Foam::solution::relaxEquation(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Find equation relaxation factor for " << name << endl;
|
||||||
Info<< "Find equation relaxation factor for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return eqnRelaxDict_.found(name) || eqnRelaxDict_.found("default");
|
return eqnRelaxDict_.found(name) || eqnRelaxDict_.found("default");
|
||||||
}
|
}
|
||||||
@ -266,10 +254,8 @@ bool Foam::solution::relaxEquation(const word& name) const
|
|||||||
|
|
||||||
Foam::scalar Foam::solution::fieldRelaxationFactor(const word& name) const
|
Foam::scalar Foam::solution::fieldRelaxationFactor(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Lookup variable relaxation factor for " << name << endl;
|
||||||
Info<< "Lookup variable relaxation factor for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fieldRelaxDict_.found(name))
|
if (fieldRelaxDict_.found(name))
|
||||||
{
|
{
|
||||||
@ -279,24 +265,20 @@ Foam::scalar Foam::solution::fieldRelaxationFactor(const word& name) const
|
|||||||
{
|
{
|
||||||
return fieldRelaxDefault_;
|
return fieldRelaxDefault_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction(fieldRelaxDict_)
|
|
||||||
<< "Cannot find variable relaxation factor for '" << name
|
|
||||||
<< "' or a suitable default value."
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
|
|
||||||
return 0;
|
FatalIOErrorInFunction(fieldRelaxDict_)
|
||||||
}
|
<< "Cannot find variable relaxation factor for '" << name
|
||||||
|
<< "' or a suitable default value." << nl
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::solution::equationRelaxationFactor(const word& name) const
|
Foam::scalar Foam::solution::equationRelaxationFactor(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Lookup equation relaxation factor for " << name << endl;
|
||||||
Info<< "Lookup equation relaxation factor for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eqnRelaxDict_.found(name))
|
if (eqnRelaxDict_.found(name))
|
||||||
{
|
{
|
||||||
@ -306,15 +288,13 @@ Foam::scalar Foam::solution::equationRelaxationFactor(const word& name) const
|
|||||||
{
|
{
|
||||||
return eqnRelaxDefault_;
|
return eqnRelaxDefault_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction(eqnRelaxDict_)
|
|
||||||
<< "Cannot find equation relaxation factor for '" << name
|
|
||||||
<< "' or a suitable default value."
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
|
|
||||||
return 0;
|
FatalIOErrorInFunction(eqnRelaxDict_)
|
||||||
}
|
<< "Cannot find equation relaxation factor for '" << name
|
||||||
|
<< "' or a suitable default value."
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -331,10 +311,8 @@ const Foam::dictionary& Foam::solution::solutionDict() const
|
|||||||
|
|
||||||
const Foam::dictionary& Foam::solution::solverDict(const word& name) const
|
const Foam::dictionary& Foam::solution::solverDict(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Lookup solver for " << name << endl;
|
||||||
Info<< "Lookup solver for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return solvers_.subDict(name);
|
return solvers_.subDict(name);
|
||||||
}
|
}
|
||||||
@ -342,10 +320,8 @@ const Foam::dictionary& Foam::solution::solverDict(const word& name) const
|
|||||||
|
|
||||||
const Foam::dictionary& Foam::solution::solver(const word& name) const
|
const Foam::dictionary& Foam::solution::solver(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< "Lookup solver for " << name << endl;
|
||||||
Info<< "Lookup solver for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return solvers_.subDict(name);
|
return solvers_.subDict(name);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2013-2015 OpenFOAM Foundation
|
| Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||||
@ -179,11 +179,11 @@ Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
|
|||||||
|
|
||||||
label otherPatchID = -1;
|
label otherPatchID = -1;
|
||||||
|
|
||||||
forAllConstIter(HashTable<const polyMesh*>, meshSet, iter)
|
forAllConstIters(meshSet, iter)
|
||||||
{
|
{
|
||||||
const polyMesh& mesh = *iter();
|
const polyMesh& mesh = *iter();
|
||||||
|
|
||||||
label patchID = findOtherPatchID(mesh, thisPatch);
|
const label patchID = findOtherPatchID(mesh, thisPatch);
|
||||||
|
|
||||||
if (patchID != -1)
|
if (patchID != -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2013-2017 OpenFOAM Foundation
|
| Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||||
@ -119,9 +119,9 @@ Foam::label Foam::lduPrimitiveMesh::totalSize
|
|||||||
{
|
{
|
||||||
label size = 0;
|
label size = 0;
|
||||||
|
|
||||||
forAll(meshes, i)
|
for (const lduPrimitiveMesh& msh : meshes)
|
||||||
{
|
{
|
||||||
size += meshes[i].lduAddr().size();
|
size += msh.lduAddr().size();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@ -437,21 +437,10 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
|
|||||||
nCoupledFaces[procMeshI] += ldui.faceCells().size();
|
nCoupledFaces[procMeshI] += ldui.faceCells().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeMap<labelPairList>::iterator iter =
|
mergedMap(procEdge).append
|
||||||
mergedMap.find(procEdge);
|
(
|
||||||
|
labelPair(procMeshI, intI)
|
||||||
if (iter != mergedMap.end())
|
);
|
||||||
{
|
|
||||||
iter().append(labelPair(procMeshI, intI));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mergedMap.insert
|
|
||||||
(
|
|
||||||
procEdge,
|
|
||||||
labelPairList(1, labelPair(procMeshI, intI))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -464,21 +453,10 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeMap<labelPairList>::iterator iter =
|
unmergedMap(procEdge).append
|
||||||
unmergedMap.find(procEdge);
|
(
|
||||||
|
labelPair(procMeshI, intI)
|
||||||
if (iter != unmergedMap.end())
|
);
|
||||||
{
|
|
||||||
iter().append(labelPair(procMeshI, intI));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unmergedMap.insert
|
|
||||||
(
|
|
||||||
procEdge,
|
|
||||||
labelPairList(1, labelPair(procMeshI, intI))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -490,7 +468,7 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
|
|||||||
<< " of unhandled type " << interfaces[intI].type()
|
<< " of unhandled type " << interfaces[intI].type()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
nOtherInterfaces++;
|
++nOtherInterfaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -501,10 +479,10 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "Remaining interfaces:" << endl;
|
Pout<< "Remaining interfaces:" << endl;
|
||||||
forAllConstIter(EdgeMap<labelPairList>, unmergedMap, iter)
|
forAllConstIters(unmergedMap, iter)
|
||||||
{
|
{
|
||||||
Pout<< " agglom procEdge:" << iter.key() << endl;
|
Pout<< " agglom procEdge:" << iter.key() << endl;
|
||||||
const labelPairList& elems = iter();
|
const labelPairList& elems = iter.val();
|
||||||
forAll(elems, i)
|
forAll(elems, i)
|
||||||
{
|
{
|
||||||
label procMeshI = elems[i][0];
|
label procMeshI = elems[i][0];
|
||||||
@ -530,10 +508,10 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "Merged interfaces:" << endl;
|
Pout<< "Merged interfaces:" << endl;
|
||||||
forAllConstIter(EdgeMap<labelPairList>, mergedMap, iter)
|
forAllConstIters(mergedMap, iter)
|
||||||
{
|
{
|
||||||
Pout<< " agglom procEdge:" << iter.key() << endl;
|
Pout<< " agglom procEdge:" << iter.key() << endl;
|
||||||
const labelPairList& elems = iter();
|
const labelPairList& elems = iter.val();
|
||||||
|
|
||||||
forAll(elems, i)
|
forAll(elems, i)
|
||||||
{
|
{
|
||||||
@ -631,13 +609,13 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
|
|||||||
// I am 'master' since my cell numbers will be lower
|
// I am 'master' since my cell numbers will be lower
|
||||||
// since cells get added in procMeshI order.
|
// since cells get added in procMeshI order.
|
||||||
|
|
||||||
label agglom0 = procAgglomMap[myP];
|
const label agglom0 = procAgglomMap[myP];
|
||||||
label agglom1 = procAgglomMap[nbrP];
|
const label agglom1 = procAgglomMap[nbrP];
|
||||||
|
|
||||||
EdgeMap<labelPairList>::const_iterator fnd =
|
const auto fnd =
|
||||||
mergedMap.find(edge(agglom0, agglom1));
|
mergedMap.cfind(edge(agglom0, agglom1));
|
||||||
|
|
||||||
if (fnd != mergedMap.end())
|
if (fnd.found())
|
||||||
{
|
{
|
||||||
const labelPairList& elems = fnd();
|
const labelPairList& elems = fnd();
|
||||||
|
|
||||||
@ -796,9 +774,9 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
|
|||||||
|
|
||||||
label allInterfacei = 0;
|
label allInterfacei = 0;
|
||||||
|
|
||||||
forAllConstIter(EdgeMap<labelPairList>, unmergedMap, iter)
|
forAllConstIters(unmergedMap, iter)
|
||||||
{
|
{
|
||||||
const labelPairList& elems = iter();
|
const labelPairList& elems = iter.val();
|
||||||
|
|
||||||
// Sort processors in increasing order so both sides walk through in
|
// Sort processors in increasing order so both sides walk through in
|
||||||
// same order.
|
// same order.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -55,16 +55,14 @@ Foam::cellMatcher::cellMatcher
|
|||||||
cellModelName_(cellModelName),
|
cellModelName_(cellModelName),
|
||||||
cellModelPtr_(nullptr)
|
cellModelPtr_(nullptr)
|
||||||
{
|
{
|
||||||
forAll(localFaces_, facei)
|
for (face& f : localFaces_)
|
||||||
{
|
{
|
||||||
face& f = localFaces_[facei];
|
|
||||||
|
|
||||||
f.setSize(maxVertPerFace);
|
f.setSize(maxVertPerFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(pointFaceIndex_, verti)
|
for (labelList& faceIndices : pointFaceIndex_)
|
||||||
{
|
{
|
||||||
pointFaceIndex_[verti].setSize(facePerCell);
|
faceIndices.setSize(facePerCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,10 +92,15 @@ Foam::label Foam::cellMatcher::calcLocalFaces
|
|||||||
|
|
||||||
forAll(f, localVertI)
|
forAll(f, localVertI)
|
||||||
{
|
{
|
||||||
label vertI = f[localVertI];
|
const label vertI = f[localVertI];
|
||||||
|
|
||||||
Map<label>::iterator iter = localPoint_.find(vertI);
|
const auto iter = localPoint_.cfind(vertI);
|
||||||
if (iter == localPoint_.end())
|
if (iter.found())
|
||||||
|
{
|
||||||
|
// Reuse local vertex number.
|
||||||
|
localFace[localVertI] = iter.val();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Not found. Assign local vertex number.
|
// Not found. Assign local vertex number.
|
||||||
|
|
||||||
@ -111,11 +114,6 @@ Foam::label Foam::cellMatcher::calcLocalFaces
|
|||||||
localPoint_.insert(vertI, newVertI);
|
localPoint_.insert(vertI, newVertI);
|
||||||
newVertI++;
|
newVertI++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Reuse local vertex number.
|
|
||||||
localFace[localVertI] = *iter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create face from localvertex labels
|
// Create face from localvertex labels
|
||||||
@ -123,10 +121,9 @@ Foam::label Foam::cellMatcher::calcLocalFaces
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create local to global vertex mapping
|
// Create local to global vertex mapping
|
||||||
forAllConstIter(Map<label>, localPoint_, iter)
|
forAllConstIters(localPoint_, iter)
|
||||||
{
|
{
|
||||||
const label fp = iter();
|
pointMap_[iter.val()] = iter.key();
|
||||||
pointMap_[fp] = iter.key();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////debug
|
////debug
|
||||||
@ -188,10 +185,8 @@ void Foam::cellMatcher::calcEdgeAddressing(const label numVert)
|
|||||||
void Foam::cellMatcher::calcPointFaceIndex()
|
void Foam::cellMatcher::calcPointFaceIndex()
|
||||||
{
|
{
|
||||||
// Fill pointFaceIndex_ with -1
|
// Fill pointFaceIndex_ with -1
|
||||||
forAll(pointFaceIndex_, i)
|
for (labelList& faceIndices : pointFaceIndex_)
|
||||||
{
|
{
|
||||||
labelList& faceIndices = pointFaceIndex_[i];
|
|
||||||
|
|
||||||
faceIndices = -1;
|
faceIndices = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011, 2015 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2015-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -89,10 +89,8 @@ void Foam::globalMeshData::initProcAddr()
|
|||||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||||
|
|
||||||
// Send indices of my processor patches to my neighbours
|
// Send indices of my processor patches to my neighbours
|
||||||
forAll(processorPatches_, i)
|
for (const label patchi : processorPatches_)
|
||||||
{
|
{
|
||||||
label patchi = processorPatches_[i];
|
|
||||||
|
|
||||||
UOPstream toNeighbour
|
UOPstream toNeighbour
|
||||||
(
|
(
|
||||||
refCast<const processorPolyPatch>
|
refCast<const processorPolyPatch>
|
||||||
@ -107,10 +105,8 @@ void Foam::globalMeshData::initProcAddr()
|
|||||||
|
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
|
|
||||||
forAll(processorPatches_, i)
|
for (const label patchi : processorPatches_)
|
||||||
{
|
{
|
||||||
label patchi = processorPatches_[i];
|
|
||||||
|
|
||||||
UIPstream fromNeighbour
|
UIPstream fromNeighbour
|
||||||
(
|
(
|
||||||
refCast<const processorPolyPatch>
|
refCast<const processorPolyPatch>
|
||||||
@ -254,13 +250,22 @@ void Foam::globalMeshData::countSharedEdges
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Count occurrences of procSharedEdges in global shared edges table.
|
// Count occurrences of procSharedEdges in global shared edges table.
|
||||||
forAllConstIter(EdgeMap<labelList>, procSharedEdges, iter)
|
forAllConstIters(procSharedEdges, iter)
|
||||||
{
|
{
|
||||||
const edge& e = iter.key();
|
const edge& e = iter.key();
|
||||||
|
|
||||||
EdgeMap<label>::iterator globalFnd = globalShared.find(e);
|
auto globalFnd = globalShared.find(e);
|
||||||
|
|
||||||
if (globalFnd == globalShared.end())
|
if (globalFnd.found())
|
||||||
|
{
|
||||||
|
if (globalFnd() == -1)
|
||||||
|
{
|
||||||
|
// Second time occurence of this edge.
|
||||||
|
// Assign proper edge label.
|
||||||
|
globalFnd() = sharedEdgeI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// First time occurrence of this edge. Check how many we are adding.
|
// First time occurrence of this edge. Check how many we are adding.
|
||||||
if (iter().size() == 1)
|
if (iter().size() == 1)
|
||||||
@ -275,15 +280,6 @@ void Foam::globalMeshData::countSharedEdges
|
|||||||
globalShared.insert(e, sharedEdgeI++);
|
globalShared.insert(e, sharedEdgeI++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (globalFnd() == -1)
|
|
||||||
{
|
|
||||||
// Second time occurence of this edge. Assign proper
|
|
||||||
// edge label.
|
|
||||||
globalFnd() = sharedEdgeI++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,13 +325,13 @@ void Foam::globalMeshData::calcSharedEdges() const
|
|||||||
{
|
{
|
||||||
const edge& e = edges[edgeI];
|
const edge& e = edges[edgeI];
|
||||||
|
|
||||||
Map<label>::const_iterator e0Fnd = meshToShared.find(e[0]);
|
const auto e0Fnd = meshToShared.cfind(e[0]);
|
||||||
|
|
||||||
if (e0Fnd != meshToShared.end())
|
if (e0Fnd.found())
|
||||||
{
|
{
|
||||||
Map<label>::const_iterator e1Fnd = meshToShared.find(e[1]);
|
const auto e1Fnd = meshToShared.cfind(e[1]);
|
||||||
|
|
||||||
if (e1Fnd != meshToShared.end())
|
if (e1Fnd.found())
|
||||||
{
|
{
|
||||||
// Found edge which uses shared points. Probably shared.
|
// Found edge which uses shared points. Probably shared.
|
||||||
|
|
||||||
@ -347,10 +343,9 @@ void Foam::globalMeshData::calcSharedEdges() const
|
|||||||
sharedPtAddr[e1Fnd()]
|
sharedPtAddr[e1Fnd()]
|
||||||
);
|
);
|
||||||
|
|
||||||
EdgeMap<labelList>::iterator iter =
|
auto iter = localShared.find(sharedEdge);
|
||||||
localShared.find(sharedEdge);
|
|
||||||
|
|
||||||
if (iter == localShared.end())
|
if (!iter.found())
|
||||||
{
|
{
|
||||||
// First occurrence of this point combination. Store.
|
// First occurrence of this point combination. Store.
|
||||||
localShared.insert(sharedEdge, labelList(1, edgeI));
|
localShared.insert(sharedEdge, labelList(1, edgeI));
|
||||||
@ -360,7 +355,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
|||||||
// Add this edge to list of edge labels.
|
// Add this edge to list of edge labels.
|
||||||
labelList& edgeLabels = iter();
|
labelList& edgeLabels = iter();
|
||||||
|
|
||||||
label sz = edgeLabels.size();
|
const label sz = edgeLabels.size();
|
||||||
edgeLabels.setSize(sz+1);
|
edgeLabels.setSize(sz+1);
|
||||||
edgeLabels[sz] = edgeI;
|
edgeLabels[sz] = edgeI;
|
||||||
}
|
}
|
||||||
@ -425,7 +420,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
|||||||
|
|
||||||
globalShared.clear();
|
globalShared.clear();
|
||||||
|
|
||||||
forAllConstIter(EdgeMap<label>, oldSharedEdges, iter)
|
forAllConstIters(oldSharedEdges, iter)
|
||||||
{
|
{
|
||||||
if (iter() != -1)
|
if (iter() != -1)
|
||||||
{
|
{
|
||||||
@ -487,22 +482,22 @@ void Foam::globalMeshData::calcSharedEdges() const
|
|||||||
DynamicList<label> dynSharedEdgeLabels(globalShared.size());
|
DynamicList<label> dynSharedEdgeLabels(globalShared.size());
|
||||||
DynamicList<label> dynSharedEdgeAddr(globalShared.size());
|
DynamicList<label> dynSharedEdgeAddr(globalShared.size());
|
||||||
|
|
||||||
forAllConstIter(EdgeMap<labelList>, localShared, iter)
|
forAllConstIters(localShared, iter)
|
||||||
{
|
{
|
||||||
const edge& e = iter.key();
|
const edge& e = iter.key();
|
||||||
|
|
||||||
EdgeMap<label>::const_iterator edgeFnd = globalShared.find(e);
|
const auto edgeFnd = globalShared.cfind(e);
|
||||||
|
|
||||||
if (edgeFnd != globalShared.end())
|
if (edgeFnd.found())
|
||||||
{
|
{
|
||||||
// My local edge is indeed a shared one. Go through all local edge
|
// My local edge is indeed a shared one. Go through all local edge
|
||||||
// labels with this point combination.
|
// labels with this point combination.
|
||||||
const labelList& edgeLabels = iter();
|
const labelList& edgeLabels = iter();
|
||||||
|
|
||||||
forAll(edgeLabels, i)
|
for (const label edgei : edgeLabels)
|
||||||
{
|
{
|
||||||
// Store label of local mesh edge
|
// Store label of local mesh edge
|
||||||
dynSharedEdgeLabels.append(edgeLabels[i]);
|
dynSharedEdgeLabels.append(edgei);
|
||||||
|
|
||||||
// Store label of shared edge
|
// Store label of shared edge
|
||||||
dynSharedEdgeAddr.append(edgeFnd());
|
dynSharedEdgeAddr.append(edgeFnd());
|
||||||
@ -1238,25 +1233,18 @@ void Foam::globalMeshData::calcPointBoundaryFaces
|
|||||||
|
|
||||||
labelList nPointFaces(coupledPatch().nPoints(), Zero);
|
labelList nPointFaces(coupledPatch().nPoints(), Zero);
|
||||||
|
|
||||||
forAll(bMesh, patchi)
|
for (const polyPatch& pp : bMesh)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = bMesh[patchi];
|
|
||||||
|
|
||||||
if (!pp.coupled())
|
if (!pp.coupled())
|
||||||
{
|
{
|
||||||
forAll(pp, i)
|
for (const face& f : pp)
|
||||||
{
|
{
|
||||||
const face& f = pp[i];
|
|
||||||
|
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
Map<label>::const_iterator iter = meshPointMap.find
|
const auto iter = meshPointMap.cfind(f[fp]);
|
||||||
(
|
if (iter.found())
|
||||||
f[fp]
|
|
||||||
);
|
|
||||||
if (iter != meshPointMap.end())
|
|
||||||
{
|
{
|
||||||
nPointFaces[iter()]++;
|
nPointFaces[iter.val()]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1287,11 +1275,9 @@ void Foam::globalMeshData::calcPointBoundaryFaces
|
|||||||
const face& f = pp[i];
|
const face& f = pp[i];
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
Map<label>::const_iterator iter = meshPointMap.find
|
const auto iter = meshPointMap.cfind(f[fp]);
|
||||||
(
|
|
||||||
f[fp]
|
if (iter.found())
|
||||||
);
|
|
||||||
if (iter != meshPointMap.end())
|
|
||||||
{
|
{
|
||||||
label bFacei =
|
label bFacei =
|
||||||
pp.start() + i - mesh_.nInternalFaces();
|
pp.start() + i - mesh_.nInternalFaces();
|
||||||
@ -1525,10 +1511,10 @@ void Foam::globalMeshData::calcGlobalPointBoundaryCells() const
|
|||||||
|
|
||||||
forAll(pCells, i)
|
forAll(pCells, i)
|
||||||
{
|
{
|
||||||
label celli = pCells[i];
|
const label celli = pCells[i];
|
||||||
Map<label>::iterator fnd = meshCellMap.find(celli);
|
const auto fnd = meshCellMap.cfind(celli);
|
||||||
|
|
||||||
if (fnd != meshCellMap.end())
|
if (fnd.found())
|
||||||
{
|
{
|
||||||
bCells[i] = fnd();
|
bCells[i] = fnd();
|
||||||
}
|
}
|
||||||
@ -2568,9 +2554,9 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
|||||||
{
|
{
|
||||||
label meshPointi = meshPoints[patchPointi];
|
label meshPointi = meshPoints[patchPointi];
|
||||||
|
|
||||||
Map<label>::const_iterator iter = cpp.meshPointMap().find(meshPointi);
|
const auto iter = cpp.meshPointMap().cfind(meshPointi);
|
||||||
|
|
||||||
if (iter != cpp.meshPointMap().end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
patchToCoupled[patchPointi] = iter();
|
patchToCoupled[patchPointi] = iter();
|
||||||
coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointi);
|
coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointi);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -48,9 +48,8 @@ Foam::label Foam::globalPoints::countPatchPoints
|
|||||||
{
|
{
|
||||||
label nTotPoints = 0;
|
label nTotPoints = 0;
|
||||||
|
|
||||||
forAll(patches, patchi)
|
for (const polyPatch& pp : patches)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchi];
|
|
||||||
if (pp.coupled())
|
if (pp.coupled())
|
||||||
{
|
{
|
||||||
nTotPoints += pp.nPoints();
|
nTotPoints += pp.nPoints();
|
||||||
@ -279,11 +278,11 @@ bool Foam::globalPoints::mergeInfo
|
|||||||
label infoChanged = false;
|
label infoChanged = false;
|
||||||
|
|
||||||
// Get the index into the procPoints list.
|
// Get the index into the procPoints list.
|
||||||
Map<label>::iterator iter = meshToProcPoint_.find(localPointi);
|
const auto iter = meshToProcPoint_.cfind(localPointi);
|
||||||
|
|
||||||
if (iter != meshToProcPoint_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
if (mergeInfo(nbrInfo, localPointi, procPoints_[iter()]))
|
if (mergeInfo(nbrInfo, localPointi, procPoints_[iter.val()]))
|
||||||
{
|
{
|
||||||
infoChanged = true;
|
infoChanged = true;
|
||||||
}
|
}
|
||||||
@ -328,11 +327,11 @@ bool Foam::globalPoints::storeInitialInfo
|
|||||||
label infoChanged = false;
|
label infoChanged = false;
|
||||||
|
|
||||||
// Get the index into the procPoints list.
|
// Get the index into the procPoints list.
|
||||||
Map<label>::iterator iter = meshToProcPoint_.find(localPointi);
|
const auto iter = meshToProcPoint_.find(localPointi);
|
||||||
|
|
||||||
if (iter != meshToProcPoint_.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
if (mergeInfo(nbrInfo, localPointi, procPoints_[iter()]))
|
if (mergeInfo(nbrInfo, localPointi, procPoints_[iter.val()]))
|
||||||
{
|
{
|
||||||
infoChanged = true;
|
infoChanged = true;
|
||||||
}
|
}
|
||||||
@ -681,10 +680,9 @@ void Foam::globalPoints::receivePatchPoints
|
|||||||
|
|
||||||
|
|
||||||
// Do we have information on pointA?
|
// Do we have information on pointA?
|
||||||
Map<label>::iterator procPointA =
|
const auto procPointA = meshToProcPoint_.cfind(localA);
|
||||||
meshToProcPoint_.find(localA);
|
|
||||||
|
|
||||||
if (procPointA != meshToProcPoint_.end())
|
if (procPointA.found())
|
||||||
{
|
{
|
||||||
const labelPairList infoA = addSendTransform
|
const labelPairList infoA = addSendTransform
|
||||||
(
|
(
|
||||||
@ -699,10 +697,9 @@ void Foam::globalPoints::receivePatchPoints
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Same for info on pointB
|
// Same for info on pointB
|
||||||
Map<label>::iterator procPointB =
|
const auto procPointB = meshToProcPoint_.cfind(localB);
|
||||||
meshToProcPoint_.find(localB);
|
|
||||||
|
|
||||||
if (procPointB != meshToProcPoint_.end())
|
if (procPointB.found())
|
||||||
{
|
{
|
||||||
const labelPairList infoB = addSendTransform
|
const labelPairList infoB = addSendTransform
|
||||||
(
|
(
|
||||||
@ -968,11 +965,11 @@ void Foam::globalPoints::calculateSharedPoints
|
|||||||
|
|
||||||
|
|
||||||
//Pout<< "**ALL** connected points:" << endl;
|
//Pout<< "**ALL** connected points:" << endl;
|
||||||
//forAllConstIter(Map<label>, meshToProcPoint_, iter)
|
//forAllConstIters(meshToProcPoint_, iter)
|
||||||
//{
|
//{
|
||||||
// label localI = iter.key();
|
// label localI = iter.key();
|
||||||
// const labelPairList& pointInfo = procPoints_[iter()];
|
// const labelPairList& pointInfo = procPoints_[iter.val()];
|
||||||
// Pout<< "pointi:" << localI << " index:" << iter()
|
// Pout<< "pointi:" << localI << " index:" << iter.val()
|
||||||
// << " coord:"
|
// << " coord:"
|
||||||
// << mesh_.points()[localToMeshPoint(patchToMeshPoint, localI)]
|
// << mesh_.points()[localToMeshPoint(patchToMeshPoint, localI)]
|
||||||
// << endl;
|
// << endl;
|
||||||
@ -992,9 +989,9 @@ void Foam::globalPoints::calculateSharedPoints
|
|||||||
// the master the first element on all processors.
|
// the master the first element on all processors.
|
||||||
// Note: why not sort in decreasing order? Give more work to higher
|
// Note: why not sort in decreasing order? Give more work to higher
|
||||||
// processors.
|
// processors.
|
||||||
forAllConstIter(Map<label>, meshToProcPoint_, iter)
|
forAllConstIters(meshToProcPoint_, iter)
|
||||||
{
|
{
|
||||||
labelPairList& pointInfo = procPoints_[iter()];
|
labelPairList& pointInfo = procPoints_[iter.val()];
|
||||||
sort(pointInfo, globalIndexAndTransform::less(globalTransforms_));
|
sort(pointInfo, globalIndexAndTransform::less(globalTransforms_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1005,9 +1002,10 @@ void Foam::globalPoints::calculateSharedPoints
|
|||||||
|
|
||||||
pointPoints_.setSize(globalIndices_.localSize());
|
pointPoints_.setSize(globalIndices_.localSize());
|
||||||
List<labelPairList> transformedPoints(globalIndices_.localSize());
|
List<labelPairList> transformedPoints(globalIndices_.localSize());
|
||||||
forAllConstIter(Map<label>, meshToProcPoint_, iter)
|
|
||||||
|
forAllConstIters(meshToProcPoint_, iter)
|
||||||
{
|
{
|
||||||
const labelPairList& pointInfo = procPoints_[iter()];
|
const labelPairList& pointInfo = procPoints_[iter.val()];
|
||||||
|
|
||||||
if (pointInfo.size() >= 2)
|
if (pointInfo.size() >= 2)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011, 2015-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2015-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -280,6 +280,7 @@ public:
|
|||||||
fld = vt.invTransformPosition(pfld);
|
fld = vt.invTransformPosition(pfld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()
|
void operator()
|
||||||
(
|
(
|
||||||
const vectorTensorTransform& vt,
|
const vectorTensorTransform& vt,
|
||||||
@ -287,31 +288,33 @@ public:
|
|||||||
List<List<point>>& flds
|
List<List<point>>& flds
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
forAll(flds, i)
|
for (List<point>& fld : flds)
|
||||||
{
|
{
|
||||||
operator()(vt, forward, flds[i]);
|
operator()(vt, forward, fld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Transform patch-based field
|
//- Transform patch-based field
|
||||||
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
|
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
|
||||||
{
|
{
|
||||||
cpp.transformPosition(fld);
|
cpp.transformPosition(fld);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<template<class> class Container>
|
template<template<class> class Container>
|
||||||
void operator()(const coupledPolyPatch& cpp, Container<point>& map)
|
void operator()(const coupledPolyPatch& cpp, Container<point>& map)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
Field<point> fld(map.size());
|
Field<point> fld(map.size());
|
||||||
label i = 0;
|
label i = 0;
|
||||||
forAllConstIter(typename Container<point>, map, iter)
|
forAllConstIters(map, iter)
|
||||||
{
|
{
|
||||||
fld[i++] = iter();
|
fld[i++] = *iter;
|
||||||
}
|
}
|
||||||
cpp.transformPosition(fld);
|
cpp.transformPosition(fld);
|
||||||
i = 0;
|
i = 0;
|
||||||
forAllIter(typename Container<point>, map, iter)
|
forAllIters(map, iter)
|
||||||
{
|
{
|
||||||
iter() = fld[i++];
|
*iter = fld[i++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015-2016, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2015-2017 OpenFOAM Foundation
|
| Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||||
@ -293,13 +293,11 @@ void Foam::mapDistributeBase::calcCompactAddressing
|
|||||||
// Count all (non-local) elements needed. Just for presizing map.
|
// Count all (non-local) elements needed. Just for presizing map.
|
||||||
labelList nNonLocal(Pstream::nProcs(), Zero);
|
labelList nNonLocal(Pstream::nProcs(), Zero);
|
||||||
|
|
||||||
forAll(elements, i)
|
for (const label globalIdx : elements)
|
||||||
{
|
{
|
||||||
label globalIndex = elements[i];
|
if (globalIdx != -1 && !globalNumbering.isLocal(globalIdx))
|
||||||
|
|
||||||
if (globalIndex != -1 && !globalNumbering.isLocal(globalIndex))
|
|
||||||
{
|
{
|
||||||
label proci = globalNumbering.whichProcID(globalIndex);
|
label proci = globalNumbering.whichProcID(globalIdx);
|
||||||
nNonLocal[proci]++;
|
nNonLocal[proci]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,14 +313,12 @@ void Foam::mapDistributeBase::calcCompactAddressing
|
|||||||
|
|
||||||
|
|
||||||
// Collect all (non-local) elements needed.
|
// Collect all (non-local) elements needed.
|
||||||
forAll(elements, i)
|
for (const label globalIdx : elements)
|
||||||
{
|
{
|
||||||
label globalIndex = elements[i];
|
if (globalIdx != -1 && !globalNumbering.isLocal(globalIdx))
|
||||||
|
|
||||||
if (globalIndex != -1 && !globalNumbering.isLocal(globalIndex))
|
|
||||||
{
|
{
|
||||||
label proci = globalNumbering.whichProcID(globalIndex);
|
label proci = globalNumbering.whichProcID(globalIdx);
|
||||||
label index = globalNumbering.toLocal(proci, globalIndex);
|
label index = globalNumbering.toLocal(proci, globalIdx);
|
||||||
label nCompact = compactMap[proci].size();
|
label nCompact = compactMap[proci].size();
|
||||||
compactMap[proci].insert(index, nCompact);
|
compactMap[proci].insert(index, nCompact);
|
||||||
}
|
}
|
||||||
@ -342,17 +338,13 @@ void Foam::mapDistributeBase::calcCompactAddressing
|
|||||||
// Count all (non-local) elements needed. Just for presizing map.
|
// Count all (non-local) elements needed. Just for presizing map.
|
||||||
labelList nNonLocal(Pstream::nProcs(), Zero);
|
labelList nNonLocal(Pstream::nProcs(), Zero);
|
||||||
|
|
||||||
forAll(cellCells, cellI)
|
for (const labelList& cCells : cellCells)
|
||||||
{
|
{
|
||||||
const labelList& cCells = cellCells[cellI];
|
for (const label globalIdx : cCells)
|
||||||
|
|
||||||
forAll(cCells, i)
|
|
||||||
{
|
{
|
||||||
label globalIndex = cCells[i];
|
if (globalIdx != -1 && !globalNumbering.isLocal(globalIdx))
|
||||||
|
|
||||||
if (globalIndex != -1 && !globalNumbering.isLocal(globalIndex))
|
|
||||||
{
|
{
|
||||||
label proci = globalNumbering.whichProcID(globalIndex);
|
label proci = globalNumbering.whichProcID(globalIdx);
|
||||||
nNonLocal[proci]++;
|
nNonLocal[proci]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -369,18 +361,14 @@ void Foam::mapDistributeBase::calcCompactAddressing
|
|||||||
|
|
||||||
|
|
||||||
// Collect all (non-local) elements needed.
|
// Collect all (non-local) elements needed.
|
||||||
forAll(cellCells, cellI)
|
for (const labelList& cCells : cellCells)
|
||||||
{
|
{
|
||||||
const labelList& cCells = cellCells[cellI];
|
for (const label globalIdx : cCells)
|
||||||
|
|
||||||
forAll(cCells, i)
|
|
||||||
{
|
{
|
||||||
label globalIndex = cCells[i];
|
if (globalIdx != -1 && !globalNumbering.isLocal(globalIdx))
|
||||||
|
|
||||||
if (globalIndex != -1 && !globalNumbering.isLocal(globalIndex))
|
|
||||||
{
|
{
|
||||||
label proci = globalNumbering.whichProcID(globalIndex);
|
label proci = globalNumbering.whichProcID(globalIdx);
|
||||||
label index = globalNumbering.toLocal(proci, globalIndex);
|
label index = globalNumbering.toLocal(proci, globalIdx);
|
||||||
label nCompact = compactMap[proci].size();
|
label nCompact = compactMap[proci].size();
|
||||||
compactMap[proci].insert(index, nCompact);
|
compactMap[proci].insert(index, nCompact);
|
||||||
}
|
}
|
||||||
@ -439,9 +427,9 @@ void Foam::mapDistributeBase::exchangeAddressing
|
|||||||
remoteElem.setSize(compactMap[proci].size());
|
remoteElem.setSize(compactMap[proci].size());
|
||||||
localElem.setSize(compactMap[proci].size());
|
localElem.setSize(compactMap[proci].size());
|
||||||
label i = 0;
|
label i = 0;
|
||||||
forAllIter(Map<label>, compactMap[proci], iter)
|
forAllIters(compactMap[proci], iter)
|
||||||
{
|
{
|
||||||
const label compactI = compactStart[proci] + iter();
|
const label compactI = compactStart[proci] + iter.val();
|
||||||
remoteElem[i] = iter.key();
|
remoteElem[i] = iter.key();
|
||||||
localElem[i] = compactI;
|
localElem[i] = compactI;
|
||||||
iter() = compactI;
|
iter() = compactI;
|
||||||
@ -460,9 +448,9 @@ void Foam::mapDistributeBase::exchangeAddressing
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Renumber elements
|
// Renumber elements
|
||||||
forAll(elements, i)
|
for (label& elem : elements)
|
||||||
{
|
{
|
||||||
elements[i] = renumber(globalNumbering, compactMap, elements[i]);
|
elem = renumber(globalNumbering, compactMap, elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,9 +504,9 @@ void Foam::mapDistributeBase::exchangeAddressing
|
|||||||
remoteElem.setSize(compactMap[proci].size());
|
remoteElem.setSize(compactMap[proci].size());
|
||||||
localElem.setSize(compactMap[proci].size());
|
localElem.setSize(compactMap[proci].size());
|
||||||
label i = 0;
|
label i = 0;
|
||||||
forAllIter(Map<label>, compactMap[proci], iter)
|
forAllIters(compactMap[proci], iter)
|
||||||
{
|
{
|
||||||
const label compactI = compactStart[proci] + iter();
|
const label compactI = compactStart[proci] + iter.val();
|
||||||
remoteElem[i] = iter.key();
|
remoteElem[i] = iter.key();
|
||||||
localElem[i] = compactI;
|
localElem[i] = compactI;
|
||||||
iter() = compactI;
|
iter() = compactI;
|
||||||
@ -537,13 +525,11 @@ void Foam::mapDistributeBase::exchangeAddressing
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Renumber elements
|
// Renumber elements
|
||||||
forAll(cellCells, cellI)
|
for (labelList& cCells : cellCells)
|
||||||
{
|
{
|
||||||
labelList& cCells = cellCells[cellI];
|
for (label& celli : cCells)
|
||||||
|
|
||||||
forAll(cCells, i)
|
|
||||||
{
|
{
|
||||||
cCells[i] = renumber(globalNumbering, compactMap, cCells[i]);
|
celli = renumber(globalNumbering, compactMap, celli);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -706,8 +692,7 @@ Foam::mapDistributeBase::mapDistributeBase
|
|||||||
//
|
//
|
||||||
// forAll(sorted, i)
|
// forAll(sorted, i)
|
||||||
// {
|
// {
|
||||||
// Map<label>::iterator iter = globalMap.find(sorted[i]);
|
// globalMap(sorted[i]) = i;
|
||||||
// iter() = i;
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
@ -766,8 +751,7 @@ Foam::mapDistributeBase::mapDistributeBase
|
|||||||
//
|
//
|
||||||
// forAll(sorted, i)
|
// forAll(sorted, i)
|
||||||
// {
|
// {
|
||||||
// Map<label>::iterator iter = globalMap.find(sorted[i]);
|
// globalMap(sorted[i]) = i;
|
||||||
// iter() = i;
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011, 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -373,7 +373,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
|
|||||||
// Edge in mesh points.
|
// Edge in mesh points.
|
||||||
edge meshEdge(pp.meshPoints()[e[0]], pp.meshPoints()[e[1]]);
|
edge meshEdge(pp.meshPoints()[e[0]], pp.meshPoints()[e[1]]);
|
||||||
|
|
||||||
EdgeMap<labelPair>::iterator fnd = pointsToEdge.find(meshEdge);
|
auto fnd = pointsToEdge.find(meshEdge);
|
||||||
|
|
||||||
if (!fnd.found())
|
if (!fnd.found())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -382,7 +382,7 @@ bool Foam::polyMesh::checkEdgeAlignment
|
|||||||
if (setPtr)
|
if (setPtr)
|
||||||
{
|
{
|
||||||
setPtr->resize(2*edgesInError.size());
|
setPtr->resize(2*edgesInError.size());
|
||||||
forAllConstIter(EdgeMap<label>, edgesInError, iter)
|
forAllConstIters(edgesInError, iter)
|
||||||
{
|
{
|
||||||
setPtr->insert(iter.key()[0]);
|
setPtr->insert(iter.key()[0]);
|
||||||
setPtr->insert(iter.key()[1]);
|
setPtr->insert(iter.key()[1]);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2011, 2015 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011, 2015-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -1094,10 +1094,8 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const
|
|||||||
// Build map from points on *this (A) to points on neighbourpatch (B)
|
// Build map from points on *this (A) to points on neighbourpatch (B)
|
||||||
Map<label> aToB(2*pointCouples.size());
|
Map<label> aToB(2*pointCouples.size());
|
||||||
|
|
||||||
forAll(pointCouples, i)
|
for (const edge& e : pointCouples)
|
||||||
{
|
{
|
||||||
const edge& e = pointCouples[i];
|
|
||||||
|
|
||||||
aToB.insert(e[0], e[1]);
|
aToB.insert(e[0], e[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1108,18 +1106,16 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const
|
|||||||
{
|
{
|
||||||
const labelList& fEdges = faceEdges()[patchFacei];
|
const labelList& fEdges = faceEdges()[patchFacei];
|
||||||
|
|
||||||
forAll(fEdges, i)
|
for (const label edgeI : fEdges)
|
||||||
{
|
{
|
||||||
label edgeI = fEdges[i];
|
|
||||||
|
|
||||||
const edge& e = edges()[edgeI];
|
const edge& e = edges()[edgeI];
|
||||||
|
|
||||||
// Convert edge end points to corresponding points on B side.
|
// Convert edge end points to corresponding points on B side.
|
||||||
Map<label>::const_iterator fnd0 = aToB.find(e[0]);
|
const auto fnd0 = aToB.cfind(e[0]);
|
||||||
if (fnd0 != aToB.end())
|
if (fnd0.found())
|
||||||
{
|
{
|
||||||
Map<label>::const_iterator fnd1 = aToB.find(e[1]);
|
const auto fnd1 = aToB.cfind(e[1]);
|
||||||
if (fnd1 != aToB.end())
|
if (fnd1.found())
|
||||||
{
|
{
|
||||||
edgeMap.insert(edge(fnd0(), fnd1()), edgeI);
|
edgeMap.insert(edge(fnd0(), fnd1()), edgeI);
|
||||||
}
|
}
|
||||||
@ -1134,7 +1130,6 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const
|
|||||||
const labelList& mp = meshPoints();
|
const labelList& mp = meshPoints();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
coupledEdgesPtr_ = new edgeList(edgeMap.size());
|
coupledEdgesPtr_ = new edgeList(edgeMap.size());
|
||||||
edgeList& coupledEdges = *coupledEdgesPtr_;
|
edgeList& coupledEdges = *coupledEdgesPtr_;
|
||||||
label coupleI = 0;
|
label coupleI = 0;
|
||||||
@ -1143,18 +1138,16 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const
|
|||||||
{
|
{
|
||||||
const labelList& fEdges = neighbPatch.faceEdges()[patchFacei];
|
const labelList& fEdges = neighbPatch.faceEdges()[patchFacei];
|
||||||
|
|
||||||
forAll(fEdges, i)
|
for (const label edgeI : fEdges)
|
||||||
{
|
{
|
||||||
label edgeI = fEdges[i];
|
|
||||||
|
|
||||||
const edge& e = neighbPatch.edges()[edgeI];
|
const edge& e = neighbPatch.edges()[edgeI];
|
||||||
|
|
||||||
// Look up A edge from HashTable.
|
// Look up A edge from HashTable.
|
||||||
EdgeMap<label>::iterator iter = edgeMap.find(e);
|
auto iter = edgeMap.find(e);
|
||||||
|
|
||||||
if (iter != edgeMap.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
label edgeA = iter();
|
const label edgeA = iter.val();
|
||||||
const edge& eA = edges()[edgeA];
|
const edge& eA = edges()[edgeA];
|
||||||
|
|
||||||
// Store correspondence. Filter out edges on wedge axis.
|
// Store correspondence. Filter out edges on wedge axis.
|
||||||
@ -1202,10 +1195,8 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const
|
|||||||
Pout<< "Writing file " << str.name() << " with centres of "
|
Pout<< "Writing file " << str.name() << " with centres of "
|
||||||
<< "coupled edges" << endl;
|
<< "coupled edges" << endl;
|
||||||
|
|
||||||
forAll(coupledEdges, i)
|
for (const edge& e : coupledEdges)
|
||||||
{
|
{
|
||||||
const edge& e = coupledEdges[i];
|
|
||||||
|
|
||||||
const point& a = edges()[e[0]].centre(localPoints());
|
const point& a = edges()[e[0]].centre(localPoints());
|
||||||
const point& b = neighbPatch.edges()[e[1]].centre
|
const point& b = neighbPatch.edges()[e[1]].centre
|
||||||
(
|
(
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -56,17 +56,14 @@ void Foam::PatchTools::matchPoints
|
|||||||
|
|
||||||
forAll(p1.meshPoints(), pointi)
|
forAll(p1.meshPoints(), pointi)
|
||||||
{
|
{
|
||||||
label meshPointi = p1.meshPoints()[pointi];
|
const label meshPointi = p1.meshPoints()[pointi];
|
||||||
|
|
||||||
Map<label>::const_iterator iter = p2.meshPointMap().find
|
const auto iter = p2.meshPointMap().cfind(meshPointi);
|
||||||
(
|
|
||||||
meshPointi
|
|
||||||
);
|
|
||||||
|
|
||||||
if (iter != p2.meshPointMap().end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
p1PointLabels[nMatches] = pointi;
|
p1PointLabels[nMatches] = pointi;
|
||||||
p2PointLabels[nMatches] = iter();
|
p2PointLabels[nMatches] = iter.val();
|
||||||
nMatches++;
|
nMatches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,11 +117,11 @@ void Foam::PatchTools::matchEdges
|
|||||||
const edge& e = p2.edges()[edgeI];
|
const edge& e = p2.edges()[edgeI];
|
||||||
const edge meshE(p2.meshPoints()[e[0]], p2.meshPoints()[e[1]]);
|
const edge meshE(p2.meshPoints()[e[0]], p2.meshPoints()[e[1]]);
|
||||||
|
|
||||||
EdgeMap<label>::const_iterator iter = edgeToIndex.find(meshE);
|
const auto iter = edgeToIndex.cfind(meshE);
|
||||||
|
|
||||||
if (iter != edgeToIndex.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
p1EdgeLabels[nMatches] = iter();
|
p1EdgeLabels[nMatches] = iter.val();
|
||||||
p2EdgeLabels[nMatches] = edgeI;
|
p2EdgeLabels[nMatches] = edgeI;
|
||||||
sameOrientation.set(nMatches, (meshE[0] == iter.key()[0]));
|
sameOrientation.set(nMatches, (meshE[0] == iter.key()[0]));
|
||||||
++nMatches;
|
++nMatches;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2011-2011, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -55,8 +55,6 @@ Foam::PatchTools::pointNormals
|
|||||||
globalData.globalTransforms();
|
globalData.globalTransforms();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Combine normals. Note: do on all master points. Cannot just use
|
// Combine normals. Note: do on all master points. Cannot just use
|
||||||
// patch points since the master point does not have to be on the
|
// patch points since the master point does not have to be on the
|
||||||
// patch!
|
// patch!
|
||||||
@ -68,11 +66,12 @@ Foam::PatchTools::pointNormals
|
|||||||
List<List<point>> pointFaceNormals(map.constructSize());
|
List<List<point>> pointFaceNormals(map.constructSize());
|
||||||
forAll(p.meshPoints(), patchPointi)
|
forAll(p.meshPoints(), patchPointi)
|
||||||
{
|
{
|
||||||
label meshPointi = p.meshPoints()[patchPointi];
|
const label meshPointi = p.meshPoints()[patchPointi];
|
||||||
Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointi);
|
|
||||||
if (fnd != coupledPatchMP.end())
|
const auto fnd = coupledPatchMP.cfind(meshPointi);
|
||||||
|
if (fnd.found())
|
||||||
{
|
{
|
||||||
label coupledPointi = fnd();
|
const label coupledPointi = fnd.val();
|
||||||
|
|
||||||
List<point>& pNormals = pointFaceNormals[coupledPointi];
|
List<point>& pNormals = pointFaceNormals[coupledPointi];
|
||||||
const labelList& pFaces = p.pointFaces()[patchPointi];
|
const labelList& pFaces = p.pointFaces()[patchPointi];
|
||||||
@ -182,11 +181,12 @@ Foam::PatchTools::pointNormals
|
|||||||
// 2. Override patch normals on coupled points
|
// 2. Override patch normals on coupled points
|
||||||
forAll(p.meshPoints(), patchPointi)
|
forAll(p.meshPoints(), patchPointi)
|
||||||
{
|
{
|
||||||
label meshPointi = p.meshPoints()[patchPointi];
|
const label meshPointi = p.meshPoints()[patchPointi];
|
||||||
Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointi);
|
|
||||||
if (fnd != coupledPatchMP.end())
|
const auto fnd = coupledPatchMP.cfind(meshPointi);
|
||||||
|
if (fnd.found())
|
||||||
{
|
{
|
||||||
label coupledPointi = fnd();
|
const label coupledPointi = fnd.val();
|
||||||
extrudeN[patchPointi] = coupledPointNormals[coupledPointi];
|
extrudeN[patchPointi] = coupledPointNormals[coupledPointi];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,12 +220,12 @@ Foam::PatchTools::edgeNormals
|
|||||||
const labelListList& edgeFaces = p.edgeFaces();
|
const labelListList& edgeFaces = p.edgeFaces();
|
||||||
const vectorField& faceNormals = p.faceNormals();
|
const vectorField& faceNormals = p.faceNormals();
|
||||||
|
|
||||||
forAll(edgeFaces, edgeI)
|
forAll(edgeFaces, edgei)
|
||||||
{
|
{
|
||||||
const labelList& eFaces = edgeFaces[edgeI];
|
const labelList& eFaces = edgeFaces[edgei];
|
||||||
forAll(eFaces, i)
|
for (const label facei : eFaces)
|
||||||
{
|
{
|
||||||
edgeNormals[edgeI] += faceNormals[eFaces[i]];
|
edgeNormals[edgei] += faceNormals[facei];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
edgeNormals /= mag(edgeNormals)+VSMALL;
|
edgeNormals /= mag(edgeNormals)+VSMALL;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -32,7 +32,6 @@ Description
|
|||||||
#include "SLList.H"
|
#include "SLList.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template
|
template
|
||||||
@ -46,10 +45,8 @@ void
|
|||||||
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
calcPointEdges() const
|
calcPointEdges() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Calculating pointEdges" << endl;
|
||||||
InfoInFunction << "Calculating pointEdges" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pointEdgesPtr_)
|
if (pointEdgesPtr_)
|
||||||
{
|
{
|
||||||
@ -65,10 +62,8 @@ calcPointEdges() const
|
|||||||
|
|
||||||
invertManyToMany(pe.size(), edges(), pe);
|
invertManyToMany(pe.size(), edges(), pe);
|
||||||
|
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< " Finished." << endl;
|
||||||
Info<< " Finished." << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,10 +78,8 @@ void
|
|||||||
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
calcPointFaces() const
|
calcPointFaces() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Calculating pointFaces" << endl;
|
||||||
InfoInFunction << "Calculating pointFaces" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pointFacesPtr_)
|
if (pointFacesPtr_)
|
||||||
{
|
{
|
||||||
@ -105,9 +98,9 @@ calcPointFaces() const
|
|||||||
{
|
{
|
||||||
const Face& curPoints = f[facei];
|
const Face& curPoints = f[facei];
|
||||||
|
|
||||||
forAll(curPoints, pointi)
|
for (const label pointi : curPoints)
|
||||||
{
|
{
|
||||||
pointFcs[curPoints[pointi]].append(facei);
|
pointFcs[pointi].append(facei);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,16 +114,14 @@ calcPointFaces() const
|
|||||||
pf[pointi].setSize(pointFcs[pointi].size());
|
pf[pointi].setSize(pointFcs[pointi].size());
|
||||||
|
|
||||||
label i = 0;
|
label i = 0;
|
||||||
forAllIter(SLList<label>, pointFcs[pointi], curFacesIter)
|
for (const label facei : pointFcs[pointi])
|
||||||
{
|
{
|
||||||
pf[pointi][i++] = curFacesIter();
|
pf[pointi][i++] = facei;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< " Finished." << endl;
|
||||||
Info<< " Finished." << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -811,7 +811,7 @@ bool Foam::primitiveMesh::checkFaceFlatness
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (nWarped> 0)
|
if (nWarped > 0)
|
||||||
{
|
{
|
||||||
if (debug || report)
|
if (debug || report)
|
||||||
{
|
{
|
||||||
@ -1352,7 +1352,7 @@ bool Foam::primitiveMesh::checkDuplicateFaces
|
|||||||
{
|
{
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
forAllConstIter(Map<label>, nCommonPoints, iter)
|
forAllConstIters(nCommonPoints, iter)
|
||||||
{
|
{
|
||||||
label nbFacei = iter.key();
|
label nbFacei = iter.key();
|
||||||
label nCommon = iter();
|
label nCommon = iter();
|
||||||
@ -1392,7 +1392,7 @@ bool Foam::primitiveMesh::checkCommonOrder
|
|||||||
{
|
{
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
forAllConstIter(Map<label>, nCommonPoints, iter)
|
forAllConstIters(nCommonPoints, iter)
|
||||||
{
|
{
|
||||||
label nbFacei = iter.key();
|
label nbFacei = iter.key();
|
||||||
label nCommon = iter();
|
label nCommon = iter();
|
||||||
@ -1583,18 +1583,7 @@ bool Foam::primitiveMesh::checkFaceFaces
|
|||||||
if (facei < nbFacei)
|
if (facei < nbFacei)
|
||||||
{
|
{
|
||||||
// Only check once for each combination of two faces.
|
// Only check once for each combination of two faces.
|
||||||
|
++(nCommonPoints(nbFacei, 0));
|
||||||
Map<label>::iterator fnd = nCommonPoints.find(nbFacei);
|
|
||||||
|
|
||||||
if (fnd == nCommonPoints.end())
|
|
||||||
{
|
|
||||||
// First common vertex found.
|
|
||||||
nCommonPoints.insert(nbFacei, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fnd()++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,6 +142,4 @@ const Foam::labelList& Foam::primitiveMesh::pointPoints
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user