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 36 of file MultiAppDTKUserObjectEvaluator.h.

Member Typedef Documentation

Definition at line 45 of file MultiAppDTKUserObjectEvaluator.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file MultiAppDTKUserObjectEvaluator.C.

32  : _multi_app(multi_app), _user_object_name(user_object_name)
33 {
34 }
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 ( )

Definition at line 36 of file MultiAppDTKUserObjectEvaluator.C.

36 {}

Member Function Documentation

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

Definition at line 73 of file MultiAppDTKUserObjectEvaluator.C.

75 {
76  _boxes.resize(_multi_app.numLocalApps());
78 
79  comm->barrier();
80 
81  for (unsigned int app = 0; app < _multi_app.numLocalApps(); app++)
82  {
83  unsigned int global_app = _multi_app.firstLocalApp() + app;
84 
85  BoundingBox bbox = _multi_app.getBoundingBox(global_app);
86 
87  _boxes[app] = DataTransferKit::Box(
88  bbox.min()(0), bbox.min()(1), bbox.min()(2), bbox.max()(0), bbox.max()(1), bbox.max()(2));
89 
90  _box_ids[app] = global_app;
91  }
92 
93  return Teuchos::rcp(new DataTransferKit::GeometryManager<DataTransferKit::Box, GlobalOrdinal>(
94  _boxes, _box_ids, comm, 3));
95 }
Teuchos::ArrayRCP< DataTransferKit::Box > _boxes
Teuchos::ArrayRCP< GlobalOrdinal > _box_ids
unsigned int numLocalApps()
Definition: MultiApp.h:192
unsigned int firstLocalApp()
Definition: MultiApp.h:197
virtual BoundingBox getBoundingBox(unsigned int app)
Get the BoundingBox for the mesh associated with app The bounding box will be shifted to be in the co...
Definition: MultiApp.C:359
MPI_Comm comm
MultiApp & _multi_app
The MultiAppUserObject object this object will be evaluating.
DataTransferKit::FieldContainer< double > MultiAppDTKUserObjectEvaluator::evaluate ( const Teuchos::ArrayRCP< GlobalOrdinal > &  bids,
const Teuchos::ArrayRCP< double > &  coords 
)

Definition at line 39 of file MultiAppDTKUserObjectEvaluator.C.

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

Member Data Documentation

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

Definition at line 61 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by createSourceGeometry(), and evaluate().

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

Definition at line 60 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by createSourceGeometry().

MultiApp& MultiAppDTKUserObjectEvaluator::_multi_app
private

The MultiAppUserObject object this object will be evaluating.

Definition at line 55 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by createSourceGeometry(), and evaluate().

std::string MultiAppDTKUserObjectEvaluator::_user_object_name
private

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

Definition at line 58 of file MultiAppDTKUserObjectEvaluator.h.

Referenced by evaluate().


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