Skip to content

Commit

Permalink
Use clang-format version 8 with Kokkos' .clang-format files instead
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamBenHarper committed Jul 17, 2023
1 parent 4968200 commit af5dac5
Show file tree
Hide file tree
Showing 652 changed files with 94,677 additions and 79,109 deletions.
6 changes: 6 additions & 0 deletions packages/muelu/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Official Tool: clang-format version 8.0.0
BasedOnStyle: google
SortIncludes: false
AlignConsecutiveAssignments: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
3 changes: 3 additions & 0 deletions packages/muelu/.clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
core/unit_test/config/results/*
tpls/gtest/gtest/*
core/src/desul/*
Original file line number Diff line number Diff line change
Expand Up @@ -69,106 +69,109 @@

/*!
@class BrickAggregationFactory
@brief Aggregation method for generating "brick" aggregates. It also does "hotdogs" and "pancakes."
This factory can generate aggregates of size 1, 2 or 3 in each dimension, in any combination.
@brief Aggregation method for generating "brick" aggregates. It also does
"hotdogs" and "pancakes."
This factory can generate aggregates of size 1, 2 or 3 in each dimension, in
any combination.
*/

namespace MueLu {

template<class Scalar = DefaultScalar,
class LocalOrdinal = DefaultLocalOrdinal,
class GlobalOrdinal = DefaultGlobalOrdinal,
class Node = DefaultNode>
class BrickAggregationFactory : public SingleLevelFactoryBase {
template <class Scalar = DefaultScalar,
class LocalOrdinal = DefaultLocalOrdinal,
class GlobalOrdinal = DefaultGlobalOrdinal, class Node = DefaultNode>
class BrickAggregationFactory : public SingleLevelFactoryBase {
#undef MUELU_BRICKAGGREGATIONFACTORY_SHORT
#include "MueLu_UseShortNames.hpp"
private:
typedef Teuchos::ScalarTraits<Scalar> STS;

// Comparator for doubles
// Generally, the coordinates for coarser levels would come out of averaging of fine level coordinates
// It is possible that the result of the averaging differs slightly between clusters, as we might have
// 3x2 and 2x2 cluster which would result in averaging 6 and 4 y-coordinates respectively, leading to
// slightly different results.
// Therefore, we hardcode a constant so that close points are considered the same.
class compare {
public:
bool operator()(const Scalar& x, const Scalar& y) const {
if (STS::magnitude(x - y) < 1e-14)
return false;
return STS::real(x) < STS::real(y);
}
};
typedef std::map<Scalar,GlobalOrdinal,compare> container;

public:
//! @name Constructors/Destructors.
//@{

//! Constructor.
BrickAggregationFactory() : nDim_(-1), nx_(-1), ny_(-1), nz_(-1), bx_(-1), by_(-1), bz_(-1) { };

//! Destructor.
virtual ~BrickAggregationFactory() { }

RCP<const ParameterList> GetValidParameterList() const;

//@}

// Options shared by all aggregation algorithms

//! Input
//@{

void DeclareInput(Level &currentLevel) const;

//@}

//! @name Build methods.
//@{

/*! @brief Build aggregates. */
void Build(Level &currentLevel) const;

//@}

private:
void Setup(const RCP<const Teuchos::Comm<int> >& comm, const RCP<Xpetra::MultiVector<typename Teuchos::ScalarTraits<Scalar>::magnitudeType,LO,GO,NO> >& coords, const RCP<const Map>& map) const;
RCP<container> Construct1DMap(const RCP<const Teuchos::Comm<int> >& comm, const ArrayRCP<const typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& x) const;

void BuildGraph(Level& currentLevel, const RCP<Matrix>& A) const;


bool isDirichlet(LocalOrdinal LID) const;
bool isRoot (LocalOrdinal LID) const;
GlobalOrdinal getRoot (LocalOrdinal LID) const;
GlobalOrdinal getAggGID(LocalOrdinal LID) const;

void getIJK(LocalOrdinal LID, int &i, int &j, int &k) const;
void getAggIJK(LocalOrdinal LID, int &i, int &j, int &k) const;

mutable
int nDim_;
mutable
RCP<container> xMap_, yMap_, zMap_;
mutable
ArrayRCP<const typename Teuchos::ScalarTraits<Scalar>::magnitudeType> x_, y_, z_;
mutable
int nx_, ny_, nz_;
mutable
int bx_, by_, bz_;
mutable
bool dirichletX_,dirichletY_,dirichletZ_;
mutable
int naggx_, naggy_, naggz_;

mutable
std::map<GlobalOrdinal,GlobalOrdinal> revMap_;
}; // class BrickAggregationFactory

}
private:
typedef Teuchos::ScalarTraits<Scalar> STS;

// Comparator for doubles
// Generally, the coordinates for coarser levels would come out of averaging
// of fine level coordinates It is possible that the result of the averaging
// differs slightly between clusters, as we might have 3x2 and 2x2 cluster
// which would result in averaging 6 and 4 y-coordinates respectively, leading
// to slightly different results. Therefore, we hardcode a constant so that
// close points are considered the same.
class compare {
public:
bool operator()(const Scalar& x, const Scalar& y) const {
if (STS::magnitude(x - y) < 1e-14) return false;
return STS::real(x) < STS::real(y);
}
};
typedef std::map<Scalar, GlobalOrdinal, compare> container;

public:
//! @name Constructors/Destructors.
//@{

//! Constructor.
BrickAggregationFactory()
: nDim_(-1), nx_(-1), ny_(-1), nz_(-1), bx_(-1), by_(-1), bz_(-1){};

//! Destructor.
virtual ~BrickAggregationFactory() {}

RCP<const ParameterList> GetValidParameterList() const;

//@}

// Options shared by all aggregation algorithms

//! Input
//@{

void DeclareInput(Level& currentLevel) const;

//@}

//! @name Build methods.
//@{

/*! @brief Build aggregates. */
void Build(Level& currentLevel) const;

//@}

private:
void Setup(
const RCP<const Teuchos::Comm<int> >& comm,
const RCP<Xpetra::MultiVector<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType, LO, GO, NO> >&
coords,
const RCP<const Map>& map) const;
RCP<container> Construct1DMap(
const RCP<const Teuchos::Comm<int> >& comm,
const ArrayRCP<
const typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& x)
const;

void BuildGraph(Level& currentLevel, const RCP<Matrix>& A) const;

bool isDirichlet(LocalOrdinal LID) const;
bool isRoot(LocalOrdinal LID) const;
GlobalOrdinal getRoot(LocalOrdinal LID) const;
GlobalOrdinal getAggGID(LocalOrdinal LID) const;

void getIJK(LocalOrdinal LID, int& i, int& j, int& k) const;
void getAggIJK(LocalOrdinal LID, int& i, int& j, int& k) const;

mutable int nDim_;
mutable RCP<container> xMap_, yMap_, zMap_;
mutable ArrayRCP<const typename Teuchos::ScalarTraits<Scalar>::magnitudeType>
x_, y_, z_;
mutable int nx_, ny_, nz_;
mutable int bx_, by_, bz_;
mutable bool dirichletX_, dirichletY_, dirichletZ_;
mutable int naggx_, naggy_, naggz_;

mutable std::map<GlobalOrdinal, GlobalOrdinal> revMap_;
}; // class BrickAggregationFactory

} // namespace MueLu

#define MUELU_BRICKAGGREGATIONFACTORY_SHORT
#endif /* MUELU_BRICKAGGREGATIONFACTORY_DECL_HPP_ */
Loading

0 comments on commit af5dac5

Please sign in to comment.