Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94236448
communication_request.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Dec 5, 00:26
Size
3 KB
Mime Type
text/x-c++
Expires
Sat, Dec 7, 00:26 (1 d, 11 h)
Engine
blob
Format
Raw Data
Handle
22722266
Attached To
rAKA akantu
communication_request.hh
View Options
/**
* Copyright (©) 2010-2023 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* This file is part of Akantu
*
* Akantu is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Akantu is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Akantu. If not, see <http://www.gnu.org/licenses/>.
*/
/* -------------------------------------------------------------------------- */
#include "aka_common.hh"
/* -------------------------------------------------------------------------- */
#include <memory>
/* -------------------------------------------------------------------------- */
#ifndef AKANTU_REAL_STATIC_COMMUNICATOR_HH_
#define AKANTU_REAL_STATIC_COMMUNICATOR_HH_
namespace akantu {
/* -------------------------------------------------------------------------- */
class InternalCommunicationRequest {
public:
InternalCommunicationRequest(Idx source, Idx dest);
virtual ~InternalCommunicationRequest();
virtual void printself(std::ostream & stream, int indent = 0) const;
AKANTU_GET_MACRO(Source, source, Idx);
AKANTU_GET_MACRO(Destination, destination, Idx);
private:
Idx source;
Idx destination;
Idx id;
static Int counter;
};
/* -------------------------------------------------------------------------- */
class CommunicationRequest {
public:
CommunicationRequest(
std::shared_ptr<InternalCommunicationRequest> request = nullptr)
: request(std::move(request)) {}
virtual ~CommunicationRequest() = default;
virtual void free() { request.reset(); }
void printself(std::ostream & stream, int indent = 0) const {
request->printself(stream, indent);
};
Idx getSource() const { return request->getSource(); }
Idx getDestination() const { return request->getDestination(); }
bool isFreed() const { return request == nullptr; }
InternalCommunicationRequest & getInternal() { return *request; }
private:
std::shared_ptr<InternalCommunicationRequest> request;
};
/* -------------------------------------------------------------------------- */
class CommunicationStatus {
public:
AKANTU_GET_MACRO(Source, source, Int);
Int size() const { return size_; }
AKANTU_GET_MACRO(Tag, tag, Int);
AKANTU_SET_MACRO(Source, source, Int);
AKANTU_SET_MACRO(Size, size_, Int);
AKANTU_SET_MACRO(Tag, tag, Int);
private:
Idx source{0};
Int size_{0};
Int tag{0};
};
/* -------------------------------------------------------------------------- */
/// Datatype to pack pairs for MPI_{MIN,MAX}LOC
template <typename T1, typename T2> struct SCMinMaxLoc {
T1 min_max;
T2 loc;
};
} // namespace akantu
#endif /* AKANTU_REAL_STATIC_COMMUNICATOR_HH_ */
Event Timeline
Log In to Comment