77 double localSum2 = 0.0;
78 double globalSum2 = 0.0;
80 for (
int i = 0; i < vec.size(); i++) {
81 localSum2 += vec(i) * vec(i);
102 return sqrt(globalSum2);
110 return vec1.dot(vec2);
115 PRECICE_ASSERT(vec1.size() == vec2.size(), vec1.size(), vec2.size());
116 double localSum = 0.0;
117 double globalSum = 0.0;
119 for (
int i = 0; i < vec1.size(); i++) {
120 localSum += vec1(i) * vec2(i);
181 reduceSum(precice::refToSpan<const double>(sendData),
182 precice::refToSpan<double>(rcvData));
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#define PRECICE_ASSERT(...)
A C++ 11 implementation of the non-owning C++20 std::span type.
constexpr iterator begin() const noexcept
constexpr iterator end() const noexcept
static bool _isPrimaryRank
True if this process is running the primary rank.
static void barrier()
Synchronizes all ranks.
static void allreduceSum(precice::span< const double > sendData, precice::span< double > rcvData)
static bool _isSecondaryRank
True if this process is running a secondary rank.
static int _size
Number of ranks. This includes ranks from both participants, e.g. minimal size is 2.
static int getSize()
Number of ranks. This includes ranks from both participants, e.g. minimal size is 2.
static double l2norm(const Eigen::VectorXd &vec)
The l2 norm of a vector is calculated on distributed data.
static Rank getRank()
Current rank.
static double dot(const Eigen::VectorXd &vec1, const Eigen::VectorXd &vec2)
static bool isPrimary()
True if this process is running the primary rank.
static void broadcast(bool &value)
static com::PtrCommunication _communication
Intra-participant communication.
static Rank _rank
Current rank.
static bool isParallel()
True if this process is running in parallel.
static void synchronize()
static bool isSecondary()
True if this process is running a secondary rank.
static logging::Logger _log
static void configure(Rank rank, int size)
Configures the intra-participant communication.
static void reduceSum(precice::span< const double > sendData, precice::span< double > rcvData)
std::shared_ptr< Communication > PtrCommunication
Main namespace of the precice library.
bool syncMode
Enabled further inter- and intra-solver synchronisation.