www.mooseframework.org
Public Types | Public Member Functions | Private Attributes | List of all members
MultiAppDTKUserObjectEvaluator Class Reference

Evaluates the specified UserObject and returns the result in a DTK FieldContainer. More...

#include <MultiAppDTKUserObjectEvaluator.h>

Inheritance diagram for MultiAppDTKUserObjectEvaluator:
[legend]

Public Types

typedef long unsigned int GlobalOrdinal
 

Public Member Functions

 MultiAppDTKUserObjectEvaluator (MultiApp &multi_app, const std::string &user_object_name)
 
 ~MultiAppDTKUserObjectEvaluator ()
 
DataTransferKit::FieldContainer< double > evaluate (const Teuchos::ArrayRCP< GlobalOrdinal > &bids, const Teuchos::ArrayRCP< double > &coords)
 
Teuchos::RCP< DataTransferKit::GeometryManager< DataTransferKit::Box, GlobalOrdinal > > createSourceGeometry (const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
 

Private Attributes

MultiApp_multi_app
 The MultiAppUserObject object this object will be evaluating. More...
 
std::string _user_object_name
 The name of the UserObject we're going to be evaluating. More...
 
Teuchos::ArrayRCP< DataTransferKit::Box > _boxes
 
Teuchos::ArrayRCP< GlobalOrdinal_box_ids
 

Detailed Description

Evaluates the specified UserObject and returns the result in a DTK FieldContainer.

Definition at line 31 of file MultiAppDTKUserObjectEvaluator.h.

Member Typedef Documentation

◆ GlobalOrdinal

Definition at line 40 of file MultiAppDTKUserObjectEvaluator.h.

Constructor & Destructor Documentation

◆ MultiAppDTKUserObjectEvaluator()

MultiAppDTKUserObjectEvaluator::MultiAppDTKUserObjectEvaluator ( MultiApp multi_app,
const std::string &  user_object_name 
)

Definition at line 25 of file MultiAppDTKUserObjectEvaluator.C.

27  : _multi_app(multi_app), _user_object_name(user_object_name)
28 {
29 }
std::string _user_object_name
The name of the UserObject we&#39;re going to be evaluating.
MultiApp & _multi_app
The MultiAppUserObject object this object will be evaluating.

◆ ~MultiAppDTKUserObjectEvaluator()

MultiAppDTKUserObjectEvaluator::~MultiAppDTKUserObjectEvaluator ( )

Definition at line 31 of file MultiAppDTKUserObjectEvaluator.C.

31 {}

Member Function Documentation

◆ createSourceGeometry()

Teuchos::RCP< DataTransferKit::GeometryManager< DataTransferKit::Box, long unsigned int > > MultiAppDTKUserObjectEvaluator::createSourceGeometry ( const Teuchos::RCP< const Teuchos::Comm< int >> &  comm)

Definition at line 68 of file MultiAppDTKUserObjectEvaluator.C.

70 {
71  _boxes.resize(_multi_app.numLocalApps());
73 
74  comm->barrier();
75 
76  for (unsigned int app = 0; app < _multi_app.numLocalApps(); app++)
77  {
78  unsigned int global_app = _multi_app.firstLocalApp() + app;
79 
80  BoundingBox bbox = _multi_app.getBoundingBox(global_app, false);
81 
82  _boxes[app] = DataTransferKit::Box(
83  bbox.min()(0), bbox.min()(1), bbox.min()(2), bbox.max()(0), bbox.max()(1), bbox.max()(2));
84 
85  _box_ids[app] = global_app;
86  }
87 
88  return Teuchos::rcp(new DataTransferKit::GeometryManager<DataTransferKit::Box, GlobalOrdinal>(
89  _boxes, _box_ids, comm, 3));
90 }
virtual BoundingBox getBoundingBox(unsigned int app, bool displaced_mesh)
Get the BoundingBox for the mesh associated with app The bounding box will be shifted to be in the co...
Definition: MultiApp.C:374
Teuchos::ArrayRCP< DataTransferKit::Box > _boxes
Teuchos::ArrayRCP< GlobalOrdinal > _box_ids
unsigned int numLocalApps()
Definition: MultiApp.h:213
unsigned int firstLocalApp()
Definition: MultiApp.h:218
MPI_Comm comm
MultiApp & _multi_app
The MultiAppUserObject object this object will be evaluating.

◆ evaluate()

DataTransferKit::FieldContainer< double > MultiAppDTKUserObjectEvaluator::evaluate ( const Teuchos::ArrayRCP< GlobalOrdinal > &  bids,
const Teuchos::ArrayRCP< double > &  coords 
)

Definition at line 34 of file MultiAppDTKUserObjectEvaluator.C.

36 {
37  Teuchos::RCP<const Teuchos::Comm<int>> comm = Teuchos::rcp(new Teuchos::MpiComm<int>(
38  Teuchos::rcp(new Teuchos::OpaqueWrapper<MPI_Comm>(_multi_app.comm()))));
39 
40  int num_values = bids.size();
41 
42  Teuchos::ArrayRCP<double> evaluated_data(num_values);
43 
44  unsigned int dim = 3; // TODO: REPLACE ME!!!!!!!!!
45 
46  for (GlobalOrdinal i = 0; i < static_cast<GlobalOrdinal>(num_values); i++)
47  {
48  // See if this app is on this processor
49  if (std::binary_search(_box_ids.begin(), _box_ids.end(), bids[i]))
50  {
51  GlobalOrdinal app = bids[i];
52 
53  Point p;
54  for (unsigned int j = 0; j < dim; j++)
55  p(j) = coords[(j * num_values) + i];
56 
57  evaluated_data[i] = _multi_app.appUserObjectBase(app, _user_object_name)
58  .spatialValue(p - _multi_app.position(app));
59  }
60  else
61  evaluated_data[i] = 0.0;
62  }
63 
64  return DataTransferKit::FieldContainer<double>(evaluated_data, 1);
65 }
Point position(unsigned int app)
The physical position of a global App number.
Definition: MultiApp.h:243
Teuchos::ArrayRCP< GlobalOrdinal > _box_ids
std::string _user_object_name
The name of the UserObject we&#39;re going to be evaluating.
virtual Real spatialValue(const Point &) const
Optional interface function for "evaluating" a UserObject at a spatial position.
Definition: UserObject.h:96
MPI_Comm & comm()
Get the MPI communicator this MultiApp is operating on.
Definition: MultiApp.h:277
MPI_Comm comm
MultiApp & _multi_app
The MultiAppUserObject object this object will be evaluating.
const UserObject & appUserObjectBase(unsigned int app, const std::string &name)
Get a UserObject base for a specific global app.
Definition: MultiApp.C:461

Member Data Documentation

◆ _box_ids

Teuchos::ArrayRCP<GlobalOrdinal> MultiAppDTKUserObjectEvaluator::_box_ids
private

Definition at line 56 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by createSourceGeometry(), and evaluate().

◆ _boxes

Teuchos::ArrayRCP<DataTransferKit::Box> MultiAppDTKUserObjectEvaluator::_boxes
private

Definition at line 55 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by createSourceGeometry().

◆ _multi_app

MultiApp& MultiAppDTKUserObjectEvaluator::_multi_app
private

The MultiAppUserObject object this object will be evaluating.

Definition at line 50 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by createSourceGeometry(), and evaluate().

◆ _user_object_name

std::string MultiAppDTKUserObjectEvaluator::_user_object_name
private

The name of the UserObject we're going to be evaluating.

Definition at line 53 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by evaluate().


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