[cig-commits] commit by bangerth to /var/svn/dealii/aspect
dealii.demon at gmail.com
dealii.demon at gmail.com
Sun Aug 18 07:19:31 PDT 2013
Revision 1846
More cleanups.
U trunk/aspect/include/aspect/particle/integrator.h
U trunk/aspect/include/aspect/particle/particle.h
U trunk/aspect/include/aspect/particle/world.h
U trunk/aspect/include/aspect/postprocess/tracer.h
U trunk/aspect/source/particle/particle.cc
U trunk/aspect/source/postprocess/tracer.cc
http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=1846&peg=1846
Diff:
Modified: trunk/aspect/include/aspect/particle/integrator.h
===================================================================
--- trunk/aspect/include/aspect/particle/integrator.h 2013-08-18 03:41:30 UTC (rev 1845)
+++ trunk/aspect/include/aspect/particle/integrator.h 2013-08-18 14:18:41 UTC (rev 1846)
@@ -122,7 +122,7 @@
for (it=particles.begin(); it!=particles.end(); ++it)
{
- id_num = it->second.id_num();
+ id_num = it->second.get_id();
loc = it->second.get_location();
vel = it->second.get_velocity();
if (_step == 0)
@@ -234,7 +234,7 @@
for (it=particles.begin(); it!=particles.end(); ++it)
{
- id_num = it->second.id_num();
+ id_num = it->second.get_id();
loc = it->second.get_location();
vel = it->second.get_velocity();
if (_step == 0)
@@ -462,13 +462,13 @@
cur_scheme = select_scheme(cell_vertices, cell_velocities, dt);
}
- _scheme[it->second.id_num()] = cur_scheme;
+ _scheme[it->second.get_id()] = cur_scheme;
}
}
for (it=particles.begin(); it!=particles.end(); ++it)
{
- id_num = it->second.id_num();
+ id_num = it->second.get_id();
loc = it->second.get_location();
vel = it->second.get_velocity();
switch (_scheme[id_num])
Modified: trunk/aspect/include/aspect/particle/particle.h
===================================================================
--- trunk/aspect/include/aspect/particle/particle.h 2013-08-18 03:41:30 UTC (rev 1845)
+++ trunk/aspect/include/aspect/particle/particle.h 2013-08-18 14:18:41 UTC (rev 1846)
@@ -69,7 +69,8 @@
Point<dim> velocity;
// Globally unique ID of particle
- double _id;
+//TODO: make this an unsigned int. but this needs adjustment in data_len, read_data, write_data and all of the places that call write_data and then parse the output...
+ double id;
// Whether this particle is in the local subdomain or not
bool is_local;
@@ -103,50 +104,31 @@
void
set_location (const Point<dim> &new_loc);
- Point<dim> get_location() const
- {
- return location;
- }
+ Point<dim>
+ get_location () const;
- void set_velocity(Point<dim> new_vel)
- {
- velocity = new_vel;
- }
- Point<dim> get_velocity() const
- {
- return velocity;
- }
+ void
+ set_velocity (Point<dim> new_vel);
+ Point<dim>
+ get_velocity () const;
- double id_num() const
- {
- return _id;
- }
+ double
+ get_id () const;
- bool local() const
- {
- return is_local;
- }
- void set_local(bool new_local)
- {
- is_local = new_local;
- }
+ bool
+ local () const;
- bool vel_check() const
- {
- return check_vel;
- }
- void set_vel_check(bool new_vel_check)
- {
- check_vel = new_vel_check;
- }
+ void
+ set_local (bool new_local);
- static void add_mpi_types(std::vector<MPIDataInfo> &data_info)
- {
- // Add the position, velocity, ID
- data_info.push_back(MPIDataInfo("pos", dim, MPI_DOUBLE, sizeof(double)));
- data_info.push_back(MPIDataInfo("velocity", dim, MPI_DOUBLE, sizeof(double)));
- data_info.push_back(MPIDataInfo("id", 1, MPI_DOUBLE, sizeof(double)));
- }
+ bool
+ vel_check () const;
+
+ void
+ set_vel_check (bool new_vel_check);
+
+ static void
+ add_mpi_types (std::vector<MPIDataInfo>& data_info);
};
// A particle with associated values, such as scalars, vectors or tensors
@@ -278,7 +260,7 @@
p (i) = _val[i];
}
- }
+ }
}
#endif
Modified: trunk/aspect/include/aspect/particle/world.h
===================================================================
--- trunk/aspect/include/aspect/particle/world.h 2013-08-18 03:41:30 UTC (rev 1845)
+++ trunk/aspect/include/aspect/particle/world.h 2013-08-18 14:18:41 UTC (rev 1846)
@@ -553,7 +553,7 @@
for (i=0,sit=send_particles.begin(); sit!=send_particles.end(); ++sit,++i)
{
cur_send_ptr = sit->write_data(MPI_DATA, cur_send_ptr);
- cur_send_ptr = integrator->write_data(MPI_DATA, sit->id_num(), cur_send_ptr);
+ cur_send_ptr = integrator->write_data(MPI_DATA, sit->get_id(), cur_send_ptr);
}
// Exchange the particle data between domains
@@ -569,7 +569,7 @@
T recv_particle;
LevelInd found_cell;
cur_recv_ptr = recv_particle.read_data(MPI_DATA, cur_recv_ptr);
- cur_recv_ptr = integrator->read_data(MPI_DATA, recv_particle.id_num(), cur_recv_ptr);
+ cur_recv_ptr = integrator->read_data(MPI_DATA, recv_particle.get_id(), cur_recv_ptr);
found_cell = find_cell(recv_particle, std::make_pair(-1,-1));
if (recv_particle.local())
{
Modified: trunk/aspect/include/aspect/postprocess/tracer.h
===================================================================
--- trunk/aspect/include/aspect/postprocess/tracer.h 2013-08-18 03:41:30 UTC (rev 1845)
+++ trunk/aspect/include/aspect/postprocess/tracer.h 2013-08-18 14:18:41 UTC (rev 1846)
@@ -81,6 +81,11 @@
*/
double next_data_output_time;
+ /**
+ * Compute the next time output should be generated assuming
+ * that output was generated at current_time, and set the result
+ * in the next_data_output_time variable.
+ */
void set_next_data_output_time (const double current_time);
Modified: trunk/aspect/source/particle/particle.cc
===================================================================
--- trunk/aspect/source/particle/particle.cc 2013-08-18 03:41:30 UTC (rev 1845)
+++ trunk/aspect/source/particle/particle.cc 2013-08-18 14:18:41 UTC (rev 1846)
@@ -32,7 +32,7 @@
const double& new_id)
:
location (new_loc),
- _id (new_id),
+ id (new_id),
is_local (true),
check_vel (true)
{
@@ -45,7 +45,7 @@
:
location (),
velocity (),
- _id (0),
+ id (0),
is_local (true),
check_vel (true)
{
@@ -96,7 +96,7 @@
memcpy (p, &val, sizeof(double));
p += sizeof(double);
}
- double val = _id;
+ double val = id;
memcpy (p, &val, sizeof(double));
p += sizeof(double);
break;
@@ -134,7 +134,7 @@
}
double val;
memcpy (&val, p, sizeof(double));
- _id = val;
+ id = val;
p += sizeof(double);
break;
}
@@ -156,6 +156,85 @@
}
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ Point<dim>
+ BaseParticle<dim>::get_location () const
+ {
+ return location;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ void
+ BaseParticle<dim>::set_velocity (Point<dim> new_vel)
+ {
+ velocity = new_vel;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ Point<dim>
+ BaseParticle<dim>::get_velocity () const
+ {
+ return velocity;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ double
+ BaseParticle<dim>::get_id () const
+ {
+ return id;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ bool
+ BaseParticle<dim>::local () const
+ {
+ return is_local;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ void
+ BaseParticle<dim>::set_local (bool new_local)
+ {
+ is_local = new_local;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ bool
+ BaseParticle<dim>::vel_check () const
+ {
+ return check_vel;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ void
+ BaseParticle<dim>::set_vel_check (bool new_vel_check)
+ {
+ check_vel = new_vel_check;
+ }
+
+ // Base class of particles - represents a particle with position, velocity, and an ID number
+ template <int dim>
+ void
+ BaseParticle<dim>::add_mpi_types (std::vector<MPIDataInfo>& data_info)
+ {
+ // Add the position, velocity, ID
+ data_info.push_back (
+ MPIDataInfo ("pos", dim, MPI_DOUBLE, sizeof(double)));
+ data_info.push_back (
+ MPIDataInfo ("velocity", dim, MPI_DOUBLE, sizeof(double)));
+ data_info.push_back (MPIDataInfo ("id", 1, MPI_DOUBLE, sizeof(double)));
+ }
+
+
+
// explicit instantiation
template class BaseParticle<2>;
template class BaseParticle<3>;
Modified: trunk/aspect/source/postprocess/tracer.cc
===================================================================
--- trunk/aspect/source/postprocess/tracer.cc 2013-08-18 03:41:30 UTC (rev 1845)
+++ trunk/aspect/source/postprocess/tracer.cc 2013-08-18 14:18:41 UTC (rev 1846)
@@ -114,7 +114,9 @@
if (data_output_interval > 0)
{
// the current time is always in seconds, so we need to convert the output_interval to the same unit
- double output_interval_in_s = (this->convert_output_to_years()) ? (data_output_interval*year_in_seconds) : data_output_interval;
+ const double output_interval_in_s = (this->convert_output_to_years() ?
+ (data_output_interval*year_in_seconds) :
+ data_output_interval);
// we need to compute the smallest integer that is bigger than current_time/my_output_interval,
// even if it is a whole number already (otherwise we output twice in a row)
More information about the CIG-COMMITS
mailing list