AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
CSV.hpp
Go to the documentation of this file.
1/*
2 * This file is part of AQUAgpusph, a free CFD program based on SPH.
3 * Copyright (C) 2012 Jose Luis Cercos Pita <jl.cercos@upm.es>
4 *
5 * AQUAgpusph is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * AQUAgpusph is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with AQUAgpusph. If not, see <http://www.gnu.org/licenses/>.
17 */
18
23
24#pragma once
25
27#include "FastASCII.hpp"
28
29namespace Aqua {
30namespace InputOutput {
31
44class CSV : public FastASCII
45{
46 public:
55 CSV(ProblemSetup& sim_data,
56 unsigned int iset,
57 size_t offset,
58 size_t n = 0,
59 const std::string file_ext = ".csv",
60 const char sep = ',');
61
63 ~CSV();
64
67 void load() final;
68
75 void print_file() final;
76
77 protected:
81 void print_header(std::ofstream& f) const final;
82
86 void formatLine(std::string& l) final;
87
92 size_t readNParticles(std::ifstream& f) final;
93
94 private:
96 char _sep;
97
99 bool _has_header;
100
101}; // class InputOutput
102
103} // InputOutput::
104} // Aqua::
Particles plain text data files loader/saver. (See Aqua::InputOutput::FastASCII for details)
size_t readNParticles(std::ifstream &f) final
Count the number of particles present in the input file.
Definition CSV.cpp:112
~CSV()
Destructor.
Definition CSV.cpp:45
void formatLine(std::string &l) final
Conveniently format a read line.
Definition CSV.cpp:90
CSV(ProblemSetup &sim_data, unsigned int iset, size_t offset, size_t n=0, const std::string file_ext=".csv", const char sep=',')
Constructor.
Definition CSV.cpp:33
void load() final
Load the data.
Definition CSV.cpp:48
void print_file() final
Print the data to a file.
Definition CSV.cpp:55
void print_header(std::ofstream &f) const final
Write the file header.
Definition CSV.cpp:61
FastASCII(ProblemSetup &sim_data, unsigned int iset, size_t offset, size_t n=0, const std::string file_ext=".dat")
Constructor.
Definition FastASCII.cpp:36
size_t n() const
Get the number of particles managed by this instance.
Definition Particles.hpp:80
Simulation configuration data.
Definition ProblemSetup.hpp:91
Input/Output data interfaces.
Definition ArgumentsManager.cpp:51
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50
Set of definitions and macros related with the implementation.