110 fprintf(stream,
"# vtk DataFile Version 2.0\n");
111 fprintf( stream,
"Output for time %f\n", tStep->
giveTargetTime() );
112 fprintf(stream,
"ASCII\n");
114 fprintf(stream,
"DATASET UNSTRUCTURED_GRID\n");
124 fprintf(stream,
"POINTS %d double\n", nnodes);
133 for ( inode = 1; inode <= regionDofMans; inode++ ) {
134 coords = d->
giveNode( map.at(inode) )->giveCoordinates();
135 for ( i = 1; i <= coords->
giveSize(); i++ ) {
136 fprintf( stream,
"%e ", coords->
at(i) );
139 for ( i = coords->
giveSize() + 1; i <= 3; i++ ) {
140 fprintf(stream,
"%e ", 0.0);
143 fprintf(stream,
"\n");
146 int elemToProcess = 0;
147 int ncells, celllistsize = 0;
163 fprintf(stream,
"\nCELLS %d %d\n", elemToProcess, celllistsize);
165 IntArray regionNodalNumbers(nnodes);
178 fprintf(stream,
"%d ", nelemNodes);
179 for ( i = 1; i <= nelemNodes; i++ ) {
180 fprintf(stream,
"%d ", regionNodalNumbers.
at( cellNodes.
at(i) ) - 1);
183 fprintf(stream,
"\n");
187 fprintf(stream,
"\nCELL_TYPES %d\n", elemToProcess);
194 fprintf(stream,
"%d\n", vtkCellType);
231 std :: string fileName;
234 if ( ( answer = fopen(fileName.c_str(),
"w") ) == NULL ) {
235 OOFEM_ERROR(
"failed to open file %s", fileName.c_str());
245 if ( elemGT == EGT_point ) {
247 }
else if ( elemGT == EGT_line_1 ) {
249 }
else if ( elemGT == EGT_line_2 ) {
251 }
else if ( elemGT == EGT_triangle_1 ) {
253 }
else if ( elemGT == EGT_triangle_2 ) {
255 }
else if ( elemGT == EGT_tetra_1 ) {
257 }
else if ( elemGT == EGT_tetra_2 ) {
259 }
else if ( elemGT == EGT_quad_1 ) {
261 }
else if ( elemGT == EGT_quad_2 ) {
263 }
else if ( elemGT == EGT_hexa_1 ) {
265 }
else if ( elemGT == EGT_hexa_2 ) {
267 }
else if ( elemGT == EGT_wedge_1 ) {
269 }
else if ( elemGT == EGT_wedge_2 ) {
281 switch ( cellType ) {
327 if ( ( elemGT == EGT_point ) ||
328 ( elemGT == EGT_line_1 ) || ( elemGT == EGT_line_2 ) ||
329 ( elemGT == EGT_triangle_1 ) || ( elemGT == EGT_triangle_2 ) ||
330 ( elemGT == EGT_tetra_1 ) || ( elemGT == EGT_tetra_2 ) ||
331 ( elemGT == EGT_quad_1 ) || ( elemGT == EGT_quad_2 ) ||
332 ( elemGT == EGT_hexa_1 ) || ( elemGT == EGT_wedge_1 ) ) {
334 answer.
resize(nelemNodes);
335 for ( i = 1; i <= nelemNodes; i++ ) {
338 }
else if ( elemGT == EGT_hexa_2 ) {
339 int HexaQuadNodeMapping [] = {
340 5, 8, 7, 6, 1, 4, 3, 2, 16, 15, 14, 13, 12, 11, 10, 9, 17, 20, 19, 18
343 answer.
resize(nelemNodes);
344 for ( i = 1; i <= nelemNodes; i++ ) {
347 }
else if ( elemGT == EGT_wedge_2 ) {
348 int WedgeQuadNodeMapping [] = {
349 4, 6, 5, 1, 3, 2, 12, 11, 10, 9, 8, 7, 13, 15, 14
352 answer.
resize(nelemNodes);
353 for ( i = 1; i <= nelemNodes; i++ ) {
367 if ( ( elemGT == EGT_point ) ||
368 ( elemGT == EGT_line_1 ) || ( elemGT == EGT_line_2 ) ||
369 ( elemGT == EGT_triangle_1 ) || ( elemGT == EGT_triangle_2 ) ||
370 ( elemGT == EGT_tetra_1 ) || ( elemGT == EGT_tetra_2 ) ||
371 ( elemGT == EGT_quad_1 ) || ( elemGT == EGT_quad_2 ) ||
372 ( elemGT == EGT_hexa_1 ) || ( elemGT == EGT_hexa_2 ) ||
373 ( elemGT == EGT_wedge_1 ) || ( elemGT == EGT_wedge_2 ) ) {
397 for ( i = 1; i <= n; i++ ) {
414 fprintf(stream,
"\nCELL_DATA %d\n", elemToProcess);
418 case IST_MaterialNumber:
419 case IST_ElementNumber:
426 if ( type == IST_MaterialNumber || type == IST_CrossSectionNumber ) {
427 OOFEM_WARNING(
"Material numbers are deprecated, outputing cross section number instead...");
428 fprintf( stream,
"%d\n", elem->giveCrossSection()->giveNumber() );
429 }
else if ( type == IST_ElementNumber ) {
430 fprintf( stream,
"%d\n", elem->giveNumber() );
438 case IST_MaterialOrientation_x:
439 case IST_MaterialOrientation_y:
440 case IST_MaterialOrientation_z:
441 if ( type == IST_MaterialOrientation_x ) {
443 }
else if ( type == IST_MaterialOrientation_y ) {
451 if ( !elem->giveLocalCoordinateSystem(mtrx) ) {
456 fprintf( stream,
"%f %f %f\n", mtrx.
at(1, pos), mtrx.
at(2, pos), mtrx.
at(3, pos) );
479 for (
GaussPoint *gp: *elem->giveDefaultIntegrationRulePtr() ) {
480 elem->giveIPValue(temp, gp, type, tStep);
481 gptot += gp->giveWeight();
482 vec.
add(gp->giveWeight(), temp);
484 vec.
times(1 / gptot);
485 for (
int j = 1; j <= vec.
giveSize(); ++j ) {
486 fprintf( stream,
"%e ", vec.
at(j) );
488 fprintf(stream,
"\n");
491 #if 0 // Hardly even worth the effort... 493 for (
int indx = 1; indx < 9; ++indx ) {
496 for ( ielem = 1; ielem <= nelem; ielem++ ) {
498 elem->
giveIPValue(vec, elem->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), type, tStep);
499 fprintf( stream,
"%e ", vec.
at(indx) );
508 fprintf(stream,
"\n\n");
524 std :: vector< char > map(nnodes);
528 for (
int j = 0; j < nnodes; j++ ) {
537 elemnodes = elem->giveNumberOfNodes();
538 for (
int ielemnode = 1; ielemnode <= elemnodes; ielemnode++ ) {
539 map [ elem->giveNode(ielemnode)->giveNumber() - 1 ] = 1;
543 for (
int j = 0; j < nnodes; j++ ) {
544 rbrnodes += map [ j ];
553 int offset,
Domain *domain,
int reg,
int mode)
564 int currOffset = offset + 1;
566 regionNodalNumbers.
resize(nnodes);
567 regionNodalNumbers.
zero();
576 elemNodes = element->giveNumberOfNodes();
580 for (
int elementNode = 1; elementNode <= elemNodes; elementNode++ ) {
581 int node = element->giveNode(elementNode)->giveNumber();
582 if ( regionNodalNumbers.
at(node) == 0 ) {
586 regionNodalNumbers.
at(node) = 1;
594 for (
int i = 1; i <= nnodes; i++ ) {
595 if ( regionNodalNumbers.
at(i) ) {
596 regionNodalNumbers.
at(i) = currOffset++;
597 answer.
at( regionNodalNumbers.
at(i) ) = i;
601 regionNodalNumbers = answer;
603 for (
int i = 1; i <= nnodes; i++ ) {
604 if ( regionNodalNumbers.
at(i) ) {
605 regionNodalNumbers.
at(i) = currOffset++;
634 for (
int indx = 1; indx <= nindx; indx++ ) {
649 fprintf(stream,
"LOOKUP_TABLE default\n");
652 if ( !( ( valID == IST_DisplacementVector ) || ( valID == IST_MaterialInterfaceVal ) ) ) {
656 IntArray regionNodalNumbers(nnodes);
657 int regionDofMans = 0, offset = 0;
662 if ( !( ( valID == IST_DisplacementVector ) || ( valID == IST_MaterialInterfaceVal ) ) ) {
666 regionDofMans = nnodes;
669 for ( inode = 1; inode <= regionDofMans; inode++ ) {
670 if ( valID == IST_DisplacementVector ) {
673 for ( j = 1; j <= 3; j++ ) {
674 iVal.
at(j) = d->
giveNode( regionNodalNumbers.
at(inode) )->giveUpdatedCoordinate(j, tStep, 1.0) -
675 d->
giveNode( regionNodalNumbers.
at(inode) )->giveCoordinate(j);
677 }
else if ( valID == IST_MaterialInterfaceVal ) {
699 fprintf( stream,
"%e ", val->
at(1) );
701 fprintf(stream,
"%e ", 0.0);
705 for ( j = 1; j <= jsize; j++ ) {
706 fprintf( stream,
"%e ", val->
at(j) );
709 for ( j = jsize + 1; j <= 3; j++ ) {
710 fprintf(stream,
"0.0 ");
714 for (
int ii = 1; ii <= 6; ii++ ) {
716 t.
at(1, 1) = val->
at(ii);
717 }
else if ( ii == 2 ) {
718 t.
at(2, 2) = val->
at(ii);
719 }
else if ( ii == 3 ) {
720 t.
at(3, 3) = val->
at(ii);
721 }
else if ( ii == 4 ) {
722 t.
at(2, 3) = val->
at(ii);
723 t.
at(3, 2) = val->
at(ii);
724 }
else if ( ii == 5 ) {
725 t.
at(1, 3) = val->
at(ii);
726 t.
at(3, 1) = val->
at(ii);
727 }
else if ( ii == 6 ) {
728 t.
at(1, 2) = val->
at(ii);
729 t.
at(2, 1) = val->
at(ii);
733 for (
int ii = 1; ii <= 3; ii++ ) {
734 for (
int jj = 1; jj <= 3; jj++ ) {
735 fprintf( stream,
"%e ", t.
at(ii, jj) );
738 fprintf(stream,
"\n");
741 fprintf( stream,
"%e ", val->
at(indx) );
744 fprintf(stream,
"\n");
785 if ( ( valID == DisplacementVector ) || ( valID == EigenVector ) || ( valID == VelocityVector ) ) {
787 }
else if ( ( valID == FluxVector ) || ( valID == PressureVector ) || ( valID == Temperature ) || ( valID == Humidity )) {
800 fprintf(stderr,
"exportPrimVarAs: unsupported variable type\n");
804 fprintf(stream,
"LOOKUP_TABLE default\n");
809 IntArray regionNodalNumbers(nnodes);
810 int regionDofMans = 0, offset = 0;
820 for (
int inode = 1; inode <= regionDofMans; inode++ ) {
823 if ( ( valID == DisplacementVector ) || ( valID == EigenVector ) || ( valID == VelocityVector ) ) {
827 for (
Dof *dof: *dman ) {
828 id = dof->giveDofID();
829 if ( (
id == V_u ) || (
id == D_u ) ) {
830 iVal.
at(1) = dof->giveUnknown(VM_Total, tStep);
831 }
else if ( (
id == V_v ) || (
id == D_v ) ) {
832 iVal.
at(2) = dof->giveUnknown(VM_Total, tStep);
833 }
else if ( (
id == V_w ) || (
id == D_w ) ) {
834 iVal.
at(3) = dof->giveUnknown(VM_Total, tStep);
837 }
else if ( (valID == FluxVector) || (valID == Humidity) ) {
840 for (
Dof *dof: *dman ) {
841 id = dof->giveDofID();
843 iVal.
at(1) = dof->giveUnknown(VM_Total, tStep);
846 }
else if ( valID == Temperature ) {
849 for (
Dof *dof: *dman ) {
850 id = dof->giveDofID();
852 iVal.
at(1) = dof->giveUnknown(VM_Total, tStep);
855 }
else if ( valID == PressureVector ) {
864 for ( j = 1; j <= nScalarComp; j++ ) {
865 fprintf( stream,
"%e ", iVal.
at(j) );
868 fprintf(stream,
"%e ", 0.0);
879 for ( j = 1; j <= jsize; j++ ) {
880 fprintf( stream,
"%e ", iVal.
at(j) );
883 for ( j = jsize + 1; j <= 3; j++ ) {
884 fprintf(stream,
"0.0 ");
888 fprintf(stream,
"\n");
891 fprintf(stream,
"\n");
906 for (
int j = 1; j <= size; j++ ) {
909 answer.
at(j) = dman->
giveDofWithID( dofIDMask.
at(j) )->giveUnknown(VM_Total, tStep);
910 }
else if ( iType != IST_Undefined ) {
923 if ( size == recoveredVal->
giveSize() ) {
924 answer.
at(j) = recoveredVal->
at(j);
926 OOFEM_WARNING(
"recovered variable size mismatch for %d", iType);
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
IntArray cellVarsToExport
List of cell data to export.
bool testTimeStepOutput(TimeStep *tStep)
Tests if given time step output is required.
NodalRecoveryModel * createNodalRecoveryModel(NodalRecoveryModel::NodalRecoveryModelType type, Domain *d)
Creates new instance of nodal recovery model corresponding to given type.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Element_Geometry_Type
Enumerative type used to classify element geometry Possible values are: EGT_point - point in space EG...
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
FILE * giveOutputStream(TimeStep *tStep)
Returns the output stream for given solution step.
#define _IFT_VTKExportModule_stype
void zero()
Sets all component to zero.
double & at(int i)
Coefficient access function.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
void clear()
Clears receiver (zero size).
virtual MaterialInterface * giveMaterialInterface(int n)
Returns material interface representation for given domain.
IntArray internalVarsToExport
List of InternalStateType values, identifying the selected vars for export.
virtual void initialize()
double giveTargetTime()
Returns target time.
void exportCellVars(FILE *stream, int elemToProcess, TimeStep *tStep)
Export variables defined on cells.
IntArray primaryVarsToExport
List of primary unknowns to export.
Abstract base class for all finite elements.
InternalStateValueType
Determines the type of internal variable.
symmetric 3x3 tensor, packed with off diagonal components multiplied by 2 (engineering strain vector...
Base class for dof managers.
Represents export output module - a base class for all output modules.
#define OOFEM_LOG_DEBUG(...)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
const char * __UnknownTypeToString(UnknownType _value)
int giveInternalStateTypeSize(InternalStateValueType valType)
void exportIntVarAs(InternalStateType valID, InternalStateValueType type, FILE *stream, TimeStep *tStep)
Exports single variable.
#define _IFT_VTKExportModule_primvars
virtual int giveNumberOfNodes() const
Returns number of nodes of receiver.
#define _IFT_VTKExportModule_vars
virtual ~VTKExportModule()
Destructor.
virtual void initialize()
int giveTotalRBRNumberOfNodes(Domain *d)
Computes total number of nodes (summed Region by Region, nodes on region boundaries are added multipl...
void getDofManPrimaryVariable(FloatArray &answer, DofManager *dman, IntArray &dofIDMask, ValueModeType mode, TimeStep *tStep, InternalStateType iType)
Returns the value of Primary variable at given dof manager.
Element * giveElement(int n)
Service for accessing particular domain fe element.
int giveCellType(Element *tStep)
Returns corresponding element cell_type.
int giveNodalVector(const FloatArray *&ptr, int node)
Returns vector of recovered values for given node and region.
DofIDItem
Type representing particular dof type.
EngngModel * emodel
Problem pointer.
#define _IFT_VTKExportModule_cellvars
UnknownType
Type representing particular unknown (its physical meaning).
Abstract base class representing (moving) material interfaces.
Set of elements, boundaries, edges and/or nodes.
void giveElementCell(IntArray &answer, Element *elem, int cell)
Returns the element cell geometry.
NodalRecoveryModel::NodalRecoveryModelType stype
Smoother type.
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix^T and anArray.
double at(int i, int j) const
Coefficient access function.
void resize(int n)
Checks size of receiver towards requested bounds.
void exportIntVars(FILE *stream, TimeStep *tStep)
Export internal variables.
Class representing vector of real numbers.
bool hasDofID(DofIDItem id) const
Checks if receiver contains dof with given ID.
Element is local, there are no contributions from other domains to this element.
Implementation of matrix containing floating point numbers.
void exportPrimVarAs(UnknownType valID, FILE *stream, TimeStep *tStep)
Exports single variable.
IRResultType
Type defining the return values of InputRecord reading operations.
Represents VTK (Visualization Toolkit) export module.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
int giveNumberOfElementCells(Element *)
Returns the number of elements vtk cells.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
virtual void terminate()
Terminates the receiver.
virtual int recoverValues(Set elementSet, InternalStateType type, TimeStep *tStep)=0
Recovers the nodal values for all regions.
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
void exportPrimaryVars(FILE *stream, TimeStep *tStep)
Export primary variables.
void zero()
Zeroes all coefficients of receiver.
void addAllElements()
Initialize the element set to contain all elements in the receiver domain.
virtual double giveNodalScalarRepresentation(int)=0
Returns scalar value representation of material Interface at given point.
void times(double s)
Multiplies receiver with scalar.
ClassFactory & classFactory
void zero()
Zeroes all coefficient of receiver.
Domain * giveDomain() const
int min(int i, int j)
Returns smaller value from two given decimals.
std::vector< std::unique_ptr< Element > > & giveElements()
const char * __InternalStateTypeToString(InternalStateType _value)
int giveNumberOfNodesPerCell(int cellType)
Returns number of nodes corresponding to cell type.
Abstract base class representing the "problem" under consideration.
InternalStateValueType giveInternalStateValueType(InternalStateType type)
int giveSize() const
Returns the size of receiver.
virtual Element_Geometry_Type giveGeometryType() const
Returns the element geometry type.
Node * giveNode(int n)
Service for accessing particular domain node.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
The base class for all recovery models, which perform nodal averaging or projection processes for int...
NodalRecoveryModel * smoother
Smoother.
Node * giveNode(int i) const
Returns reference to the i-th node of element.
std::string giveOutputBaseFileName(TimeStep *tStep)
Gives the appropriate name (minus specific file extension).
Class representing integration point in finite element program.
#define OOFEM_WARNING(...)
virtual void doOutput(TimeStep *tStep, bool forcedOutput=false)
Writes the output.
int initRegionNodeNumbering(IntArray ®ionNodalNumbers, int ®ionDofMans, int offset, Domain *domain, int reg, int mode)
Assembles the region node map.
Class representing solution step.
NodalRecoveryModel * giveSmoother()
Returns the internal smoother.
REGISTER_ExportModule(ErrorCheckingExportModule)
void add(const FloatArray &src)
Adds array src to receiver.
void resize(int s)
Resizes receiver towards requested size.