Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91513474
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
Mon, Nov 11, 19:42
Size
864 B
Mime Type
text/x-c
Expires
Wed, Nov 13, 19:42 (2 d)
Engine
blob
Format
Raw Data
Handle
22276322
Attached To
R9490 Homework_sp4e_Peruzzo_SáezUribe
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