File: coll_reader.cpp

package info (click to toggle)
glvis 4.4%2Bgit20251225%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,592 kB
  • sloc: cpp: 32,463; ansic: 5,534; sh: 340; makefile: 285; python: 193
file content (67 lines) | stat: -rw-r--r-- 2,071 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-443271.
//
// This file is part of the GLVis visualization tool and library. For more
// information and source code availability see https://glvis.org.
//
// GLVis is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.

#include "coll_reader.hpp"

#include <vector>

using namespace std;
using namespace mfem;

int DataCollectionReader::ReadSerial(CollType ct, const char *coll_file,
                                     int ti, const char *field, bool quad, int component)
{
   switch (ct)
   {
      case CollType::VISIT:
      {
         auto dc = new VisItDataCollection(coll_file);
         dc->SetPadDigits(pad_digits);
         data.SetDataCollectionField(dc, ti, field, quad, component);
      }
      break;
#ifdef MFEM_USE_SIDRE
      case CollType::SIDRE:
      {
         auto dc = new SidreDataCollection(coll_file);
         dc->SetPadDigits(pad_digits);
         data.SetDataCollectionField(dc, ti, field, quad, component);
      }
      break;
#endif // MFEM_USE_SIDRE
#ifdef MFEM_USE_FMS
      case CollType::FMS:
      {
         auto dc = new FMSDataCollection(coll_file);
         dc->SetPadDigits(pad_digits);
         dc->SetProtocol(protocol);
         data.SetDataCollectionField(dc, ti, field, quad, component);
      }
      break;
#endif // MFEM_USE_FMS
#ifdef MFEM_USE_CONDUIT
      case CollType::CONDUIT:
      {
         auto dc = new ConduitDataCollection(coll_file);
         dc->SetPadDigits(pad_digits);
         dc->SetProtocol(protocol);
         data.SetDataCollectionField(dc, ti, field, quad, component);
      }
      break;
#endif // MFEM_USE_CONDUIT
      default:
         cerr << "Unknown collection type. Exit" << endl;
         exit(1);
   }

   data.ExtrudeMeshAndSolution();
   return 0;
}