LCOV - code coverage report
Current view: top level - ugbase/lib_algebra/common - connection_viewer_output.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 12 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2012-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Martin Rupp
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : #include <string>
      34              : #include <fstream>
      35              : #include <vector>
      36              : #include "common/error.h"
      37              : 
      38              : #ifdef UG_PARALLEL
      39              : #include "pcl/pcl.h"
      40              : #endif
      41              : 
      42              : using namespace std;
      43              : 
      44              : namespace ug
      45              : {
      46              : namespace ConnectionViewer
      47              : {
      48              : bool g_parallelConnectionViewer=false;
      49              : 
      50              : #ifdef UG_PARALLEL
      51              : string GetParallelName(string name, const pcl::ProcessCommunicator &pc, bool bWriteHeader)
      52              : {
      53              :         if(pcl::NumProcs() == 1)
      54              :                 return name;
      55              : 
      56              :         char buf[20];
      57              :         int rank = pcl::ProcRank();
      58              : 
      59              :         size_t iExtPos = name.find_last_of(".");
      60              :         UG_COND_THROW(iExtPos == string::npos,
      61              :                       "Filename extension missing. "
      62              :                       "Maybe you want to add '.vec' or '.mat'?")
      63              : 
      64              :         string ext = name.substr(iExtPos+1);
      65              :         name.resize(iExtPos);
      66              : 
      67              :         if(bWriteHeader && pc.size() > 1 && rank == pc.get_proc_id(0))
      68              :         {
      69              :                 size_t iSlashPos = name.find_last_of("/");
      70              :                 if(iSlashPos == string::npos) iSlashPos = 0; else iSlashPos++;
      71              :                 string name2 = name.substr(iSlashPos);
      72              :                 fstream file((name+".p"+ext).c_str(), ios::out);
      73              :                 file << pc.size() << "\n";
      74              :                 for(size_t i=0; i<pc.size(); i++)
      75              :                 {
      76              :                         snprintf(buf, 20, "_p%04d.%s", pc.get_proc_id(i), ext.c_str());
      77              :                         file << name2 << buf << "\n";
      78              :                 }
      79              :         }
      80              : 
      81              :         snprintf(buf, 20, "_p%04d.%s", rank, ext.c_str());
      82              :         name.append(buf);
      83              :         return name;
      84              : }
      85              : #endif
      86              : 
      87              : 
      88            0 : bool AddMarkers(string filename, string markfilename)
      89              : {
      90            0 :         fstream fmat(filename.c_str(), ios::out | ios::app);
      91            0 :         fmat << "c " << markfilename << "\n";
      92            0 :     return true;
      93            0 : }
      94              : 
      95            0 : bool WriteMarkers(string markfilename, vector<bool> markers, float r, float g, float b, float alpha, int size)
      96              : {
      97            0 :         fstream fmark(markfilename.c_str(), ios::out);
      98            0 :         fmark << r << " " << g << " " << b  << " " << alpha << " " << size << "\n";
      99            0 :         for(size_t i=0; i<markers.size(); i++)
     100              :                 if(markers[i])
     101            0 :                         fmark << i << "\n";
     102            0 :     return true;
     103            0 : }
     104              : 
     105              : /*
     106              : bool GetNextGrid(vector<MathVector<3> > &coarsegrid, const vector<MathVector<3> > &grid, const vector<int> &newIndex, int nCoarse)
     107              : {
     108              :         coarsegrid.resize(nCoarse);
     109              :         assert(newIndex.size() == grid.size());
     110              :         for(size_t i=0; i<grid.size(); i++)
     111              :                 if(newIndex[i] != -1)
     112              :                 {
     113              :                         assert(newIndex[i] < nCoarse && newIndex[i] >= 0);
     114              :                         coarsegrid[newIndex[i]] = grid[i];
     115              :                 }
     116              :     return true;
     117              : }*/
     118              : 
     119              : } // CV
     120              : } // ug
        

Generated by: LCOV version 2.0-1