Skip to content

Commit

Permalink
derive key data structures from ParallelObject
Browse files Browse the repository at this point in the history
  • Loading branch information
benkirk committed Apr 8, 2013
1 parent 4b83930 commit 30c0367
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 11 deletions.
10 changes: 7 additions & 3 deletions include/base/dof_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "libmesh/threads_allocators.h"
#include "libmesh/elem_range.h"
#include "libmesh/sparsity_pattern.h"
#include "libmesh/parallel_object.h"

// C++ Includes -----------------------------------
#include <algorithm>
Expand Down Expand Up @@ -139,16 +140,19 @@ class NodeConstraints : public std::map<const Node *,
*
* @author Benjamin S. Kirk, 2002-2007
*/
class DofMap : public ReferenceCountedObject<DofMap>
class DofMap : public ReferenceCountedObject<DofMap>,
public ParallelObject
{
public:

/**
* Constructor. Requires the number of the system for which we
* will be numbering degrees of freedom.
* will be numbering degrees of freedom & the parent object
* we are contained in, which defines our communication space.
*/
explicit
DofMap(const unsigned int sys_number);
DofMap(const unsigned int sys_number,
const ParallelObject &parent_decomp);

/**
* Destructor.
Expand Down
11 changes: 10 additions & 1 deletion include/parallel/parallel_object.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The libMesh Finite Element Library.
// Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// Copyright (C) 2002-2013 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner

// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -44,6 +44,8 @@ namespace libMesh
* that are expected to be implemented in paralel. Each
* \p ParalelObject *requires* a \p Parallel::Communicator object
* for construction.
*
* \author Benjamin S. Kirk, 2013.
*/
class ParallelObject
{
Expand All @@ -57,6 +59,13 @@ namespace libMesh
_communicator(comm)
{}

/**
* Copy Constructor.
*/
ParallelObject (const ParallelObject &other) :
_communicator(other._communicator)
{}

/**
* Destructor. Virtual because we are a base class.
*/
Expand Down
5 changes: 4 additions & 1 deletion include/systems/equation_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "libmesh/parameters.h"
#include "libmesh/system.h"
#include "libmesh/enum_xdr_mode.h"
#include "libmesh/parallel_object.h"

// HP aCC needs these for some reason
#ifdef __HP_aCC
Expand Down Expand Up @@ -64,7 +65,9 @@ class MeshBase;

// ------------------------------------------------------------
// EquationSystems class definition
class EquationSystems : public ReferenceCountedObject<EquationSystems>
class EquationSystems : public ReferenceCountedObject<EquationSystems>,
public ParallelObject

{
public:

Expand Down
4 changes: 3 additions & 1 deletion include/systems/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "libmesh/reference_counted_object.h"
#include "libmesh/variable.h"
#include "libmesh/fem_function_base.h"
#include "libmesh/parallel_object.h"

// C++ includes
#include <cstddef>
Expand Down Expand Up @@ -75,7 +76,8 @@ class SystemSubset;

// ------------------------------------------------------------
// System class definition
class System : public ReferenceCountedObject<System>
class System : public ReferenceCountedObject<System>,
public ParallelObject
{
public:

Expand Down
4 changes: 3 additions & 1 deletion src/base/dof_map.C
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ AutoPtr<SparsityPattern::Build> DofMap::build_sparsity



DofMap::DofMap(const unsigned int number) :
DofMap::DofMap(const unsigned int number,
const ParallelObject &parent_decomp) :
ParallelObject (parent_decomp),
_dof_coupling(NULL),
_variables(),
_variable_groups(),
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/mesh_base.C
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ MeshBase::MeshBase (unsigned int d,


MeshBase::MeshBase (const MeshBase& other_mesh) :
ParallelObject (other_mesh.communicator()),
ParallelObject (other_mesh),
boundary_info (new BoundaryInfo(*this)),
_n_parts (other_mesh._n_parts),
_dim (other_mesh._dim),
Expand Down
5 changes: 3 additions & 2 deletions src/systems/equation_systems.C
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ namespace libMesh
// ------------------------------------------------------------
// EquationSystems class implementation
EquationSystems::EquationSystems (MeshBase& m, MeshData* mesh_data) :
_mesh (m),
_mesh_data (mesh_data)
ParallelObject (m),
_mesh (m),
_mesh_data (mesh_data)
{
// Set default parameters
this->parameters.set<Real> ("linear solver tolerance") = TOLERANCE * TOLERANCE;
Expand Down
4 changes: 3 additions & 1 deletion src/systems/system.C
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ System::System (EquationSystems& es,
const std::string& name_in,
const unsigned int number_in) :

ParallelObject (es),
assemble_before_solve (true),
use_fixed_solution (false),
extra_quadrature_order (0),
Expand All @@ -73,7 +74,7 @@ System::System (EquationSystems& es,
_qoi_evaluate_object (NULL),
_qoi_evaluate_derivative_function (NULL),
_qoi_evaluate_derivative_object (NULL),
_dof_map (new DofMap(number_in)),
_dof_map (new DofMap(number_in, *this)),
_equation_systems (es),
_mesh (es.get_mesh()),
_sys_name (name_in),
Expand All @@ -92,6 +93,7 @@ System::System (EquationSystems& es,
// No copy construction of System objects!
System::System (const System& other) :
ReferenceCountedObject<System>(),
ParallelObject(other),
_equation_systems(other._equation_systems),
_mesh(other._mesh),
_sys_number(other._sys_number)
Expand Down

0 comments on commit 30c0367

Please sign in to comment.