Advanced Multi-Physics (AMP)
On-Line Documentation
WeldOperator.h
Go to the documentation of this file.
1
2#ifndef included_AMP_WeldOperator
3#define included_AMP_WeldOperator
4
5#include "AMP/utils/AMP_MPI.h"
6#include "AMP/utils/Database.h"
7
8#include <memory>
9
10#include "AMP/operators/Operator.h"
11#include "AMP/vectors/Variable.h"
12#include "AMP/vectors/Vector.h"
13#include <string>
14
15#ifdef DEBUG_CHECK_ASSERTIONS
16
17#endif
18
19namespace AMP::Operator {
20
21class WeldOperator : public Operator
22{
23
24public:
25 WeldOperator( std::shared_ptr<const OperatorParameters> params ) : Operator( params ) {}
26
27 virtual ~WeldOperator() {}
28
29 std::string type() const override { return "WeldOperator"; }
30
31 virtual void reset( std::shared_ptr<const OperatorParameters> params ) { (void) params; }
32
36 const double a = -1.0,
37 const double b = 1.0 )
38 {
39 auto inVec = u->subsetVectorForVariable( d_inpVar );
40
41 auto dof_map = d_MeshAdapter->getDOFMap( d_inpVar );
42
43 auto bnd = d_MeshAdapter->beginOwnedBoundary( d_inputBoundaryId );
44 auto end_bnd = d_MeshAdapter->endOwnedBoundary( d_inputBoundaryId );
45
46 double val = 0.;
47 int cnt = 0;
48 for ( ; bnd != end_bnd; ++bnd ) {
49 std::vector<unsigned int> bndGlobalIds;
50 std::vector<unsigned int> singleton( 1 );
51 singleton[0] = 2;
52 dof_map->getDOFs( *bnd, bndGlobalIds, singleton );
53 val = inVec->getLocalValueByGlobalID( bndGlobalIds[0] );
54 cnt++;
55 } // end for bnd
56 AMP_ASSERT( ( cnt == 0 ) or ( cnt == 1 ) );
57 // d_comm is constructed so that rank 0 has the input boundary
58 // MPI_Bcast(&val, 1, MPI_DOUBLE, 0, d_comm);
59 val = d_comm.bcast( val, 0 );
60 d_outVec->setToScalar( val );
61 }
62
63 unsigned int d_inputBoundaryId;
64 std::shared_ptr<AMP::LinearAlgebra::Variable> d_inpVar;
67};
68} // namespace AMP::Operator
69
70#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
type bcast(const type &value, int root) const
Broadcast.
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
std::shared_ptr< const Vector > const_shared_ptr
Definition Vector.h:65
std::shared_ptr< AMP::Operator::Operator > shared_ptr
Definition Operator.h:29
AMP::LinearAlgebra::Vector::shared_ptr d_outVec
virtual void apply(AMP::LinearAlgebra::Vector::const_shared_ptr f, AMP::LinearAlgebra::Vector::const_shared_ptr u, AMP::LinearAlgebra::Vector::shared_ptr r, const double a=-1.0, const double b=1.0)
std::string type() const override
Return the name of the operator.
virtual void reset(std::shared_ptr< const OperatorParameters > params)
WeldOperator(std::shared_ptr< const OperatorParameters > params)
std::shared_ptr< AMP::LinearAlgebra::Variable > d_inpVar
#define AMP_ASSERT(EXP)
Assert error.



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page