27 namespace outputCSVStream {
63 std::fstream&
ofstreamcsv(std::fstream &out,
const std::vector< T > &x)
70 for (
size_t i = 0; i < n-1; i++) {
96 template <
class T,
size_t d>
97 std::fstream&
ofstreamcsv(std::fstream &out,
const std::array< T,d > &x)
100 if (d == 0)
return(out);
101 for (
size_t i = 0; i < d-1; i++) {
115 template <
class T,
size_t d>
135 std::string name = x.
getName();
139 out << long(x.size())<<
'\n';
140 typename bitpit::PiercedVector<T>::const_iterator itB, itE = x.end();
141 for (itB = x.begin(); itB != itE; ++itB) {
177 file.open(m_dir+
"/"+m_filename, std::fstream::out);
216 GenericOutput::_setInput(T & data){
217 m_input = std::move(std::unique_ptr<IOData>(
new IODataT<T>(data)));
229 if(m_csv) m_binary =
false;
230 std::string name = data->
getName();
236 collectDataFromAllProcs(*data, dataglobal.get());
237 workingptr_ = dataglobal.get();
243 file.open(m_dir+
"/"+m_filename, std::fstream::out);
246 std::size_t length = name.length();
247 bitpit::genericIO::flushBINARY(file, length);
248 for (std::size_t i=0; i<length; i++){
250 bitpit::genericIO::flushBINARY(file, a);
252 bitpit::genericIO::flushBINARY(file, loc);
253 bitpit::genericIO::flushBINARY(file,
long(workingptr_->size()));
254 for (
auto datait = workingptr_->begin(); datait != workingptr_->end(); ++datait) {
255 bitpit::genericIO::flushBINARY(file, datait.getId());
256 bitpit::genericIO::flushBINARY(file, *datait);
261 bitpit::genericIO::flushASCII(file, name);
262 bitpit::genericIO::flushASCII(file,loc);
264 bitpit::genericIO::flushASCII(file,
long(workingptr_->size()));
266 for (
auto datait = workingptr_->begin(); datait != workingptr_->end(); ++datait) {
267 bitpit::genericIO::flushASCII(file, datait.getId());
268 bitpit::genericIO::flushASCII(file, *datait);
293 for(
auto it=locdata.begin(); it!=locdata.end(); ++it){
294 globdata->insert(it.getId(), *it);
299 for (
int sendRank=1; sendRank<m_nprocs; sendRank++){
301 MPI_Recv(&dataBufferSize, 1, MPI_LONG, sendRank, 100, m_communicator, MPI_STATUS_IGNORE);
303 MPI_Recv(dataBuffer.data(), dataBuffer.getSize(), MPI_CHAR, sendRank, 110, m_communicator, MPI_STATUS_IGNORE);
306 MimmoPiercedVector<T> temp;
310 for(
auto it=temp.begin(); it!=temp.end(); ++it){
311 if(!globdata->exists(it.getId())){
312 globdata->insert(it.getId(), *it);
320 dataBuffer << locdata;
321 long dataBufferSize = dataBuffer.getSize();
323 MPI_Send(&dataBufferSize, 1, MPI_LONG, 0, 100, m_communicator);
324 MPI_Send(dataBuffer.data(), dataBuffer.getSize(), MPI_CHAR, 0, 110, m_communicator);