Go to the documentation of this file.00001 #ifndef LIBGEODECOMP_PARALLELIZATION_HPXSIMULATOR_UPDATEGROUP_H
00002 #define LIBGEODECOMP_PARALLELIZATION_HPXSIMULATOR_UPDATEGROUP_H
00003
00004 #include <libgeodecomp/config.h>
00005 #ifdef LIBGEODECOMP_WITH_HPX
00006
00007 #include <libgeodecomp/geometry/partitionmanager.h>
00008 #include <libgeodecomp/parallelization/hiparsimulator/stepper.h>
00009 #include <libgeodecomp/parallelization/hpxsimulator/updategroupserver.h>
00010 #include <libgeodecomp/storage/displacedgrid.h>
00011
00012 #include <hpx/apply.hpp>
00013
00014 namespace LibGeoDecomp {
00015 namespace HpxSimulator {
00016
00017 template <class CELL_TYPE, class PARTITION, class STEPPER>
00018 class UpdateGroup
00019 {
00020 friend class boost::serialization::access;
00021 friend class UpdateGroupServer<CELL_TYPE, PARTITION, STEPPER>;
00022 public:
00023 typedef typename STEPPER::Topology Topology;
00024 typedef DisplacedGrid<CELL_TYPE, Topology, true> GridType;
00025 typedef typename STEPPER::PatchType PatchType;
00026 typedef typename STEPPER::PatchProviderPtr PatchProviderPtr;
00027 typedef typename STEPPER::PatchAccepterPtr PatchAccepterPtr;
00028 typedef typename STEPPER::PatchAccepterVec PatchAccepterVec;
00029 typedef typename STEPPER::PatchProviderVec PatchProviderVec;
00030 const static int DIM = Topology::DIM;
00031
00032 typedef
00033 typename DistributedSimulator<CELL_TYPE>::WriterVector
00034 WriterVector;
00035 typedef
00036 typename DistributedSimulator<CELL_TYPE>::SteererVector
00037 SteererVector;
00038
00039 typedef UpdateGroupServer<CELL_TYPE, PARTITION, STEPPER> ComponentType;
00040
00041 typedef std::pair<std::size_t, std::size_t> StepPairType;
00042
00043 UpdateGroup()
00044 {}
00045
00046 UpdateGroup(hpx::id_type thisId)
00047 : thisId(thisId)
00048 {}
00049
00050 struct InitData
00051 {
00052 unsigned loadBalancingPeriod;
00053 unsigned ghostZoneWidth;
00054 boost::shared_ptr<Initializer<CELL_TYPE> > initializer;
00055 WriterVector writers;
00056 SteererVector steerers;
00057 std::vector<CoordBox<DIM> > boundingBoxes;
00058 std::vector<std::size_t> initialWeights;
00059
00060 template <typename ARCHIVE>
00061 void serialize(ARCHIVE& ar, unsigned)
00062 {
00063 ar & loadBalancingPeriod;
00064 ar & ghostZoneWidth;
00065 ar & initializer;
00066 ar & writers;
00067 ar & steerers;
00068 ar & boundingBoxes;
00069 ar & initialWeights;
00070 }
00071 };
00072
00073 hpx::naming::id_type gid() const
00074 {
00075 return thisId;
00076 }
00077
00078 hpx::future<void> setOuterGhostZone(
00079 std::size_t srcRank,
00080 boost::shared_ptr<std::vector<CELL_TYPE> > buffer,
00081 long nanoStep)
00082 {
00083 return
00084 hpx::async<typename ComponentType::SetOuterGhostZoneAction>(
00085 thisId,
00086 srcRank,
00087 buffer,
00088 nanoStep
00089 );
00090 }
00091
00092
00093 private:
00094 hpx::naming::id_type thisId;
00095
00096 template <typename ARCHIVE>
00097 void serialize(ARCHIVE& ar, unsigned)
00098 {
00099 ar & thisId;
00100 }
00101 };
00102
00103 }}
00104
00105 #endif
00106 #endif