libMesh::VectorSetAction< Val > Class Template Reference

Public Member Functions

 VectorSetAction (NumericVector< Val > &target_vec)
 
void insert (const FEMContext &c, unsigned int var_num, const DenseVector< Val > &Ue)
 

Private Attributes

NumericVector< Val > & target_vector
 

Detailed Description

template<typename Val>
class libMesh::VectorSetAction< Val >

This action class can be used with a GenericProjector to set projection values (which must be of type Val) as coefficients of the given NumericVector.

Definition at line 107 of file system_projection.C.

Constructor & Destructor Documentation

template<typename Val>
libMesh::VectorSetAction< Val >::VectorSetAction ( NumericVector< Val > &  target_vec)
inline

Definition at line 113 of file system_projection.C.

113  :
114  target_vector(target_vec) {}
NumericVector< Val > & target_vector

Member Function Documentation

template<typename Val>
void libMesh::VectorSetAction< Val >::insert ( const FEMContext c,
unsigned int  var_num,
const DenseVector< Val > &  Ue 
)
inline

Definition at line 116 of file system_projection.C.

References libMesh::NumericVector< T >::first_local_index(), libMesh::DiffContext::get_dof_indices(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::set(), libMesh::DenseVector< T >::size(), and libMesh::Threads::spin_mtx.

119  {
120  const numeric_index_type
123 
124  const std::vector<dof_id_type> & dof_indices =
125  c.get_dof_indices(var_num);
126 
127  unsigned int size = Ue.size();
128 
129  libmesh_assert_equal_to(size, dof_indices.size());
130 
131  // Lock the new vector since it is shared among threads.
132  {
133  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
134 
135  for (unsigned int i = 0; i != size; ++i)
136  if ((dof_indices[i] >= first) && (dof_indices[i] < last))
137  target_vector.set(dof_indices[i], Ue(i));
138  }
139  }
virtual numeric_index_type last_local_index() const =0
NumericVector< Val > & target_vector
spin_mutex spin_mtx
Definition: threads.C:29
dof_id_type numeric_index_type
Definition: id_types.h:92
virtual numeric_index_type first_local_index() const =0
virtual void set(const numeric_index_type i, const T value)=0

Member Data Documentation

template<typename Val>
NumericVector<Val>& libMesh::VectorSetAction< Val >::target_vector
private

Definition at line 110 of file system_projection.C.


The documentation for this class was generated from the following file: