A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
mpi
model
remote-channel-bundle.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright 2013. Lawrence Livermore National Security, LLC.
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Steven Smith <smith84@llnl.gov>
19
*
20
*/
21
22
#include "
remote-channel-bundle.h
"
23
24
#include "
null-message-mpi-interface.h
"
25
#include "
null-message-simulator-impl.h
"
26
27
#include <ns3/simulator.h>
28
29
namespace
ns3
{
30
31
#define NS_TIME_INFINITY ns3::Time (0x7fffffffffffffffLL)
32
33
TypeId
RemoteChannelBundle::GetTypeId
(
void
)
34
{
35
static
TypeId
tid =
TypeId
(
"ns3::RemoteChannelBundle"
)
36
.
SetParent
<
Object
> ()
37
.SetGroupName (
"Mpi"
)
38
.AddConstructor <
RemoteChannelBundle
> ();
39
return
tid;
40
}
41
42
RemoteChannelBundle::RemoteChannelBundle
()
43
: m_remoteSystemId (UINT32_MAX),
44
m_guaranteeTime (0),
45
m_delay (
NS_TIME_INFINITY
)
46
{
47
}
48
49
RemoteChannelBundle::RemoteChannelBundle
(
const
uint32_t remoteSystemId)
50
: m_remoteSystemId (remoteSystemId),
51
m_guaranteeTime (0),
52
m_delay (
NS_TIME_INFINITY
)
53
{
54
}
55
56
void
57
RemoteChannelBundle::AddChannel
(
Ptr<Channel>
channel
,
Time
delay)
58
{
59
m_channels
[
channel
->GetId ()] =
channel
;
60
m_delay
=
ns3::Min
(
m_delay
, delay);
61
}
62
63
uint32_t
64
RemoteChannelBundle::GetSystemId
()
const
65
{
66
return
m_remoteSystemId
;
67
}
68
69
Time
70
RemoteChannelBundle::GetGuaranteeTime
(
void
)
const
71
{
72
return
m_guaranteeTime
;
73
}
74
75
void
76
RemoteChannelBundle::SetGuaranteeTime
(
Time
time)
77
{
78
NS_ASSERT
(time >=
Simulator::Now
());
79
80
m_guaranteeTime
= time;
81
}
82
83
Time
84
RemoteChannelBundle::GetDelay
(
void
)
const
85
{
86
return
m_delay
;
87
}
88
89
void
90
RemoteChannelBundle::SetEventId
(
EventId
id
)
91
{
92
m_nullEventId
= id;
93
}
94
95
EventId
96
RemoteChannelBundle::GetEventId
(
void
)
const
97
{
98
return
m_nullEventId
;
99
}
100
101
std::size_t
102
RemoteChannelBundle::GetSize
(
void
)
const
103
{
104
return
m_channels
.size ();
105
}
106
107
void
108
RemoteChannelBundle::Send
(
Time
time)
109
{
110
NullMessageMpiInterface::SendNullMessage
(time,
this
);
111
}
112
113
std::ostream&
operator<<
(std::ostream& out,
ns3::RemoteChannelBundle
& bundle )
114
{
115
out <<
"RemoteChannelBundle Rank = "
<< bundle.
m_remoteSystemId
116
<<
", GuaranteeTime = "
<< bundle.
m_guaranteeTime
117
<<
", Delay = "
<< bundle.
m_delay
<< std::endl;
118
119
for
(std::map < uint32_t,
Ptr < Channel >
> ::const_iterator pair = bundle.
m_channels
.begin ();
120
pair != bundle.
m_channels
.end ();
121
++pair)
122
{
123
out <<
"\t"
<< (*pair).second << std::endl;
124
}
125
126
return
out;
127
}
128
129
130
}
// namespace ns3
131
ns3::RemoteChannelBundle::RemoteChannelBundle
RemoteChannelBundle()
Definition:
remote-channel-bundle.cc:42
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
null-message-simulator-impl.h
ns3::RemoteChannelBundle::SetGuaranteeTime
void SetGuaranteeTime(Time time)
Definition:
remote-channel-bundle.cc:76
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:67
ns3::RemoteChannelBundle::GetSystemId
uint32_t GetSystemId() const
Definition:
remote-channel-bundle.cc:64
ns3::RemoteChannelBundle
Collection of NS3 channels between local and remote nodes.
Definition:
remote-channel-bundle.h:45
ns3::RemoteChannelBundle::m_nullEventId
EventId m_nullEventId
Definition:
remote-channel-bundle.h:145
ns3::RemoteChannelBundle::Send
void Send(Time time)
Definition:
remote-channel-bundle.cc:108
third.channel
channel
Definition:
third.py:85
ns3::RemoteChannelBundle::GetSize
std::size_t GetSize(void) const
Definition:
remote-channel-bundle.cc:102
ns3::RemoteChannelBundle::GetGuaranteeTime
Time GetGuaranteeTime(void) const
Definition:
remote-channel-bundle.cc:70
ns3::Min
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition:
int64x64.h:197
ns3::RemoteChannelBundle::AddChannel
void AddChannel(Ptr< Channel > channel, Time delay)
Definition:
remote-channel-bundle.cc:57
ns3::NullMessageMpiInterface::SendNullMessage
static void SendNullMessage(const Time &guaranteeUpdate, Ptr< RemoteChannelBundle > bundle)
Send a Null Message to across the specified bundle.
Definition:
null-message-mpi-interface.cc:243
ns3::RemoteChannelBundle::m_channels
std::map< uint32_t, Ptr< Channel > > m_channels
Definition:
remote-channel-bundle.h:128
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition:
angles.cc:42
ns3::RemoteChannelBundle::GetEventId
EventId GetEventId(void) const
Definition:
remote-channel-bundle.cc:96
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
NS_TIME_INFINITY
#define NS_TIME_INFINITY
Definition:
remote-channel-bundle.cc:31
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition:
simulator.cc:249
remote-channel-bundle.h
null-message-mpi-interface.h
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:53
ns3::RemoteChannelBundle::SetEventId
void SetEventId(EventId id)
Set the event ID of the Null Message send event current scheduled for this channel.
Definition:
remote-channel-bundle.cc:90
ns3::RemoteChannelBundle::m_remoteSystemId
uint32_t m_remoteSystemId
Definition:
remote-channel-bundle.h:121
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
ns3::RemoteChannelBundle::GetDelay
Time GetDelay(void) const
Definition:
remote-channel-bundle.cc:84
ns3::RemoteChannelBundle::GetTypeId
static TypeId GetTypeId(void)
Definition:
remote-channel-bundle.cc:33
ns3::RemoteChannelBundle::m_delay
Time m_delay
Definition:
remote-channel-bundle.h:140
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::RemoteChannelBundle::m_guaranteeTime
Time m_guaranteeTime
Definition:
remote-channel-bundle.h:135
Generated on Wed Nov 7 2018 10:02:06 for ns-3 by
1.8.14