AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Particles.h
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
24#ifndef PARTICLES_H_INCLUDED
25#define PARTICLES_H_INCLUDED
26
27#include <vector>
28#include <sphPrerequisites.h>
29#include <ProblemSetup.h>
31
32namespace Aqua {
33namespace InputOutput {
34
51class Particles : public InputOutput
52{
53 public:
62 Particles(ProblemSetup& sim_data,
63 unsigned int iset,
64 unsigned int offset,
65 unsigned int n = 0);
66
68 virtual ~Particles();
69
73 const std::string file() { return _output_file; }
74
78 unsigned int n() { return _bounds.y - _bounds.x; }
79
87 virtual void waitForSavers() { return; }
88
89 protected:
94 ProblemSetup& simData() { return _sim_data; }
95
99 void n(unsigned int n) { _bounds.y = _bounds.x + n; }
100
105 const uivec2 bounds() const { return _bounds; }
106
110 const unsigned int setId() const { return _iset; }
111
117 void loadDefault();
118
123 void file(const std::string filename) { _output_file = filename; };
124
135 unsigned int file(const std::string basename,
136 unsigned int start_index,
137 unsigned int digits = 5);
138
144 std::vector<void*> download(std::vector<std::string> fields);
145
146 private:
150 void clearList(std::vector<void*>* data);
151
153 ProblemSetup _sim_data;
154
156 uivec2 _bounds;
157
159 unsigned int _iset;
160
162 std::string _output_file;
163}; // class InputOutput
164
165}
166} // namespaces
167
168#endif // PARTICLES_H_INCLUDED
Base class for all the input/output file managers. (See Aqua::InputOutput::InputOutput for details)
Simulation configuration data structures. (See Aqua::InputOutput::ProblemSetup for details)
Base class for input/output file managers.
Definition: InputOutput.h:38
Particles file loader/saver base class.
Definition: Particles.h:52
std::vector< void * > download(std::vector< std::string > fields)
Definition: Particles.cpp:161
void file(const std::string filename)
Set the file name.
Definition: Particles.h:123
unsigned int n()
Get the number of particles managed by this instance.
Definition: Particles.h:78
virtual ~Particles()
Destructor.
Definition: Particles.cpp:45
ProblemSetup & simData()
Get the simulation data structure.
Definition: Particles.h:94
virtual void waitForSavers()
Wait for the eventual parallel saving threads.
Definition: Particles.h:87
void n(unsigned int n)
Set the number of particles managed by this instance.
Definition: Particles.h:99
const uivec2 bounds() const
Get the particle index bounds of the "set of particles" managed by this class.
Definition: Particles.h:105
const unsigned int setId() const
Get the "particles set" index associated with this class.
Definition: Particles.h:110
const std::string file()
Get the last printed file path.
Definition: Particles.h:73
void loadDefault()
Register some default arrays:
Definition: Particles.cpp:48
Simulation configuration data.
Definition: ProblemSetup.h:91
__kernel void fields(__global const unsigned int *iset, __global const uint *isplit, __global const uint *mybuffer, __global const unsigned int *ilevel, __global const float *split_weight, __global float *m0, __global float *m, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, __global const uint *icell, __global const uint *ihoc, __constant float *dr_level0, unsigned int N, uivec4 n_cells)
Collect the children, and the seed itself, in order to compute the field values of the buffer partner...
Definition: Coalesce.cl:435
Main AQUAgpusph namespace.
Definition: ArgumentsManager.cpp:45
static std::string filename
Definition: AuxiliarMethods.cpp:336
Set of definitions and macros related with the implementation.