Skip to content
Snippets Groups Projects
Commit 241e3c50 authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

Make getResultantForce return a RigidBodyMotion::TangentVector

Because that is what happens.  The previous solution of returning
to FieldVectors, one as the return value and the other one using
call-by-reference, was extremely ugly.

This is an API change.

[[Imported from SVN: r6840]]
parent f08dc26f
Branches
No related tags found
No related merge requests found
...@@ -141,10 +141,9 @@ getStress(const std::vector<RigidBodyMotion<3> >& sol, ...@@ -141,10 +141,9 @@ getStress(const std::vector<RigidBodyMotion<3> >& sol,
template <class GridView> template <class GridView>
template <class PatchGridView> template <class PatchGridView>
Dune::FieldVector<double,3> RodAssembler<GridView,3>:: Dune::FieldVector<double,6> RodAssembler<GridView,3>::
getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary, getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary,
const std::vector<RigidBodyMotion<3> >& sol, const std::vector<RigidBodyMotion<3> >& sol) const
Dune::FieldVector<double,3>& canonicalTorque) const
{ {
using namespace Dune; using namespace Dune;
...@@ -157,7 +156,7 @@ getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary, ...@@ -157,7 +156,7 @@ getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary,
DUNE_THROW(Exception, "Solution vector doesn't match the grid!"); DUNE_THROW(Exception, "Solution vector doesn't match the grid!");
FieldVector<double,3> canonicalStress(0); FieldVector<double,3> canonicalStress(0);
canonicalTorque = 0; FieldVector<double,3> canonicalTorque(0);
// Loop over the given boundary // Loop over the given boundary
typename BoundaryPatchBase<PatchGridView>::iterator it = boundary.begin(); typename BoundaryPatchBase<PatchGridView>::iterator it = boundary.begin();
...@@ -210,7 +209,13 @@ getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary, ...@@ -210,7 +209,13 @@ getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary,
} }
return canonicalStress; Dune::FieldVector<double,6> result;
for (int i=0; i<3; i++) {
result[i] = canonicalStress[i];
result[i+3] = canonicalTorque[i];
}
return result;
} }
......
...@@ -79,9 +79,8 @@ public: ...@@ -79,9 +79,8 @@ public:
\note Linear run-time in the size of the grid */ \note Linear run-time in the size of the grid */
template <class PatchGridView> template <class PatchGridView>
Dune::FieldVector<double,3> getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary, Dune::FieldVector<double,6> getResultantForce(const BoundaryPatchBase<PatchGridView>& boundary,
const std::vector<RigidBodyMotion<3> >& sol, const std::vector<RigidBodyMotion<3> >& sol) const;
Dune::FieldVector<double,3>& canonicalTorque) const;
}; // end class }; // end class
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment