Skip to content

Commit

Permalink
Address Daniel review comments. (Issue idaholab#7980).
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lindsay committed Nov 14, 2016
1 parent 8cb2883 commit 6692689
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 26 deletions.
8 changes: 0 additions & 8 deletions framework/include/userobject/ShapeElementUserObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ class ShapeElementUserObject : public ShapeUserObject<ElementUserObject>
{
public:
ShapeElementUserObject(const InputParameters & parameters);

/* protected: */
/* /\** */
/* * Implement this function to compute Jacobian terms for this UserObject. The */
/* * shape function index _j and its corrsponding global DOF index _j_global */
/* * will be provided. */
/* *\/ */
/* virtual void executeJacobian(unsigned int /\*jvar*\/) = 0; */
};

#endif //SHAPEELEMENTUSEROBJECT_H
4 changes: 1 addition & 3 deletions framework/include/userobject/ShapeSideUserObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ InputParameters validParams<ShapeSideUserObject>();
* \warning It is up to the user to ensure _fe_problem.currentlyComputingJacobian()
* returns true before utilizing the shape functions.
*/
class ShapeSideUserObject :
/* public SideUserObject, */
public ShapeUserObject<SideUserObject>
class ShapeSideUserObject : public ShapeUserObject<SideUserObject>
{
public:
ShapeSideUserObject(const InputParameters & parameters);
Expand Down
7 changes: 3 additions & 4 deletions framework/include/userobject/ShapeUserObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#ifndef SHAPEUSEROBJECT_H
#define SHAPEUSEROBJECT_H

/* #include "ElementUserObject.h" */
#include "MooseVariable.h"
#include "MooseObject.h"
#include "Coupleable.h"
Expand All @@ -30,7 +29,7 @@
* _assembly.phiFace())
*/

enum ShapeType
enum class ShapeType
{
Element,
Side
Expand Down Expand Up @@ -101,8 +100,8 @@ class ShapeUserObject : public T
template<typename T>
ShapeUserObject<T>::ShapeUserObject(const InputParameters & parameters, ShapeType type) :
T(parameters),
_phi((type == ShapeType::Element) ? this->_assembly.phi() : this->_assembly.phiFace()),
_grad_phi((type == ShapeType::Element) ? this->_assembly.gradPhi() : this->_assembly.gradPhiFace()),
_phi(type == ShapeType::Element ? this->_assembly.phi() : this->_assembly.phiFace()),
_grad_phi(type == ShapeType::Element ? this->_assembly.gradPhi() : this->_assembly.gradPhiFace()),
_compute_jacobians(MooseObject::getParam<bool>("compute_jacobians"))
{
mooseWarning("Jacobian calculation in UserObjects is an experimental capability with a potentially unstable interface.");
Expand Down
20 changes: 10 additions & 10 deletions framework/src/base/ComputeUserObjectsThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ ComputeUserObjectsThread::onElement(const Elem * elem)
{
// Prepare shape functions for ShapeElementUserObjects
std::vector<MooseVariable *> jacobian_moose_vars = _fe_problem.getUserObjectJacobianVariables(_tid);
for (auto & jvar_it : jacobian_moose_vars)
for (auto & jvar : jacobian_moose_vars)
{
unsigned int jvar = (*jvar_it).number();
std::vector<dof_id_type> & dof_indices = (*jvar_it).dofIndices();
unsigned int jvar_id = jvar->number();
std::vector<dof_id_type> & dof_indices = jvar->dofIndices();

_fe_problem.prepareShapes(jvar, _tid);
_fe_problem.prepareShapes(jvar_id, _tid);

const std::vector<MooseSharedPointer<ElementUserObject> > & e_objects = _elemental_user_objects.getActiveBlockObjects(_subdomain, _tid);
for (const auto & uo : e_objects)
{
MooseSharedPointer<ShapeElementUserObject> shape_element_uo = MooseSharedNamespace::dynamic_pointer_cast<ShapeElementUserObject>(uo);
if (shape_element_uo)
shape_element_uo->executeJacobianWrapper(jvar, dof_indices);
shape_element_uo->executeJacobianWrapper(jvar_id, dof_indices);
}
}
}
Expand Down Expand Up @@ -135,18 +135,18 @@ ComputeUserObjectsThread::onBoundary(const Elem *elem, unsigned int side, Bounda
{
// Prepare shape functions for ShapeSideUserObjects
std::vector<MooseVariable *> jacobian_moose_vars = _fe_problem.getUserObjectJacobianVariables(_tid);
for (auto & jvar_it : jacobian_moose_vars)
for (auto & jvar : jacobian_moose_vars)
{
unsigned int jvar = (*jvar_it).number();
std::vector<dof_id_type> & dof_indices = (*jvar_it).dofIndices();
unsigned int jvar_id = jvar->number();
std::vector<dof_id_type> & dof_indices = jvar->dofIndices();

_fe_problem.prepareFaceShapes(jvar, _tid);
_fe_problem.prepareFaceShapes(jvar_id, _tid);
;
for (const auto & uo : objects)
{
MooseSharedPointer<ShapeSideUserObject> shape_side_uo = MooseSharedNamespace::dynamic_pointer_cast<ShapeSideUserObject>(uo);
if (shape_side_uo)
shape_side_uo->executeJacobianWrapper(jvar, dof_indices);
shape_side_uo->executeJacobianWrapper(jvar_id, dof_indices);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion test/src/kernels/PotentialAdvection.C
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ PotentialAdvection::computeQpOffDiagJacobian(unsigned int jvar)
{
if (jvar == _potential_id)
return -_grad_test[_i][_qp] * _sgn * -_grad_phi[_j][_qp] * _u[_qp];

else
return 0;
}

0 comments on commit 6692689

Please sign in to comment.