From 23a19ceb75227b7f56962489f55167c2907754ab Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Thu, 24 Aug 2006 13:23:53 +0000 Subject: [PATCH] write rod in newly defined amiramesh rod format [[Imported from SVN: r911]] --- src/rodwriter.hh | 64 +++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 47 deletions(-) diff --git a/src/rodwriter.hh b/src/rodwriter.hh index 3432ab31..2365d7bd 100644 --- a/src/rodwriter.hh +++ b/src/rodwriter.hh @@ -92,12 +92,7 @@ void writeRod(const Dune::BlockVector<Dune::FieldVector<double,3> >& rod, void writeRod(const std::vector<Configuration>& rod, const std::string& filename) { - int nLines = rod.size() + 1 + 3*3*rod.size(); - - // One point for each center line vertex and three for three director endpoints - int nPoints = 4*rod.size(); - - double directorLength = 1/((double)rod.size()); + int nPoints = rod.size(); // ///////////////////// // Write header @@ -110,66 +105,41 @@ void writeRod(const std::vector<Configuration>& rod, outfile << "# CreationDate: Mon Jul 18 17:14:27 2005" << std::endl; outfile << std::endl; outfile << std::endl; - outfile << "define Lines " << nLines << std::endl; - outfile << "nVertices " << nPoints << std::endl; + outfile << "nNodes " << nPoints << std::endl; outfile << std::endl; outfile << "Parameters {" << std::endl; - outfile << " ContentType \"HxLineSet\"" << std::endl; + outfile << " ContentType \"Rod\"" << std::endl; outfile << "}" << std::endl; outfile << std::endl; - outfile << "Lines { int LineIdx } @1" << std::endl; - outfile << "Vertices { float[3] Coordinates } @2" << std::endl; + outfile << "Nodes { float[3] Coordinates } @1" << std::endl; + outfile << "Nodes { float[3] Directors0 } @2" << std::endl; + outfile << "Nodes { float[3] Directors1 } @3" << std::endl; outfile << std::endl; outfile << "# Data section follows" << std::endl; - outfile << "@1" << std::endl; + // /////////////////////////////////////// + // Write the center axis // /////////////////////////////////////// - // write lines - // /////////////////////////////////////// + outfile << "@1" << std::endl; - // The center axis for (int i=0; i<rod.size(); i++) - outfile << i << std::endl; - - outfile << "-1" << std::endl; - - // The directors - for (int i=0; i<rod.size(); i++) { - outfile << i << std::endl << rod.size()+3*i << std::endl << "-1" << std::endl; - - outfile << i << std::endl << rod.size()+3*i+1 << std::endl << "-1" << std::endl; + //outfile << rod[i].r[0] << " " << rod[i].r[1] << " " << rod[i].r[2] << std::endl; + outfile << rod[i].r << std::endl; - outfile << i << std::endl << rod.size()+3*i+2 << std::endl << "-1" << std::endl; - } // /////////////////////////////////////// - // Write the vertices + // Write the directors // /////////////////////////////////////// - outfile << std::endl << "@2" << std::endl; - // The center axis - for (int i=0; i<rod.size(); i++) - outfile << rod[i].r[0] << " " << rod[i].r[1] << " " << rod[i].r[2] << std::endl; + for (int i=0; i<rod.size(); i++) + outfile << rod[i].q.director(0) << std::endl; - // The directors - for (int i=0; i<rod.size(); i++) { + outfile << std::endl << "@3" << std::endl; - Dune::FieldVector<double, 3> director[3]; + for (int i=0; i<rod.size(); i++) + outfile << rod[i].q.director(1) << std::endl; - director[0] = rod[i].q.director(0); - director[1] = rod[i].q.director(1); - director[2] = rod[i].q.director(2); - - director[0] *= directorLength; - director[1] *= directorLength; - director[2] *= directorLength; - - outfile << rod[i].r[0]+director[0][0] << " " << rod[i].r[1]+director[0][1] << " " << rod[i].r[2]+director[0][2] << std::endl; - outfile << rod[i].r[0]+director[1][0] << " " << rod[i].r[1]+director[1][1] << " " << rod[i].r[2]+director[1][2] << std::endl; - outfile << rod[i].r[0]+director[2][0] << " " << rod[i].r[1]+director[2][1] << " " << rod[i].r[2]+director[2][2] << std::endl; - - } std::cout << "Result written successfully to: " << filename << std::endl; -- GitLab