| 1 |
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 2 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
#include "config.h" |
| 4 |
|
| 5 |
#include <cerrno> |
| 6 |
#include <cstring> |
| 7 |
|
| 8 |
#include <dune/common/exceptions.hh> |
| 9 |
|
| 10 |
#include <dune/uggrid/low/namespace.h> |
| 11 |
#include <dune/uggrid/low/initlow.h> |
| 12 |
#include <dune/uggrid/ugdevices.h> |
| 13 |
#include <dune/uggrid/gm/initgm.h> |
| 14 |
#include <dune/uggrid/gm/rm.h> |
| 15 |
|
| 16 |
#include <dune/uggrid/gm/rm-write2file.h> |
| 17 |
|
| 18 |
int main(int argc, char** argv) |
| 19 |
{ |
| 20 |
NS_PREFIX InitLow(); |
| 21 |
NS_PREFIX InitDevices(); |
| 22 |
NS_DIM_PREFIX InitGm(); |
| 23 |
|
| 24 |
std::vector<NS_DIM_PREFIX REFRULE> rules; |
| 25 |
std::vector<NS_PREFIX SHORT> patterns; |
| 26 |
|
| 27 |
// use an arbitrary additional argument to use the rules from "lib/ugdata/RefRules.data" |
| 28 |
if( argc > 1 ) |
| 29 |
{ |
| 30 |
// read the file "lib/ugdata/RefRules.data" and use those rules |
| 31 |
std::FILE* stream = std::fopen(argv[1], "r"); |
| 32 |
if (!stream) |
| 33 |
DUNE_THROW(Dune::Exception, "Could not open file " << argv[1] << ": " << std::strerror(errno)); |
| 34 |
NS_DIM_PREFIX readTetrahedronRules(stream, rules, patterns); |
| 35 |
std::fclose(stream); |
| 36 |
|
| 37 |
NS_DIM_PREFIX RefRules[NS_DIM_PREFIX TETRAHEDRON] = rules.data(); |
| 38 |
NS_DIM_PREFIX MaxRules[NS_DIM_PREFIX TETRAHEDRON] = rules.size(); |
| 39 |
} |
| 40 |
|
| 41 |
// write rules |
| 42 |
for(int i=0; i<NS_DIM_PREFIX MaxRules[NS_DIM_PREFIX TETRAHEDRON]; i++) |
| 43 |
{ |
| 44 |
NS_DIM_PREFIX ShowRefRuleX(NS_DIM_PREFIX TETRAHEDRON, i, std::printf); |
| 45 |
} |
| 46 |
|
| 47 |
return 0; |
| 48 |
} |