Helper class for the construction of file names based on name, index and extension.
More...
#include <TNL/FileName.h>
|
| FileName ()=default |
| Basic constructor.
|
|
| FileName (String fileNameBase) |
| Constructor with file name base parameter.
|
|
| FileName (String fileNameBase, String extension) |
| Constructor with file name base and file name extension.
|
|
String | getFileName () |
| Returns complete file name.
|
|
void | resetDistributedSystemNodeId () |
| Resets the distributed system node ID.
|
|
void | setDigitsCount (size_t digitsCount) |
| Sets number of digits for index of the file name.
|
|
template<typename Coordinates > |
void | setDistributedSystemNodeCoordinates (const Coordinates &nodeId) |
| Sets the distributed system node ID in a form of Cartesian coordinates.
|
|
void | setDistributedSystemNodeId (size_t nodeId) |
| Sets the distributed system node ID as integer, for example MPI process ID.
|
|
void | setExtension (const String &extension) |
| Sets the file name extension.
|
|
void | setFileNameBase (const String &fileNameBase) |
| Sets the file name base.
|
|
void | setIndex (size_t index) |
| Sets index of the file name.
|
|
Helper class for the construction of file names based on name, index and extension.
Optionally, the file name can also handle node ID for distributed systems.
The following example demonstrates the use of FileName.
- Example
#include <iostream>
#include <TNL/FileName.h>
int
main()
{
FileName fileName(
"velocity-",
"vtk" );
fileName.setDigitsCount( 2 );
for( int i = 0; i <= 10; i++ ) {
fileName.setIndex( i );
}
fileName.setDigitsCount( 3 );
for( int i = 0; i <= 10; i++ ) {
fileName.setIndex( i );
}
}
Helper class for the construction of file names based on name, index and extension.
Definition FileName.h:23
The main TNL namespace.
Definition AtomicOperations.h:9
- Output
velocity-00.vtk
velocity-01.vtk
velocity-02.vtk
velocity-03.vtk
velocity-04.vtk
velocity-05.vtk
velocity-06.vtk
velocity-07.vtk
velocity-08.vtk
velocity-09.vtk
velocity-10.vtk
velocity-000.vtk
velocity-001.vtk
velocity-002.vtk
velocity-003.vtk
velocity-004.vtk
velocity-005.vtk
velocity-006.vtk
velocity-007.vtk
velocity-008.vtk
velocity-009.vtk
velocity-010.vtk
◆ FileName() [1/3]
TNL::FileName::FileName |
( |
| ) |
|
|
default |
Basic constructor.
Sets no file name base, index to zero and index digits count to five;
◆ FileName() [2/3]
TNL::FileName::FileName |
( |
String | fileNameBase | ) |
|
|
inline |
Constructor with file name base parameter.
The index is set to zero and index digits count to five.
- Parameters
-
fileNameBase | File name base. |
◆ FileName() [3/3]
TNL::FileName::FileName |
( |
String | fileNameBase, |
|
|
String | extension ) |
|
inline |
Constructor with file name base and file name extension.
The index is set to zero and index digits count to five.
- Parameters
-
fileNameBase | File name base. |
extension | File name extension. |
◆ getFileName()
String TNL::FileName::getFileName |
( |
| ) |
|
|
inline |
Returns complete file name.
- Returns
- String with the complete file name.
◆ setDigitsCount()
void TNL::FileName::setDigitsCount |
( |
size_t | digitsCount | ) |
|
|
inline |
Sets number of digits for index of the file name.
- Parameters
-
digitsCount | Number of digits. It is 5 by default. |
◆ setDistributedSystemNodeCoordinates()
template<typename Coordinates >
void TNL::FileName::setDistributedSystemNodeCoordinates |
( |
const Coordinates & | nodeId | ) |
|
Sets the distributed system node ID in a form of Cartesian coordinates.
- Template Parameters
-
Coordinates | Type of Cartesian coordinates. It is Containers::StaticVector usually. |
- Parameters
-
nodeId | Node ID in a form of Cartesian coordinates. |
See the following example:
- Example
#include <iostream>
#include <TNL/FileName.h>
#include <TNL/Containers/StaticVector.h>
int
main()
{
FileName fileName(
"velocity-",
"vtk" );
CoordinatesType coordinates( 0, 0, 0 );
fileName.setDistributedSystemNodeCoordinates( coordinates );
fileName.setDigitsCount( 2 );
for( int i = 0; i <= 10; i++ ) {
fileName.setIndex( i );
}
}
Vector with constant size.
Definition StaticVector.h:19
- Output
velocity-00-@0-0-0.vtk
velocity-01-@0-0-0.vtk
velocity-02-@0-0-0.vtk
velocity-03-@0-0-0.vtk
velocity-04-@0-0-0.vtk
velocity-05-@0-0-0.vtk
velocity-06-@0-0-0.vtk
velocity-07-@0-0-0.vtk
velocity-08-@0-0-0.vtk
velocity-09-@0-0-0.vtk
velocity-10-@0-0-0.vtk
◆ setDistributedSystemNodeId()
void TNL::FileName::setDistributedSystemNodeId |
( |
size_t | nodeId | ) |
|
|
inline |
Sets the distributed system node ID as integer, for example MPI process ID.
- Parameters
-
See the following example:
- Example
#include <iostream>
#include <TNL/FileName.h>
int
main()
{
FileName fileName(
"velocity-",
"vtk" );
fileName.setDistributedSystemNodeId( 0 );
fileName.setDigitsCount( 2 );
for( int i = 0; i <= 10; i++ ) {
fileName.setIndex( i );
}
}
- Output
velocity-00-@0.vtk
velocity-01-@0.vtk
velocity-02-@0.vtk
velocity-03-@0.vtk
velocity-04-@0.vtk
velocity-05-@0.vtk
velocity-06-@0.vtk
velocity-07-@0.vtk
velocity-08-@0.vtk
velocity-09-@0.vtk
velocity-10-@0.vtk
◆ setExtension()
void TNL::FileName::setExtension |
( |
const String & | extension | ) |
|
|
inline |
Sets the file name extension.
- Parameters
-
extension | A String that specifies the new extension of file without dot. |
◆ setFileNameBase()
void TNL::FileName::setFileNameBase |
( |
const String & | fileNameBase | ) |
|
|
inline |
Sets the file name base.
- Parameters
-
fileNameBase | String that specifies the new file name base. |
◆ setIndex()
void TNL::FileName::setIndex |
( |
size_t | index | ) |
|
|
inline |
Sets index of the file name.
- Parameters
-
index | Index of the file name. |
The documentation for this class was generated from the following files:
- src/TNL/FileName.h
- src/TNL/FileName.hpp