From bbafc864c70520d720f805ff4c81e05ee013cdde Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Wed, 19 Oct 2011 15:34:24 +0000 Subject: [PATCH] Use the new CosseratAmiraMeshWriter [[Imported from SVN: r7967]] --- cosserat-continuum.cc | 77 ++----------------------------------------- 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/cosserat-continuum.cc b/cosserat-continuum.cc index 3594ffdd..8ce03b11 100644 --- a/cosserat-continuum.cc +++ b/cosserat-continuum.cc @@ -25,6 +25,7 @@ #include <dune/gfe/unitvector.hh> #include <dune/gfe/realtuple.hh> #include <dune/gfe/cosseratenergystiffness.hh> +#include <dune/gfe/cosseratamirameshwriter.hh> #include <dune/gfe/geodesicfeassembler.hh> #include <dune/gfe/riemanniantrsolver.hh> @@ -79,50 +80,6 @@ void dirichletValues(const FieldVector<double,dim>& in, FieldVector<double,3>& o out += center; } -template <class HostGridView> -class DeformationFunction - : public Dune :: DiscreteCoordFunction< double, 3, DeformationFunction<HostGridView> > -{ - typedef DeformationFunction<HostGridView> This; - typedef Dune :: DiscreteCoordFunction< double, 3, This > Base; - - public: - - DeformationFunction(const HostGridView& gridView, - const std::vector<RigidBodyMotion<3> >& deformedPosition) - : gridView_(gridView), - deformedPosition_(deformedPosition) - {} - - void evaluate ( const typename HostGridView::template Codim<dim>::Entity& hostEntity, unsigned int corner, - FieldVector<double,3> &y ) const - { - - const typename HostGridView::IndexSet& indexSet = gridView_.indexSet(); - - int idx = indexSet.index(hostEntity); - y = deformedPosition_[idx].r; - } - - void evaluate ( const typename HostGridView::template Codim<0>::Entity& hostEntity, unsigned int corner, - FieldVector<double,3> &y ) const - { - - const typename HostGridView::IndexSet& indexSet = gridView_.indexSet(); - - int idx = indexSet.subIndex(hostEntity, corner,dim); - - y = deformedPosition_[idx].r; - } - -private: - - HostGridView gridView_; - - const std::vector<RigidBodyMotion<3> > deformedPosition_; - -}; - struct NeumannFunction : public Dune::VirtualFunction<FieldVector<double,dim>, FieldVector<double,3> > @@ -331,39 +288,9 @@ int main (int argc, char *argv[]) try // ////////////////////////////// // Output result // ////////////////////////////// - - typedef GeometryGrid<GridType,DeformationFunction<GridType::LeafGridView> > DeformedGridType; - DeformationFunction<GridType::LeafGridView> deformationFunction(grid.leafView(),x); - - DeformedGridType deformedGrid(grid, deformationFunction); + CosseratAmiraMeshWriter<GridType>::write(grid,x,"cosserat"); - if (dim==2) - LeafAmiraMeshWriter<DeformedGridType>::writeSurfaceGrid(deformedGrid.leafView(), "cosseratGrid"); - else { - LeafAmiraMeshWriter<DeformedGridType> amiramesh(deformedGrid); - amiramesh.write("cosseratGrid"); - } - - // Make three vector fields containing the directors - // I don't think there is a simpler way to get the data into vanilla Amira - - for (int i=0; i<3; i++) { - - std::vector<FieldVector<double,3> > director(x.size()); - for (size_t j=0; j<x.size(); j++) - director[j] = x[j].q.director(i); - - LeafAmiraMeshWriter<DeformedGridType> amiramesh; - amiramesh.addVertexData(director, deformedGrid.leafView()); - - std::stringstream iAsAscii; - iAsAscii << i; - amiramesh.write("cosseratOrientation"+iAsAscii.str(), true); - - } - - // finally: compute the average deformation of the Neumann boundary // That is what we need for the locking tests FieldVector<double,3> averageDef(0); -- GitLab