Skip to content
Snippets Groups Projects
Select Git revision
  • 9fa40584c38e2702f3ceda816a183bd95def8ecb
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

GUI.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    PViewDataGModelIO.cpp 20.58 KiB
    // Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to <gmsh@geuz.org>.
    
    #include "GmshConfig.h"
    #include "GmshMessage.h"
    #include "PViewDataGModel.h"
    #include "MVertex.h"
    #include "MElement.h"
    #include "Numeric.h"
    #include "StringUtils.h"
    
    bool PViewDataGModel::addData(GModel *model, std::map<int, std::vector<double> > &data,
                                  int step, double time, int partition, int numComp)
    {
      if(data.empty()) return false;
    
      if (numComp < 0){
        numComp = 9;
        for(std::map<int, std::vector<double> >::iterator it = data.begin();
            it != data.end(); it++)
          numComp = std::min(numComp, (int)it->second.size());
      }
    
      while(step >= (int)_steps.size())
        _steps.push_back(new stepData<double>(model, numComp));
    
      _steps[step]->setTime(time);
    
      int numEnt = (_type == NodeData) ? model->getNumMeshVertices() :
        model->getNumMeshElements();
      _steps[step]->resizeData(numEnt);
    
      for(std::map<int, std::vector<double> >::iterator it = data.begin();
          it != data.end(); it++){
        int mult = it->second.size() / numComp;
        double *d  = _steps[step]->getData(it->first, true, mult);
        for(int j = 0; j < numComp * mult; j++)
          d[j] = it->second[j];
      }
      if(partition >= 0)
        _steps[step]->getPartitions().insert(partition);
      finalize();
      return true;
    }
    
    bool PViewDataGModel::readMSH(std::string fileName, int fileIndex, FILE *fp,
                                  bool binary, bool swap, int step, double time,
                                  int partition, int numComp, int numEnt,
                                  const std::string &interpolationScheme)
    {
      Msg::Info("Reading step %d (time %g) partition %d: %d records",
                step, time, partition, numEnt);
    
      while(step >= (int)_steps.size()){
        if(_steps.empty() || _steps.back()->getNumData())
          _steps.push_back(new stepData<double>(GModel::current(), numComp));
        else // faster since we avoid computing model bounds
          _steps.push_back(new stepData<double>(*_steps.back()));
      }
      
      _steps[step]->setFileName(fileName);
      _steps[step]->setFileIndex(fileIndex);
      _steps[step]->setTime(time);
    
      /*
      // if we already have maxSteps for this view, return
      int numSteps = 0, maxSteps = 1000000000;
      for(unsigned int i = 0; i < _steps.size(); i++)