41 #include "DTK_EntityCenteredField.hpp" 49 const Teuchos::ArrayView<Entity> &entities,
const int field_dim,
50 const Teuchos::ArrayRCP<double> &dof_data,
const DataLayout layout )
51 : d_field_dim( field_dim )
55 d_lda = entities.size();
56 DTK_CHECK( dof_data.size() == d_lda * d_field_dim );
58 d_support_ids.resize( d_lda );
59 for (
int n = 0; n < d_lda; ++n )
61 d_support_ids[n] = entities[n].id();
62 d_id_map.emplace( d_support_ids[n], n );
69 const Teuchos::ArrayView<const EntityId> &entity_ids,
const int field_dim,
70 const Teuchos::ArrayRCP<double> &dof_data,
const DataLayout layout )
71 : d_field_dim( field_dim )
75 d_lda = entity_ids.size();
76 DTK_CHECK( dof_data.size() == d_lda * d_field_dim );
78 d_support_ids.resize( d_lda );
79 for (
int n = 0; n < d_lda; ++n )
81 d_support_ids[n] = entity_ids[n];
82 d_id_map.emplace( d_support_ids[n], n );
92 Teuchos::ArrayView<const SupportId>
95 return d_support_ids();
104 DTK_REQUIRE( d_id_map.count( support_id ) );
105 int local_id = d_id_map.find( support_id )->second;
106 return ( BLOCKED == d_layout ) ? d_data[dimension * d_lda + local_id]
107 : d_data[local_id * d_field_dim +
dimension];
117 int local_id = d_id_map.find( support_id )->second;
121 d_data[dimension * d_lda + local_id] = data;
124 d_data[local_id * d_field_dim +
dimension] = data;
DataLayout
Blocked/Interleaved data layout enum.
void writeFieldData(const SupportId support_id, const int dimension, const double data)
Given a local dof id, dimension, and field value, write data into the application field...
Teuchos::ArrayView< const SupportId > getLocalSupportIds() const
Get the locally-owned support location ids of the field.
unsigned long int SupportId
Support id type.
Assertions and Design-by-Contract for error handling.
int dimension() const
Get the dimension of the field.
double readFieldData(const SupportId support_id, const int dimension) const
Given a local dof id and a dimension, read data from the application field.
EntityCenteredField(const Teuchos::ArrayView< Entity > &entities, const int field_dim, const Teuchos::ArrayRCP< double > &dof_data, const DataLayout layout)
Entity constructor.