Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90861707
compute_boundary.cc
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
Tue, Nov 5, 10:59
Size
864 B
Mime Type
text/x-c
Expires
Thu, Nov 7, 10:59 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22140784
Attached To
R7561 SP4E_HW1
compute_boundary.cc
View Options
#include "compute_boundary.hh"
/* -------------------------------------------------------------------------- */
ComputeBoundary
::
ComputeBoundary
(
const
Vector
&
xmin
,
const
Vector
&
xmax
)
:
xmin
(
xmin
),
xmax
(
xmax
)
{
Vector
d
=
xmax
-
xmin
;
for
(
UInt
i
=
0
;
i
<
Vector
::
dim
;
++
i
)
if
(
d
[
i
]
<
0
)
{
std
::
cout
<<
"XMax and XMin do not form a domain range"
<<
std
::
endl
;
std
::
exit
(
1
);
}
}
/* -------------------------------------------------------------------------- */
void
ComputeBoundary
::
compute
(
System
&
system
)
{
for
(
auto
&
par
:
system
)
{
auto
&
x
=
par
.
getPosition
();
auto
&
v
=
par
.
getVelocity
();
Vector
d1
=
xmax
-
x
,
d2
=
x
-
xmin
;
for
(
UInt
i
=
0
;
i
<
Vector
::
dim
;
++
i
)
{
if
(
d1
[
i
]
<
0
or
d2
[
i
]
<
0
)
v
[
i
]
*=
-
1
;
}
}
}
/* -------------------------------------------------------------------------- */
Event Timeline
Log In to Comment