19 #ifndef GEOSX_MANAGERS_FIELDSPECIFICATION_FIELDSPECIFICATIONOPS_HPP 20 #define GEOSX_MANAGERS_FIELDSPECIFICATION_FIELDSPECIFICATIONOPS_HPP 39 template<
typename T,
typename U >
41 void apply( T & lhs, U
const & rhs )
43 lhs =
static_cast< T
>( rhs );
59 template<
typename T,
typename U >
61 void apply( T & lhs, U
const & rhs )
63 lhs +=
static_cast< T
>( rhs );
70 template<
typename OP >
87 template<
typename T >
89 static inline typename std::enable_if< !traits::is_tensorT< T >,
void >::type
96 OP::template
apply( field( index ), value );
111 template<
typename T >
113 static inline typename std::enable_if< traits::is_tensorT< T >,
void >::type
119 OP::template
apply( field( index )[component], value );
133 template<
typename T >
135 static inline typename std::enable_if< !traits::is_tensorT< T >,
void >::type
142 OP::template
apply( value, field( index ) );
156 template<
typename T >
158 static inline typename std::enable_if< traits::is_tensorT< T >,
void >::type
164 OP::template
apply( value, field( index )[component] );
179 template<
typename T,
int USD >
181 static inline typename std::enable_if< !traits::is_tensorT< T >,
void >::type
189 OP::template
apply( field( index, component ), value );
195 OP::template
apply( field( index, a ), value );
213 template<
typename T,
int USD >
215 static inline typename std::enable_if< traits::is_tensorT< T >,
void >::type
225 OP::template
apply( field( index, a )[component], value );
234 OP::template
apply( field( index, a )[c], value );
252 template<
typename T,
int USD >
254 static inline typename std::enable_if< !traits::is_tensorT< T >,
void >::type
261 OP::template
apply( value, field( index, component ) );
274 template<
typename T,
int USD >
276 static inline typename std::enable_if< traits::is_tensorT< T >,
void >::type
286 GEOSX_ERROR(
"ReadFieldValue: unsupported operation" );
301 template<
typename T,
int USD >
303 static inline typename std::enable_if< !traits::is_tensorT< T >,
void >::type
313 OP::template
apply( field( index, a, component ), value );
322 OP::template
apply( field( index, a, b ), value );
341 template<
typename T,
int USD >
343 static inline typename std::enable_if< traits::is_tensorT< T >,
void >::type
355 OP::template
apply( field( index, a, b )[component], value );
367 OP::template
apply( field( index, a, b )[c], value );
383 template<
typename T,
int USD >
395 GEOSX_ERROR(
"ReadFieldValue: unsupported operation" );
409 using base_type::SpecifyFieldValue;
428 template<
typename LAI >
435 if( matrix.getLocalRowID( dof ) >= 0 )
437 real64 const diag = matrix.clearRow( dof,
true );
438 rhs = -diag * (bcValue - fieldValue);
474 if( localRow >= 0 && localRow < matrix.
numRows() )
483 if( columns[ j ] == dof )
484 { diagonal = entries[ j ]; }
486 { entries[ j ] = 0; }
489 rhs = -diagonal * (bcValue - fieldValue);
504 template<
typename LAI >
512 if( rhs.getLocalRowID( dof[a] ) >= 0 )
514 rhs.set( dof[a], values[a] );
527 template<
typename POLICY >
536 globalIndex const localRow = dof[ a ] - dofRankOffset;
537 if( localRow >= 0 && localRow < rhs.
size() )
538 { rhs[ localRow ] = values[ a ]; }
552 using base_type::SpecifyFieldValue;
587 template<
typename LAI >
593 rhs.add( dof, values, num );
604 template<
typename POLICY >
613 globalIndex const localRow = dof[ a ] - dofRankOffset;
614 if( localRow >= 0 && localRow < rhs.
size() )
615 { rhs[ localRow ] += values[ a ]; }
623 #endif //GEOSX_MANAGERS_FIELDSPECIFICATION_FIELDSPECIFICATIONOPS_HPP #define GEOSX_HOST_DEVICE
Marks a host-device function.
static GEOSX_HOST_DEVICE std::enable_if< !traits::is_tensorT< T >, void >::type SpecifyFieldValue(arrayView3d< T, USD > const &field, localIndex const index, integer const component, real64 const value)
Pointwise application of a value to a field variable.
INDEX_TYPE_NC numNonZeros() const
static GEOSX_HOST_DEVICE void ReadFieldValue(arrayView3d< T const, USD > const &field, localIndex const index, integer const component, real64 &value)
This function is not meaningful. It exists for generic purposes, but will result in an error if calle...
static GEOSX_HOST_DEVICE void apply(T &lhs, U const &rhs)
Pointwise set of a value.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
This class serves to provide a sliced multidimensional interface to the family of LvArray classes...
INDEX_TYPE size() const noexcept
LAInterface::ParallelVector ParallelVector
Alias for ParallelVector.
OpAdd Operator that adds a value.
static void PrescribeRhsValues(typename LAI::ParallelVector &rhs, localIndex const num, globalIndex *const dof, real64 *const values)
Function to add some values of a vector.
static GEOSX_HOST_DEVICE std::enable_if< !traits::is_tensorT< T >, void >::type ReadFieldValue(arrayView2d< T const, USD > const &field, localIndex const index, integer const component, real64 &value)
Read value from a 2d field.
This class serves to provide a "view" of a multidimensional array.
constexpr INDEX_TYPE_NC numRows() const
static GEOSX_HOST_DEVICE std::enable_if< traits::is_tensorT< T >, void >::type SpecifyFieldValue(arrayView3d< T, USD > const &field, localIndex const index, integer const component, real64 const value)
Pointwise application of a value to a field variable.
double real64
64-bit floating point type.
#define GEOSX_ASSERT_EQ(lhs, rhs)
Assert that two values compare equal in debug builds.
static GEOSX_HOST_DEVICE std::enable_if< traits::is_tensorT< T >, void >::type ReadFieldValue(arrayView2d< T const, USD > const &field, localIndex const index, integer const component, real64 &value)
This function is not meaningful. It exists for generic purposes, but will result in an error if calle...
constexpr ArraySlice< COL_TYPE const, 1, 0, INDEX_TYPE_NC > getColumns(INDEX_TYPE const row) const
ArraySlice< T, 1, 0, INDEX_TYPE_NC > getEntries(INDEX_TYPE const row) const
OpEqual Operator that sets a value.
static void PrescribeRhsValues(typename LAI::ParallelVector &rhs, localIndex const num, globalIndex *const dof, real64 *const values)
Function to add some values of a vector.
static GEOSX_HOST_DEVICE void apply(T &lhs, U const &rhs)
Pointwise update of a value.
static GEOSX_HOST_DEVICE void SpecifyFieldValue(globalIndex const dof, globalIndex const dofRankOffset, CRSMatrixView< real64, globalIndex const > const &matrix, real64 &rhs, real64 const bcValue, real64 const fieldValue)
Function to apply a value to a vector field for a single dof.
std::int32_t integer
Signed integer type.
#define GEOSX_ERROR(msg)
Raise a hard error and terminate the program.
static GEOSX_HOST_DEVICE std::enable_if< !traits::is_tensorT< T >, void >::type ReadFieldValue(arrayView1d< T const > const &field, localIndex const index, integer const component, real64 &value)
Read a field value.
static GEOSX_HOST_DEVICE std::enable_if< !traits::is_tensorT< T >, void >::type SpecifyFieldValue(arrayView2d< T, USD > const &field, localIndex const index, integer const component, real64 const value)
Pointwise application of a value to a field variable.
#define GEOSX_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
static GEOSX_HOST_DEVICE std::enable_if< !traits::is_tensorT< T >, void >::type SpecifyFieldValue(arrayView1d< T > const &field, localIndex const index, integer const component, real64 const value)
Pointwise application of a value to a field.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
#define GEOSX_ASSERT(EXP)
Assert a condition in debug builds.
static void SpecifyFieldValue(globalIndex const dof, typename LAI::ParallelMatrix &matrix, real64 &rhs, real64 const bcValue, real64 const fieldValue)
Function to apply a Dirichlet like boundary condition to a single dof in a system of equations...
LAInterface::ParallelMatrix ParallelMatrix
Alias for ParallelMatrix.
static GEOSX_HOST_DEVICE std::enable_if< traits::is_tensorT< T >, void >::type ReadFieldValue(arrayView1d< T const > const &field, localIndex const index, integer const component, real64 &value)
Read a field value.
static GEOSX_HOST_DEVICE std::enable_if< traits::is_tensorT< T >, void >::type SpecifyFieldValue(arrayView2d< T, USD > const &field, localIndex const index, integer const component, real64 const value)
Pointwise application of a value to a field variable.
static void PrescribeRhsValues(arrayView1d< real64 > const &rhs, arrayView1d< globalIndex const > const &dof, globalIndex const dofRankOffset, arrayView1d< real64 const > const &values)
Function to add some values of a vector.
static GEOSX_HOST_DEVICE void SpecifyFieldValue(globalIndex const dof, globalIndex const dofRankOffset, CRSMatrixView< real64, globalIndex const > const &matrix, real64 &rhs, real64 const bcValue, real64 const fieldValue)
Function to apply a Dirichlet like boundary condition to a single dof in a system of equations...
static GEOSX_HOST_DEVICE std::enable_if< traits::is_tensorT< T >, void >::type SpecifyFieldValue(arrayView1d< T > const &field, localIndex const index, integer const component, real64 const value)
Pointwise application of value to a field variable.
static void PrescribeRhsValues(arrayView1d< real64 > const &rhs, arrayView1d< globalIndex const > const &dof, globalIndex const dofRankOffset, arrayView1d< real64 const > const &values)
Function to add some values of a vector.