36 #include "VtkNonlinearElasticitySolutionWriter.hpp"
37 #include "VtkMeshWriter.hpp"
39 template<
unsigned DIM>
42 if (mpSolver->mOutputDirectory==
"")
44 EXCEPTION(
"No output directory was given to the mechanics solver");
51 std::vector<c_vector<double,DIM> > displacement(mpSolver->mrQuadMesh.GetNumNodes());
52 std::vector<c_vector<double,DIM> >& r_spatial_solution = mpSolver->rGetSpatialSolution();
53 for (
unsigned i=0; i<mpSolver->mrQuadMesh.GetNumNodes(); i++)
55 for (
unsigned j=0; j<DIM; j++)
57 displacement[i](j) = r_spatial_solution[i](j)- mpSolver->mrQuadMesh.GetNode(i)->rGetLocation()[j];
63 if (mpSolver->mCompressibilityType==INCOMPRESSIBLE)
65 mesh_writer.
AddPointData(
"Pressure", mpSolver->rGetPressures());
69 std::vector<double> element_attribute;
71 iter != mpSolver->mrQuadMesh.GetElementIteratorEnd();
74 element_attribute.push_back(iter->GetAttribute());
76 mesh_writer.
AddCellData(
"Attribute", element_attribute);
79 if (mWriteElementWiseStrains)
82 mTensorData.resize(mpSolver->mrQuadMesh.GetNumElements());
85 switch(mElementWiseStrainType)
87 case DEFORMATION_GRADIENT_F:
89 name =
"deformation_gradient_F";
92 case DEFORMATION_TENSOR_C:
94 name =
"deformation_tensor_C";
97 case LAGRANGE_STRAIN_E:
99 name =
"Lagrange_strain_E";
109 iter != mpSolver->mrQuadMesh.GetElementIteratorEnd();
112 mpSolver->GetElementCentroidStrain(mElementWiseStrainType, *iter, mTensorData[iter->GetIndex()]);
ElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
#define EXCEPTION(message)
void AddCellData(std::string name, std::vector< double > data)
void WriteFilesUsingMesh(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, bool keepOriginalElementIndexing=true)
void AddTensorCellData(std::string name, std::vector< c_vector< double, SPACE_DIM *(SPACE_DIM+1)/2 > > data)
void AddPointData(std::string name, std::vector< double > data)