CollectToIORank: remove unnecessary whitespace, braces

This commit is contained in:
Andreas Lauser 2018-07-12 10:36:48 +02:00
parent 4342210b5e
commit b92aee90b5

View File

@ -174,17 +174,15 @@ public:
enum { ioRank = 0 };
static const bool needsReordering = ! std::is_same<
typename Vanguard::Grid, typename Vanguard::EquilGrid > :: value ;
static const bool needsReordering =
!std::is_same<typename Vanguard::Grid, typename Vanguard::EquilGrid>::value;
CollectDataToIORank(const Vanguard& vanguard)
: toIORankComm_()
{
// index maps only have to be build when reordering is needed
if (!needsReordering && !isParallel())
{
return;
}
const CollectiveCommunication& comm = vanguard.grid().comm();
@ -217,20 +215,14 @@ public:
}
// the I/O rank receives from all other ranks
if( isIORank() )
{
for(int i=0; i<comm.size(); ++i)
{
if (isIORank()) {
for (int i = 0; i < comm.size(); ++i) {
if (i != ioRank)
{
recv.insert(i);
}
}
}
else // all other simply send to the I/O rank
{
send.insert(ioRank);
}
localIndexMap_.clear();
const size_t gridSize = vanguard.grid().size(0);
@ -252,10 +244,10 @@ public:
#endif
// A mapping for the whole grid (including the ghosts) is needed for restarts
for( auto it = localGridView.template begin< 0 >(),
end = localGridView.template end< 0 >(); it != end; ++it )
{
const auto element = *it ;
auto eIt = localGridView.template begin<0>();
const auto& eEndIt = localGridView.template end<0>();
for (; eIt != eEndIt; ++eIt) {
const auto element = *eIt;
int elemIdx = elemMapper.index(element);
distributedCartesianIndex[elemIdx] = vanguard.cartesianIndex(elemIdx);
@ -273,7 +265,11 @@ public:
indexMaps_.resize(comm.size());
// distribute global id's to io rank for later association of dof's
DistributeIndexMapping distIndexMapping( globalCartesianIndex_, distributedCartesianIndex, localIndexMap_, indexMaps_, globalRanks_);
DistributeIndexMapping distIndexMapping(globalCartesianIndex_,
distributedCartesianIndex,
localIndexMap_,
indexMaps_,
globalRanks_);
toIORankComm_.exchange(distIndexMapping);
}
}
@ -298,8 +294,7 @@ public:
, localIndexMap_(localIndexMap)
, indexMaps_(indexMaps)
{
if( isIORank )
{
if (isIORank) {
// add missing data to global cell data
for (const auto& pair : localCellData_) {
const std::string& key = pair.first;
@ -322,9 +317,8 @@ public:
void pack(int link, MessageBufferType& buffer)
{
// we should only get one link
if( link != 0 ) {
if (link != 0)
throw std::logic_error("link in method pack is not 0 as expected");
}
// write all cell data registered in local state
for (const auto& pair : localCellData_) {
@ -365,7 +359,7 @@ public:
assert(vector.size() >= stride * size);
for (unsigned int i=0; i<size; ++i)
{
const unsigned int index = localIndexMap[ i ] * stride + offset;
unsigned int index = localIndexMap[i] * stride + offset;
assert(index < vector.size());
buffer.write(vector[index]);
}
@ -381,9 +375,8 @@ public:
unsigned int size = 0;
buffer.read(size);
assert(size == indexMap.size());
for( unsigned int i=0; i<size; ++i )
{
const unsigned int index = indexMap[ i ] * stride + offset;
for (unsigned int i=0; i<size; ++i) {
unsigned int index = indexMap[i] * stride + offset;
assert(index < vector.size());
buffer.read(vector[index]);
}
@ -440,8 +433,7 @@ public:
: localBlockData_(localBlockData)
, globalBlockValues_(globalBlockValues)
{
if( isIORank )
{
if (isIORank) {
MessageBufferType buffer;
pack(0, buffer);
@ -455,9 +447,8 @@ public:
void pack(int link, MessageBufferType& buffer)
{
// we should only get one link
if( link != 0 ) {
if (link != 0)
throw std::logic_error("link in method pack is not 0 as expected");
}
// write all block data
unsigned int size = localBlockData_.size();
@ -499,9 +490,7 @@ public:
// index maps only have to be build when reordering is needed
if(!needsReordering && !isParallel())
{
return;
}
// this also packs and unpacks the local buffers one ioRank
PackUnPackCellData
@ -513,10 +502,8 @@ public:
isIORank());
if (!isParallel())
{
// no need to collect anything.
return;
}
PackUnPackWellData
packUnpackWellData(localWellData,
@ -558,9 +545,8 @@ public:
int localIdxToGlobalIdx(unsigned localIdx) const
{
if (!isParallel())
{
return localIdx;
}
// the last indexMap is the local one
const IndexMapType& indexMap = indexMaps_.back();
if (indexMap.empty())