NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
SizeFieldGen.H
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 #ifndef NEMOSYS_SIZEFIELDGEN_H_
30 #define NEMOSYS_SIZEFIELDGEN_H_
31 
32 #include <vtkDataArray.h>
33 #include <vtkDataSet.h>
34 #include <vtkSmartPointer.h>
35 
36 #include "nemosys_export.h"
37 
38 namespace NEM {
39 namespace ADP {
40 
41 class NEMOSYS_EXPORT SizeFieldBase {
42  // constructors and destructors
43  public:
44  SizeFieldBase() : ds(nullptr), dev_mult(1.5), maxIsmin(true), sizeFactor(1.) {
45  std::cout << "SizeFieldBase constructed" << std::endl;
46  }
47  SizeFieldBase(vtkDataSet *_ds, int arrayID, double _dev_mult, bool _maxIsmin,
48  const std::string &arrName);
49 
50  virtual ~SizeFieldBase() {
51  std::cout << "SizeFieldBase destroyed" << std::endl;
52  }
53 
54  // SizeFieldBase factory methods
55  public:
56  // will return derived type GradSizeField|ValSizeField|ErrorSF with SF in
57  // mesh's dataSet
58  // static SizeFieldBase *
59  // Create(meshBase *_mesh, const std::string &method, int arrayID);
60  static SizeFieldBase *Create(vtkDataSet *_dataSet, const std::string &method,
61  int arrayID, double _dev_mult, bool _maxIsmin,
62  double _sizeFactor = 1.0, int _order = 1);
63  static std::unique_ptr<SizeFieldBase> CreateUnique(
64  vtkDataSet *_dataSet, const std::string &method, int arrayID,
65  double _dev_mult, bool _maxIsmin, double _sizeFactor = 1.0,
66  int _order = 1);
67 
68  // method
69  public:
70  // compute size field and insert as cell data into mesh's dataSet
71  virtual void computeSizeField(vtkDataArray *da) = 0;
72 
73  void setSizeFactor(double sf) { sizeFactor = sf; }
74 
75  protected:
76  vtkSmartPointer<vtkDataSet> ds;
77  double dev_mult;
78  bool maxIsmin;
79  vtkSmartPointer<vtkDataArray> da;
80  std::string sfname;
81  double sizeFactor;
82 
83  // helpers
84  protected:
85  // identifies cells to refine and mutates current size values
86  // into a compatible size field for the mesh
87  void mutateValues(std::vector<double> &values) const;
88 };
89 
90 } // namespace ADP
91 } // namespace NEM
92 
93 #endif // NEMOSYS_SIZEFIELDGEN_H_
vtkSmartPointer< vtkDataSet > ds
Definition: SizeFieldGen.H:76
vtkSmartPointer< vtkDataArray > da
Definition: SizeFieldGen.H:79
void setSizeFactor(double sf)
Definition: SizeFieldGen.H:73