Skip to content
Permalink
Browse files

Merge pull request #13451 from fdkong/tensor_mechanics_fixed

Drop changes on finalize in postprocessor and user object
  • Loading branch information...
fdkong committed May 21, 2019
2 parents 3063c66 + 82c94c8 commit c1d4f648c012a7ec058669f08a3b9397beb95f19
@@ -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;
@@ -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;
@@ -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();
@@ -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();
@@ -38,14 +38,9 @@ ElementIntegralPostprocessor::execute()

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

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

void
@@ -38,14 +38,9 @@ SideIntegralPostprocessor::execute()

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

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

void
@@ -39,14 +39,9 @@ ElementIntegralUserObject::execute()

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

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

void
@@ -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)
{
@@ -38,14 +38,9 @@ SideIntegralUserObject::execute()

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

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

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

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

0 comments on commit c1d4f64

Please sign in to comment.
You can’t perform that action at this time.