42 std::vector<UbTupleInt2> &lines)
48 std::vector<UbTupleInt3> &cells)
54 std::vector<UbTupleFloat3> &nodes,
55 std::vector<UbTupleInt3> &cells,
56 std::vector<std::string> &datanames,
57 std::vector<std::vector<double>> &
nodedata)
72 if (path.size() > 0) {
86 out <<
"# vtk DataFile Version 4.0"
88 out <<
"D3Q19MasterNodeGrid"
94 out <<
"DATASET UNSTRUCTURED_GRID"
109 out.write((
char *)&x1,
sizeof(
float));
110 out.write((
char *)&x2,
sizeof(
float));
111 out.write((
char *)&x3,
sizeof(
float));
121 for (
int c = 0;
c < (
int)cells.size();
c++) {
134 out.write((
char *)&SW,
sizeof(
int));
135 out.write((
char *)&SE,
sizeof(
int));
136 out.write((
char *)&NW,
sizeof(
int));
137 out.write((
char *)&NE,
sizeof(
int));
141 out <<
"CELL_TYPES " << (
int)cells.size() <<
"\n";
166 if (path.size() > 0) {
179 out <<
"# vtk DataFile Version 4.0"
181 out <<
"D3Q19MasterNodeGrid"
187 out <<
"DATASET UNSTRUCTURED_GRID"
202 out.write((
char *)&x1,
sizeof(
float));
203 out.write((
char *)&x2,
sizeof(
float));
204 out.write((
char *)&x3,
sizeof(
float));
214 for (
int c = 0;
c < (
int)cells.size();
c++) {
227 out.write((
char *)&SW,
sizeof(
int));
228 out.write((
char *)&SE,
sizeof(
int));
229 out.write((
char *)&NW,
sizeof(
int));
230 out.write((
char *)&NE,
sizeof(
int));
234 out <<
"CELL_TYPES " << (
int)cells.size() <<
"\n";
246 for (
int s = 0;
s < (
int)datanames.size(); ++
s) {
249 out <<
"SCALARS " << datanames[
s] <<
" float 1 \n LOOKUP_TABLE default \n";
254 out.write((
const char *)&
dummy,
sizeof(
float));
276 if (path.size() > 0) {
289 out <<
"# vtk DataFile Version 4.0"
291 out <<
"D3Q19MasterNodeGrid"
297 out <<
"DATASET UNSTRUCTURED_GRID"
312 out.write((
char *)&x1,
sizeof(
float));
313 out.write((
char *)&x2,
sizeof(
float));
314 out.write((
char *)&x3,
sizeof(
float));
324 for (
int c = 0;
c < (
int)cells.size();
c++) {
337 out.write((
char *)&SW,
sizeof(
int));
338 out.write((
char *)&SE,
sizeof(
int));
339 out.write((
char *)&NW,
sizeof(
int));
340 out.write((
char *)&NE,
sizeof(
int));
344 out <<
"CELL_TYPES " << (
int)cells.size() <<
"\n";
356 for (
int s = 0;
s < (
int)datanames.size(); ++
s) {
359 out <<
"SCALARS " << datanames[
s] <<
" float 1 \n LOOKUP_TABLE default \n";
364 out.write((
const char *)&
dummy,
sizeof(
float));
387 if (path.size() > 0) {
401 out <<
"# vtk DataFile Version 4.0"
403 out <<
"D3Q19MasterNodeGrid"
409 out <<
"DATASET UNSTRUCTURED_GRID"
424 out.write((
char *)&x1,
sizeof(
float));
425 out.write((
char *)&x2,
sizeof(
float));
426 out.write((
char *)&x3,
sizeof(
float));
436 for (
int c = 0;
c < (
int)cells.size();
c++) {
449 out.write((
char *)&SW,
sizeof(
int));
450 out.write((
char *)&SE,
sizeof(
int));
451 out.write((
char *)&NW,
sizeof(
int));
452 out.write((
char *)&NE,
sizeof(
int));
456 out <<
"CELL_TYPES " << (
int)cells.size() <<
"\n";
476 out.write((
const char *)&
dummy,
sizeof(
float));
492 out.write((
const char *)&
dummy,
sizeof(
float));
514 if (path.size() > 0) {
528 out <<
"# vtk DataFile Version 4.0"
530 out <<
"D3Q19MasterNodeGrid"
536 out <<
"DATASET UNSTRUCTURED_GRID"
551 out.write((
char *)&x1,
sizeof(
float));
552 out.write((
char *)&x2,
sizeof(
float));
553 out.write((
char *)&x3,
sizeof(
float));
563 for (
int c = 0;
c < (
int)cells.size();
c++) {
584 out.write((
char *)&BSW,
sizeof(
int));
585 out.write((
char *)&BSE,
sizeof(
int));
586 out.write((
char *)&BNE,
sizeof(
int));
587 out.write((
char *)&BNW,
sizeof(
int));
588 out.write((
char *)&TSW,
sizeof(
int));
589 out.write((
char *)&TSE,
sizeof(
int));
590 out.write((
char *)&TNE,
sizeof(
int));
591 out.write((
char *)&TNW,
sizeof(
int));
595 out <<
"CELL_TYPES " << (
int)cells.size() <<
"\n";
607 for (
int s = 0;
s < (
int)datanames.size(); ++
s) {
610 out <<
"SCALARS " << datanames[
s] <<
" float 1 \n LOOKUP_TABLE default \n";
615 out.write((
const char *)&
dummy,
sizeof(
float));
637 if (path.size() > 0) {
650 out <<
"# vtk DataFile Version 4.0"
652 out <<
"D3Q19MasterNodeGrid"
658 out <<
"DATASET UNSTRUCTURED_GRID"
673 out.write((
char *)&x1,
sizeof(
float));
674 out.write((
char *)&x2,
sizeof(
float));
675 out.write((
char *)&x3,
sizeof(
float));
685 for (
int c = 0;
c < (
int)cells.size();
c++) {
706 out.write((
char *)&BSW,
sizeof(
int));
707 out.write((
char *)&BSE,
sizeof(
int));
708 out.write((
char *)&BNE,
sizeof(
int));
709 out.write((
char *)&BNW,
sizeof(
int));
710 out.write((
char *)&TSW,
sizeof(
int));
711 out.write((
char *)&TSE,
sizeof(
int));
712 out.write((
char *)&TNE,
sizeof(
int));
713 out.write((
char *)&TNW,
sizeof(
int));
717 out <<
"CELL_TYPES " << (
int)cells.size() <<
"\n";
729 for (
int s = 0;
s < (
int)datanames.size(); ++
s) {
732 out <<
"SCALARS " << datanames[
s] <<
" float 1 \n LOOKUP_TABLE default \n";
737 out.write((
const char *)&
dummy,
sizeof(
float));
758 if (path.size() > 0) {
772 out <<
"# vtk DataFile Version 4.0"
774 out <<
"D3Q19MasterNodeGrid"
780 out <<
"DATASET UNSTRUCTURED_GRID"
795 out.write((
char *)&x1,
sizeof(
float));
796 out.write((
char *)&x2,
sizeof(
float));
797 out.write((
char *)&x3,
sizeof(
float));
807 for (
int c = 0;
c < (
int)cells.size();
c++) {
828 out.write((
char *)&BSW,
sizeof(
int));
829 out.write((
char *)&BSE,
sizeof(
int));
830 out.write((
char *)&BNE,
sizeof(
int));
831 out.write((
char *)&BNW,
sizeof(
int));
832 out.write((
char *)&TSW,
sizeof(
int));
833 out.write((
char *)&TSE,
sizeof(
int));
834 out.write((
char *)&TNE,
sizeof(
int));
835 out.write((
char *)&TNW,
sizeof(
int));
839 out <<
"CELL_TYPES " << (
int)cells.size() <<
"\n";
static WbWriterVtkASCII * getInstance()
std::string getFileExtension() override
std::shared_ptr< T > SPtr
#define UBLOG(level, logtext)
std::string writeLines(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt2 > &lines) override
std::string writeTriangles(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &cells) override
std::string writeQuadsWithNodeAndCellData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt4 > &cells, std::vector< std::string > &nodedatanames, std::vector< std::vector< double > > &nodedata, std::vector< std::string > &celldatanames, std::vector< std::vector< double > > &celldata) override
std::string writeOctsWithCellData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt8 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &celldata) override
std::string writeTrianglesWithNodeData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &nodedata) override
std::string writeQuadsWithCellData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt4 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &celldata) override
std::string writeLines(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt2 > &lines) override
std::string writeTrianglesWithNodeData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &nodedata) override
std::string writeTriangles(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &cells) override
std::string writeQuads(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt4 > &cells) override
std::string writeQuadsWithNodeData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt4 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &nodedata) override
std::string writeOcts(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt8 > &cells) override
std::string writeOctsWithNodeData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleUInt8 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &nodedata) override
bool makeDirectory(const std::string &dir)
std::string getPathFromString(const std::string &fileStringWithPath)
void swapByteOrder(unsigned char *toSwap, int length)