36 #include "FibreWriter.hpp"
37 #include "Version.hpp"
39 template<
unsigned DIM>
41 const std::string& rBaseName,
42 const bool clearOutputDir)
43 : mBaseName(rBaseName),
49 template<
unsigned DIM>
52 delete mpOutputFileHandler;
55 template<
unsigned DIM>
59 out_stream p_axi_file = OpenFileAndWriteHeader(this->mBaseName +
".axi", fibres.size());
62 for (
unsigned i=0; i<fibres.size();i++ )
64 if (this->mFileIsBinary)
66 p_axi_file->write((
char*)&fibres[i][0], DIM*
sizeof(
double));
70 for (
unsigned j=0; j<DIM; j++)
72 *p_axi_file << fibres[i][j] <<
"\t";
81 template<
unsigned DIM>
83 const std::vector< c_vector<double, DIM> >& second,
84 const std::vector< c_vector<double, DIM> >& third)
86 assert(fibres.size() == second.size());
87 assert(second.size() == third.size());
89 out_stream p_file = OpenFileAndWriteHeader(this->mBaseName +
".ortho", fibres.size());
92 for (
unsigned i=0; i<fibres.size();i++ )
94 if (this->mFileIsBinary)
97 p_file->write((
char*)&fibres[i][0], DIM*
sizeof(
double));
98 p_file->write((
char*)&second[i][0], DIM*
sizeof(
double));
99 p_file->write((
char*)&third[i][0], DIM*
sizeof(
double));
104 for (
unsigned j=0; j<DIM; j++)
106 *p_file << fibres[i][j] <<
"\t";
108 for (
unsigned j=0; j<DIM; j++)
110 *p_file << second[i][j] <<
"\t";
112 for (
unsigned j=0; j<DIM; j++)
114 *p_file << third[i][j] <<
"\t";
123 template<
unsigned DIM>
126 out_stream p_fibre_file = this->mpOutputFileHandler->OpenOutputFile(rFileName);
129 *p_fibre_file << numItems;
131 if (this->mFileIsBinary)
133 *p_fibre_file <<
"\tBIN\n";
137 *p_fibre_file <<
"\n";
142 template<
unsigned DIM>
145 mFileIsBinary =
true;
void WriteAllAxi(const std::vector< c_vector< double, DIM > > &fibres)
OutputFileHandler * mpOutputFileHandler
void SetWriteFileAsBinary()
out_stream OpenFileAndWriteHeader(const std::string &rFileName, unsigned numItems)
FibreWriter(const std::string &rDirectory, const std::string &rBaseName, const bool clearOutputDir=true)
static std::string GetProvenanceString()
void WriteAllOrtho(const std::vector< c_vector< double, DIM > > &fibres, const std::vector< c_vector< double, DIM > > &second, const std::vector< c_vector< double, DIM > > &third)