VtkWriter.hh 18.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
 * 
 ******************************************************************************/



/** \file VtkVector.hh */

#ifndef AMDIS_VTKWRITER_DETAIL_HH
#define AMDIS_VTKWRITER_DETAIL_HH

#include "BasisFunction.h"
#include "io/DataCollector.h"

namespace AMDiS  { namespace io {
  
    namespace VtkWriter
    {
35
	
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
      template<typename T>
      void Aux::writeFileToStream(T &file)
      {
	int nVertices = (*dataCollector)[0]->getNumberVertices();
	int nElements = (*dataCollector)[0]->getNumberElements();
	int vertices = (*dataCollector)[0]->getMesh()->getGeo(VERTEX);

	if (dim == 2 && degree == 2) {
	  nVertices += (*dataCollector)[0]->getNumberInterpPoints();
	  nElements *= 4;
	} else if (dim == 2 && degree == 3) {
	  nVertices += (*dataCollector)[0]->getNumberInterpPoints();
	  nElements *= 9;
	} else if (dim == 2 && degree == 4) {
	  nVertices += (*dataCollector)[0]->getNumberInterpPoints();
	  nElements *= 16;
	}
	file << "<?xml version=\"1.0\"?>\n";
	file << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
	file << "  <UnstructuredGrid>\n";
	file << "    <Piece NumberOfPoints=\"" << nVertices 
	    << "\" NumberOfCells=\"" << nElements << "\">\n";
	file << "      <Points>\n";
	file << "        <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
	
	writeVertexCoords(file);
	
	file << "        </DataArray>\n";
	file << "      </Points>\n";
	file << "      <Cells>\n";
	file << "        <DataArray type=\"Int32\" Name=\"offsets\">\n";
	
	for (int i = 0; i < nElements; i++)
	  file << " " << (i + 1) * vertices << "\n";

	file << "        </DataArray>\n";
	file << "        <DataArray type=\"UInt8\" Name=\"types\">\n";

	for (int i = 0; i < nElements; i++) {
	  switch (vertices) {
	  case 2:
	    file << " 3\n";
	    break;
	  case 3: 
	    file << " 5\n";
	    break;
	  case 4:
	    file << " 10\n";
	    break;		    
	  default:
	    break;
	  }	   
	}

	file << "        </DataArray>\n";
	file << "        <DataArray type=\"Int32\" Name=\"connectivity\">\n";

	writeConnectivity(file);
	
	file << "        </DataArray>\n";    
	file << "      </Cells>\n";
	file << "      <PointData>\n";
	
Praetorius, Simon's avatar
Praetorius, Simon committed
99
100
101
	int nValues = static_cast<int>(dataCollector->size());
	nValues = writeAsVector ? std::min(nValues,1) : nValues;	
	for (int i = 0; i < nValues; i++) {
102
	  file << "        <DataArray type=\"Float32\" Name=\"" 
Praetorius, Simon's avatar
Praetorius, Simon committed
103
104
105
106
107
	      << componentNames[i]
	      << "\" format=\"ascii\"";
	  if (writeAsVector && dataCollector->size() > 1)
	    file << " NumberOfComponents=\"" << std::max(3,static_cast<int>(dataCollector->size())) << "\"";
	  file << ">\n"; 
108
109
110
111
112
113
114
115
116
117
118

	  writeVertexValues(file, i);
	  
	  file << "        </DataArray>\n";
	}
	
	file << "      </PointData>\n";
	file << "    </Piece>\n";
	file << "  </UnstructuredGrid>\n";
	file << "</VTKFile>\n";
      }
119
120
121
122
123
124
125
126
      
      template<typename T>
      void Aux::writeFileToStreamAppended(T &file)
      {
	using namespace std;
	
	bstream.str("");
	
Praetorius, Simon's avatar
Praetorius, Simon committed
127
128
	int valueSize = writeAsVector ? 1 : static_cast<int>(dataCollector->size());
	valueSize = std::min(valueSize, static_cast<int>(dataCollector->size()));
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
	int nDataArray = 4 + valueSize;
	vector<string> dataBase64Vec(nDataArray, "");
	vector<size_t> dataOffsetVec(nDataArray, 0);
	string finalData = "";
	
	int nVertices = (*dataCollector)[0]->getNumberVertices();
	int nElements = (*dataCollector)[0]->getNumberElements();
	int vertices = (*dataCollector)[0]->getMesh()->getGeo(VERTEX);

	if (dim == 2 && degree == 2) {
	  nVertices += (*dataCollector)[0]->getNumberInterpPoints();
	  nElements *= 4;
	} else if (dim == 2 && degree == 3) {
	  nVertices += (*dataCollector)[0]->getNumberInterpPoints();
	  nElements *= 9;
	} else if (dim == 2 && degree == 4) {
	  nVertices += (*dataCollector)[0]->getNumberInterpPoints();
	  nElements *= 16;
	}
	//DataArray
	for (int i = 0; i < valueSize; i++) {
	  writeVertexValues(bstream, i);
	  dataBase64Vec[i] = getStreamData();
	}
	//DataArray
	writeVertexCoords(bstream);
 	dataBase64Vec[valueSize] = getStreamData();
	//DataArray
	writeConnectivity(bstream);
 	dataBase64Vec[valueSize + 1] = getStreamData();
	//DataArray
	uint32_t tmp32 = 0;
Siqi Ling's avatar
Siqi Ling committed
161
162
	for (int i = 1; i <= nElements; i++) {
	  tmp32 = i * vertices;
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
	  bstream << tmp32;
	}
 	dataBase64Vec[valueSize + 2] = getStreamData();
	//DataArray
	uint8_t tmp8 = 0;
	for (int i = 0; i < nElements; i++) {
	  switch (vertices) {
	  case 2:
	    tmp8 = 3;
	    break;
	  case 3: 
	    tmp8 = 5;
	    break;
	  case 4:
	    tmp8 = 10;
	    break;		    
	  default:
	    tmp8 = 0;
	    break;
	  }	   
	  if(tmp8)
	    bstream << tmp8;
	}
 	dataBase64Vec[valueSize + 3] = getStreamData();
	
	finalData = dataBase64Vec[0];
	for(int i = 1; i < nDataArray; i++)
	{
	  dataOffsetVec[i] = dataBase64Vec[i - 1].length() + dataOffsetVec[i - 1];
	  finalData += dataBase64Vec[i];
	}
	
	file << "<?xml version=\"1.0\"?>\n";
	file << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\"";
	if(format == APPENDED_COMPRESSED)
	  file << " compressor=\"vtkZLibDataCompressor\"";
	file << ">\n";
	file << "  <UnstructuredGrid>\n";
	file << "    <Piece NumberOfPoints=\"" << nVertices 
	    << "\" NumberOfCells=\"" << nElements << "\">\n";
	file << "      <PointData>\n";
	
	for (int i = 0; i < valueSize; i++) {
	  if(bstream.isHighPrecision())
	    file << "        <DataArray type=\"Float64\" Name=\"";
	  else
	    file << "        <DataArray type=\"Float32\" Name=\"";
	  
Praetorius, Simon's avatar
Praetorius, Simon committed
211
212
213
214
215
	  file << componentNames[i] 
	      << "\" format=\"appended\" offset=\"" << dataOffsetVec[i] << "\"";
	  if (writeAsVector && dataCollector->size() > 1)
	    file << " NumberOfComponents=\"" << std::max(3,static_cast<int>(dataCollector->size())) << "\"";
	  file << "/>\n"; 
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
	}
	
	file << "      </PointData>\n";
	file << "      <CellData>\n";
	file << "      </CellData>\n";
	file << "      <Points>\n";
	if(bstream.isHighPrecision())
	  file << "        <DataArray type=\"Float64\"";
	else
	  file << "        <DataArray type=\"Float32\"";
	file << " Name=\"Points\" NumberOfComponents=\"3\" format=\"appended\" offset=\"" << dataOffsetVec[valueSize] << "\"/>\n";
	file << "      </Points>\n";
	file << "      <Cells>\n";
	file << "        <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\"" << dataOffsetVec[valueSize + 1] << "\"/>\n";
	file << "        <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\"" << dataOffsetVec[valueSize + 2] << "\"/>\n";
	file << "        <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\"" << dataOffsetVec[valueSize + 3] << "\"/>\n";
	file << "      </Cells>\n";
	file << "    </Piece>\n";
	file << "  </UnstructuredGrid>\n";
235
236
// 	file << "  <AppendedData encoding=\"base64\">\n";
	file << "  <AppendedData encoding=\"raw\">\n";
237
238
239
240
241
	file << "   _" << finalData << "\n";
	file << "  </AppendedData>\n";
	file << "</VTKFile>\n";
	
      }
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280

      
      template<typename T>
      void Aux::writeVertexCoords(T &file)
      {
	DOFVector<std::list<VertexInfo> > *vertexInfos = 
	  (*dataCollector)[0]->getVertexInfos();
	DOFVector<std::list<VertexInfo> >::Iterator it(vertexInfos, USED_DOFS);
	int counter = 0;

	// For all DOFs of vertices, write the coordinates.
	for (it.reset(); !it.end(); ++it) {
	  // for all vertex infos of this DOF
	  for (std::list<VertexInfo>::iterator it2 = it->begin(); it2 != it->end(); ++it2) {
	    it2->outputIndex = counter++;
	    detail::writeCoord(file, it2->coords);
	  }     
	}

	// For the second dim case, write also the interpolation points.
	if ((dim == 2) && (degree > 1)) {
	  DOFVector<std::list< WorldVector<double> > > *interpPointCoords = (*dataCollector)[0]->getInterpPointCoords();
	  DOFVector<std::list< WorldVector<double> > >::Iterator pointIt(interpPointCoords, USED_DOFS);
	  
	  counter = 0;
	  for (pointIt.reset(); !pointIt.end(); ++pointIt) {
	    for (std::list< WorldVector<double> >::iterator it2 = pointIt->begin(); 
		it2 != pointIt->end(); ++it2) {
	      counter++;
	      detail::writeCoord(file, *it2);
	    }
	  }
	}
      }


      template<typename T>
      void Aux::writeVertexValues(T &file, int componentNo)
      {
Praetorius, Simon's avatar
Praetorius, Simon committed
281
282
283
284
285
	if (writeAsVector) {
	  writeVertexValues(file);
	  return;
	}
	
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
	DOFVector<int> *interpPointInd = (*dataCollector)[componentNo]->getInterpPointInd();
	DOFVector<double> *values = (*dataCollector)[componentNo]->getValues();
	DOFVector<std::list<WorldVector<double> > > *dofCoords = (*dataCollector)[componentNo]->getDofCoords();

	DOFVector<int>::Iterator intPointIt(interpPointInd, USED_DOFS);
	DOFVector<double>::Iterator valueIt(values, USED_DOFS);
	DOFVector<std::list<WorldVector<double> > >::Iterator coordIt(dofCoords, USED_DOFS);

	file << std::scientific;
	file.precision(15);
	    
	// Write the values for all vertex DOFs.
	for (intPointIt.reset(), valueIt.reset(), coordIt.reset();
	    !intPointIt.end(); 
	    ++intPointIt, ++valueIt, ++coordIt) {

	  if (*intPointIt == -2) 
	    for (int i = 0; i < static_cast<int>(coordIt->size()); i++) 
	      file << " " << (fabs(*valueIt) < 1e-40 ? 0.0 : *valueIt) << "\n";      
	}        

	// For the second dim case, write also the values of the interpolation points.
	if ((dim == 2) && (degree > 1)) {
	  DOFVector<std::list<WorldVector<double> > >::Iterator 
	    interpCoordIt((*dataCollector)[componentNo]->getInterpPointCoords(), USED_DOFS);
	
	  for (intPointIt.reset(), valueIt.reset(), interpCoordIt.reset();
	      !intPointIt.end(); 
	      ++intPointIt, ++valueIt, ++interpCoordIt) {      
	    
	    if (*intPointIt >= 0) {
	      for (unsigned int i = 0; i < interpCoordIt->size(); i++)
		file << " " << (fabs(*valueIt) < 1e-40 ? 0.0 : *valueIt) << "\n";
	    }
	  }
	}    
      }
Praetorius, Simon's avatar
Praetorius, Simon committed
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
      
      


      template<typename T>
      void Aux::writeVertexValues(T &file)
      {	
	DOFVector<int> *interpPointInd = (*dataCollector)[0]->getInterpPointInd();
	std::vector<DOFVector<double>*> values(dataCollector->size());	
	DOFVector<std::list<WorldVector<double> > > *dofCoords = (*dataCollector)[0]->getDofCoords();
	
	for (size_t i = 0; i < dataCollector->size(); i++)
	  values[i] = (*dataCollector)[i]->getValues();
	
	DOFIterator<int> intPointIt(interpPointInd, USED_DOFS);
	DOFVectorIterator<double> valueIt(values, USED_DOFS);
	DOFIterator<std::list<WorldVector<double> > > coordIt(dofCoords, USED_DOFS);
	
	file << std::scientific;
	file.precision(15);
	    
	// Write the values for all vertex DOFs.
	for (intPointIt.reset(), valueIt.reset(), coordIt.reset(); 
	     !intPointIt.end(); 
	     ++intPointIt, ++valueIt, ++coordIt) {

	  if (*intPointIt == -2) 
	    for (int i = 0; i < static_cast<int>(coordIt->size()); i++) {
	      file << " " ;
	      print(*valueIt, file);
	      file << "\n";
	    }
	}        

	// For the second dim case, write also the values of the interpolation points.
	if ((dim == 2) && (degree > 1)) {
	  DOFVector< std::list<WorldVector<double> > >::Iterator 
	    interpCoordIt((*dataCollector)[0]->getInterpPointCoords(), USED_DOFS);
	
	  for (intPointIt.reset(), valueIt.reset(), interpCoordIt.reset();
	      !intPointIt.end(); 
	      ++intPointIt, ++valueIt, ++interpCoordIt) {      
	    
	    if (*intPointIt >= 0) {
	      for (unsigned int i = 0; i < interpCoordIt->size(); i++) {
		file << " ";
		print(*valueIt, file);
		file << "\n";
	      }
	    }
	  }
	}
      }
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583

      template<typename T>
      void Aux::writeConnectivity(T &file)
      {	
	// For the second dim case, and if higher order Lagrange elements are used,
	// write the connectivity by extra functions.
	if ((dim == 2) && (degree == 2)) {
	  detail::writeConnectivity_dim2_degree2((*dataCollector)[0], file);
	} else if ((dim == 2) && (degree == 3)) {
	  detail::writeConnectivity_dim2_degree3((*dataCollector)[0], file);
	} else if ((dim == 2) && (degree == 4)) {
	  detail::writeConnectivity_dim2_degree4((*dataCollector)[0], file);   
	} else {
	  std::list<ElementInfo> *elements = (*dataCollector)[0]->getElementInfos();
	  std::list<ElementInfo>::iterator elementIt;
	  int vertices = (*dataCollector)[0]->getMesh()->getGeo(VERTEX);
	  
	  for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
	    // for all vertices
	    for (int i = 0; i < vertices; i++) {
	      file << " " << elementIt->vertexInfo[i]->outputIndex;
	    }
	    file << "\n";
	  } 
	}
      }
      
// __________________________________________________________________________ //
      
      namespace detail
      {
	template<typename S, typename T>
	void writeConnectivity_dim2_degree2(DataCollector<S>* dataCollector, T &file)
	{
	  std::list<ElementInfo> *elements = dataCollector->getElementInfos();
	  std::list<ElementInfo>::iterator elementIt;

	  std::vector< std::vector<int> > *interpPoints = dataCollector->getInterpPoints();
	  std::vector< std::vector<int> >::iterator pointIt;

	  int nVertices = dataCollector->getNumberVertices();

	  for (pointIt = interpPoints->begin(), elementIt = elements->begin(); 
	      pointIt != interpPoints->end(); 
	      ++pointIt, ++elementIt) {
	  
	    file << " " << elementIt->vertexInfo[0]->outputIndex
		<< " " << (*pointIt)[1] + nVertices
		<< " " << (*pointIt)[2] + nVertices << "\n";

	    file << " " << elementIt->vertexInfo[2]->outputIndex 
		<< " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[1] + nVertices << "\n";

	    file << " " << elementIt->vertexInfo[1]->outputIndex
		<< " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[2] + nVertices << "\n";

	    file << " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[1] + nVertices 
		<< " " << (*pointIt)[2] + nVertices << "\n";
	  }
	}


	template<typename S, typename T>
	void writeConnectivity_dim2_degree3(DataCollector<S>* dataCollector, T &file)
	{
	  std::list<ElementInfo> *elements = dataCollector->getElementInfos();
	  std::list<ElementInfo>::iterator elementIt;

	  std::vector< std::vector<int> > *interpPoints = dataCollector->getInterpPoints();
	  std::vector< std::vector<int> >::iterator pointIt;

	  int nVertices = dataCollector->getNumberVertices();

	  for (pointIt = interpPoints->begin(), elementIt = elements->begin(); 
	      pointIt != interpPoints->end(); 
	      ++pointIt, ++elementIt) {
				
	    file << " " << elementIt->vertexInfo[0]->outputIndex
		<< " " << (*pointIt)[3] + nVertices
		<< " " << (*pointIt)[4] + nVertices << "\n";

	    file << " " << (*pointIt)[4] + nVertices
		<< " " << (*pointIt)[5] + nVertices
		<< " " << (*pointIt)[6] + nVertices << "\n";

	    file << " " << (*pointIt)[3] + nVertices
		<< " " << (*pointIt)[4] + nVertices
		<< " " << (*pointIt)[6] + nVertices << "\n";

	    file << " " << (*pointIt)[2] + nVertices
		<< " " << (*pointIt)[3] + nVertices
		<< " " << (*pointIt)[6] + nVertices << "\n";

	    file << " " << elementIt->vertexInfo[1]->outputIndex
		<< " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[5] + nVertices << "\n";

	    file << " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[6] + nVertices
		<< " " << (*pointIt)[5] + nVertices << "\n";

	    file << " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[1] + nVertices
		<< " " << (*pointIt)[6] + nVertices << "\n";

	    file << " " << (*pointIt)[1] + nVertices
		<< " " << (*pointIt)[2] + nVertices
		<< " " << (*pointIt)[6] + nVertices << "\n";

	    file << " " << elementIt->vertexInfo[2]->outputIndex 
		<< " " << (*pointIt)[1] + nVertices
		<< " " << (*pointIt)[2] + nVertices << "\n";
	  
	    
	  }
	}


	template<typename S, typename T>
	void writeConnectivity_dim2_degree4(DataCollector<S>* dataCollector, T &file)
	{
	  std::list<ElementInfo> *elements = dataCollector->getElementInfos();
	  std::list<ElementInfo>::iterator elementIt;

	  std::vector< std::vector<int> > *interpPoints = dataCollector->getInterpPoints();
	  std::vector< std::vector<int> >::iterator pointIt;

	  int nVertices = dataCollector->getNumberVertices();

	  for (pointIt = interpPoints->begin(), elementIt = elements->begin(); 
	      pointIt != interpPoints->end(); 
	      ++pointIt, ++elementIt) {

	    file << " " << elementIt->vertexInfo[0]->outputIndex 
		<< " " << (*pointIt)[5] + nVertices
		<< " " << (*pointIt)[6] + nVertices << "\n";

	    file << " " << (*pointIt)[5] + nVertices
		<< " " << (*pointIt)[9] + nVertices
		<< " " << (*pointIt)[6] + nVertices << "\n";

	    file << " " << (*pointIt)[6] + nVertices
		<< " " << (*pointIt)[7] + nVertices
		<< " " << (*pointIt)[9] + nVertices << "\n";

	    file << " " << (*pointIt)[7] + nVertices
		<< " " << (*pointIt)[9] + nVertices
		<< " " << (*pointIt)[10] + nVertices << "\n";

	    file << " " << (*pointIt)[7] + nVertices
		<< " " << (*pointIt)[8] + nVertices
		<< " " << (*pointIt)[10] + nVertices << "\n";

	    file << " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[8] + nVertices
		<< " " << (*pointIt)[10] + nVertices << "\n";

	    file << " " << elementIt->vertexInfo[1]->outputIndex 
		<< " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[8] + nVertices << "\n";

	    file << " " << (*pointIt)[4] + nVertices
		<< " " << (*pointIt)[5] + nVertices
		<< " " << (*pointIt)[9] + nVertices << "\n";

	    file << " " << (*pointIt)[4] + nVertices
		<< " " << (*pointIt)[9] + nVertices
		<< " " << (*pointIt)[11] + nVertices << "\n";

	    file << " " << (*pointIt)[9] + nVertices
		<< " " << (*pointIt)[10] + nVertices
		<< " " << (*pointIt)[11] + nVertices << "\n";

	    file << " " << (*pointIt)[1] + nVertices
		<< " " << (*pointIt)[10] + nVertices
		<< " " << (*pointIt)[11] + nVertices << "\n";

	    file << " " << (*pointIt)[0] + nVertices
		<< " " << (*pointIt)[1] + nVertices
		<< " " << (*pointIt)[10] + nVertices << "\n";

	    file << " " << (*pointIt)[3] + nVertices
		<< " " << (*pointIt)[4] + nVertices
		<< " " << (*pointIt)[11] + nVertices << "\n";

	    file << " " << (*pointIt)[2] + nVertices
		<< " " << (*pointIt)[3] + nVertices
		<< " " << (*pointIt)[11] + nVertices << "\n";

	    file << " " << (*pointIt)[1] + nVertices
		<< " " << (*pointIt)[2] + nVertices
		<< " " << (*pointIt)[11] + nVertices << "\n";

	    file << " " << elementIt->vertexInfo[2]->outputIndex 
		<< " " << (*pointIt)[2] + nVertices
		<< " " << (*pointIt)[3] + nVertices << "\n";

	  }
	}
	
      } // end namespace detail
    } // end namespace VtkWriter
} } // end namespace io, AMDiS

#endif // AMDIS_VTKWRITER_DETAIL_HH