Skip to content

Commit

Permalink
Merge pull request #13451 from fdkong/tensor_mechanics_fixed
Browse files Browse the repository at this point in the history
Drop changes on finalize in postprocessor and user object
  • Loading branch information
fdkong committed May 21, 2019
2 parents 3063c66 + 82c94c8 commit c1d4f64
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 33 deletions.
Expand Up @@ -32,7 +32,6 @@ class ElementIntegralPostprocessor : public ElementPostprocessor
virtual void execute() override;
virtual void threadJoin(const UserObject & y) override;
virtual Real getValue() override;
virtual void finalize() override;

protected:
virtual Real computeQpIntegral() = 0;
Expand Down
Expand Up @@ -32,7 +32,6 @@ class SideIntegralPostprocessor : public SidePostprocessor
virtual void execute() override;
virtual Real getValue() override;
virtual void threadJoin(const UserObject & y) override;
virtual void finalize() override;

protected:
virtual Real computeQpIntegral() = 0;
Expand Down
2 changes: 1 addition & 1 deletion framework/include/userobject/ElementIntegralUserObject.h
Expand Up @@ -33,7 +33,7 @@ class ElementIntegralUserObject : public ElementUserObject
virtual void initialize() override;
virtual void execute() override;
virtual void threadJoin(const UserObject & y) override;
virtual void finalize() override;
virtual void finalize() override {}

/// Returns the integral value
virtual Real getValue();
Expand Down
2 changes: 1 addition & 1 deletion framework/include/userobject/SideIntegralUserObject.h
Expand Up @@ -32,7 +32,7 @@ class SideIntegralUserObject : public SideUserObject
virtual void initialize() override;
virtual void execute() override;
virtual void threadJoin(const UserObject & y) override;
virtual void finalize() override;
virtual void finalize() override {}

/// Returns the integral value
virtual Real getValue();
Expand Down
7 changes: 1 addition & 6 deletions framework/src/postprocessors/ElementIntegralPostprocessor.C
Expand Up @@ -38,14 +38,9 @@ ElementIntegralPostprocessor::execute()

Real
ElementIntegralPostprocessor::getValue()
{
return _integral_value;
}

void
ElementIntegralPostprocessor::finalize()
{
gatherSum(_integral_value);
return _integral_value;
}

void
Expand Down
7 changes: 1 addition & 6 deletions framework/src/postprocessors/SideIntegralPostprocessor.C
Expand Up @@ -38,14 +38,9 @@ SideIntegralPostprocessor::execute()

Real
SideIntegralPostprocessor::getValue()
{
return _integral_value;
}

void
SideIntegralPostprocessor::finalize()
{
gatherSum(_integral_value);
return _integral_value;
}

void
Expand Down
7 changes: 1 addition & 6 deletions framework/src/userobject/ElementIntegralUserObject.C
Expand Up @@ -39,14 +39,9 @@ ElementIntegralUserObject::execute()

Real
ElementIntegralUserObject::getValue()
{
return _integral_value;
}

void
ElementIntegralUserObject::finalize()
{
gatherSum(_integral_value);
return _integral_value;
}

void
Expand Down
Expand Up @@ -39,21 +39,38 @@ NearestPointIntegralVariablePostprocessor::NearestPointIntegralVariablePostproce
Real
NearestPointIntegralVariablePostprocessor::spatialValue(const Point & point) const
{
return nearestUserObject(point)->getValue();
unsigned int i = nearestPointIndex(point);

if (i >= _np_post_processor_values.size())
mooseError("The vector length of vector post processor is ",
_np_post_processor_values.size(),
" but nearestPointIndex() return ",
i);

return _np_post_processor_values[i];
}

Real
NearestPointIntegralVariablePostprocessor::userObjectValue(unsigned int i) const
{
if (i >= _user_objects.size())
mooseError("There are only ", _user_objects.size(), " user objects but you pass in ", i);
if (i >= _np_post_processor_values.size())
mooseError("The vector length of vector post processor is ",
_np_post_processor_values.size(),
" but you pass in ",
i);

return _user_objects[i]->getValue();
return _np_post_processor_values[i];
}

void
NearestPointIntegralVariablePostprocessor::finalize()
{
if (_user_objects.size() != _np_post_processor_values.size())
mooseError("The vector length of the vector postproessor ",
_np_post_processor_values.size(),
" is different from the number of user objects ",
_user_objects.size());

unsigned int i = 0;
for (auto & user_object : _user_objects)
{
Expand Down
7 changes: 1 addition & 6 deletions framework/src/userobject/SideIntegralUserObject.C
Expand Up @@ -38,14 +38,9 @@ SideIntegralUserObject::execute()

Real
SideIntegralUserObject::getValue()
{
return _integral_value;
}

void
SideIntegralUserObject::finalize()
{
gatherSum(_integral_value);
return _integral_value;
}

void
Expand Down
Binary file not shown.
Binary file not shown.
Expand Up @@ -57,7 +57,7 @@

[Transfers]
[./to_sub]
type = MultiAppNearestNodeTransfer
type = MultiAppMeshFunctionTransfer
direction = to_multiapp
source_variable = u
variable = aux_u
Expand Down

0 comments on commit c1d4f64

Please sign in to comment.