Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Use official implementation of El::MaxAbs (fixes #332) (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Blom authored Aug 27, 2016
1 parent c0dfbc2 commit 8e9753d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/RBFMeshMotionSolver/AdaptiveCoarsening.C
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace rbf
if ( not rbf->initialized() )
{
// Only do a greedy selection if the values actually mean something
double maxAbs = rbf::MaxAbs( *values );
double maxAbs = El::MaxAbs( *values );

if ( maxAbs > 0 )
{
Expand Down
24 changes: 0 additions & 24 deletions src/RBFMeshMotionSolver/AdaptiveCoarsening.H
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,4 @@ namespace rbf
std::unique_ptr<El::DistMatrix<double> > positions;
std::unique_ptr<El::DistMatrix<double> > positionsInterpolation;
};

template<typename Real>
Real MaxAbs( const El::DistMatrix<Real> & A )
{
Real value = 0;

if ( A.Participating() )
{
// Store the index/value of the local pivot candidate
const El::Int mLocal = A.LocalHeight();
const El::Int nLocal = A.LocalWidth();
const Real * ABuf = A.LockedBuffer();
const El::Int ALDim = A.LDim();

for ( El::Int jLoc = 0; jLoc < nLocal; ++jLoc )
for ( El::Int iLoc = 0; iLoc < mLocal; ++iLoc )
value = El::Max( std::abs( value ), ABuf[iLoc + jLoc * ALDim] );

value = El::mpi::AllReduce( value, El::mpi::MAX, A.DistComm() );
}

El::mpi::Broadcast( value, A.Root(), A.CrossComm() );
return value;
}
}
2 changes: 1 addition & 1 deletion src/thirdParty/elemental

0 comments on commit 8e9753d

Please sign in to comment.