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

write rod in newly defined amiramesh rod format

[[Imported from SVN: r911]]
parent 6cc923ea
No related branches found
No related tags found
No related merge requests found
...@@ -92,12 +92,7 @@ void writeRod(const Dune::BlockVector<Dune::FieldVector<double,3> >& rod, ...@@ -92,12 +92,7 @@ void writeRod(const Dune::BlockVector<Dune::FieldVector<double,3> >& rod,
void writeRod(const std::vector<Configuration>& rod, void writeRod(const std::vector<Configuration>& rod,
const std::string& filename) const std::string& filename)
{ {
int nLines = rod.size() + 1 + 3*3*rod.size(); int nPoints = 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());
// ///////////////////// // /////////////////////
// Write header // Write header
...@@ -110,66 +105,41 @@ void writeRod(const std::vector<Configuration>& rod, ...@@ -110,66 +105,41 @@ void writeRod(const std::vector<Configuration>& rod,
outfile << "# CreationDate: Mon Jul 18 17:14:27 2005" << std::endl; outfile << "# CreationDate: Mon Jul 18 17:14:27 2005" << std::endl;
outfile << std::endl; outfile << std::endl;
outfile << std::endl; outfile << std::endl;
outfile << "define Lines " << nLines << std::endl; outfile << "nNodes " << nPoints << std::endl;
outfile << "nVertices " << nPoints << std::endl;
outfile << std::endl; outfile << std::endl;
outfile << "Parameters {" << std::endl; outfile << "Parameters {" << std::endl;
outfile << " ContentType \"HxLineSet\"" << std::endl; outfile << " ContentType \"Rod\"" << std::endl;
outfile << "}" << std::endl; outfile << "}" << std::endl;
outfile << std::endl; outfile << std::endl;
outfile << "Lines { int LineIdx } @1" << std::endl; outfile << "Nodes { float[3] Coordinates } @1" << std::endl;
outfile << "Vertices { float[3] Coordinates } @2" << std::endl; outfile << "Nodes { float[3] Directors0 } @2" << std::endl;
outfile << "Nodes { float[3] Directors1 } @3" << std::endl;
outfile << std::endl; outfile << std::endl;
outfile << "# Data section follows" << 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++) for (int i=0; i<rod.size(); i++)
outfile << i << std::endl; //outfile << rod[i].r[0] << " " << rod[i].r[1] << " " << rod[i].r[2] << std::endl;
outfile << rod[i].r << 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 << 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; outfile << std::endl << "@2" << std::endl;
// The center axis for (int i=0; i<rod.size(); i++)
for (int i=0; i<rod.size(); i++) outfile << rod[i].q.director(0) << std::endl;
outfile << rod[i].r[0] << " " << rod[i].r[1] << " " << rod[i].r[2] << std::endl;
// The directors outfile << std::endl << "@3" << std::endl;
for (int i=0; i<rod.size(); i++) {
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; std::cout << "Result written successfully to: " << filename << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment