Definition at line 41 of file SizeFieldGen.H.
|
static SizeFieldBase * | Create (vtkDataSet *_dataSet, const std::string &method, int arrayID, double _dev_mult, bool _maxIsmin, double _sizeFactor=1.0, int _order=1) |
|
static std::unique_ptr< SizeFieldBase > | CreateUnique (vtkDataSet *_dataSet, const std::string &method, int arrayID, double _dev_mult, bool _maxIsmin, double _sizeFactor=1.0, int _order=1) |
|
Inherited by NEM::ADP::GradSizeField, NEM::ADP::ValSizeField, and NEM::ADP::Z2ErrorSizeField.
◆ SizeFieldBase() [1/2]
NEM::ADP::SizeFieldBase::SizeFieldBase |
( |
| ) |
|
|
inline |
Definition at line 44 of file SizeFieldGen.H.
45 std::cout <<
"SizeFieldBase constructed" << std::endl;
vtkSmartPointer< vtkDataSet > ds
◆ SizeFieldBase() [2/2]
NEM::ADP::SizeFieldBase::SizeFieldBase |
( |
vtkDataSet * |
_ds, |
|
|
int |
arrayID, |
|
|
double |
_dev_mult, |
|
|
bool |
_maxIsmin, |
|
|
const std::string & |
arrName |
|
) |
| |
Definition at line 45 of file SizeFieldGen.C.
References da, ds, and sfname.
49 int numArr =
ds->GetPointData()->GetNumberOfArrays();
50 if (arrayID >= numArr) {
51 std::cerr <<
"ERROR: arrayID is out of bounds\n";
52 std::cerr <<
"There are " << numArr <<
" point data arrays" << std::endl;
54 }
else if (numArr < 1) {
55 std::cerr <<
"no point data found" << std::endl;
59 if (arrName !=
"Z2ErrorSF")
da =
ds->GetPointData()->GetArray(arrayID);
61 std::string array_name =
ds->GetPointData()->GetArrayName(arrayID);
62 sfname = array_name.append(arrName);
65 vtkSmartPointer<vtkCellData> cd =
ds->GetCellData();
66 if (cd->GetNumberOfArrays()) {
67 for (
int i = 0; i < cd->GetNumberOfArrays(); ++i) {
68 std::string currname = cd->GetArrayName(i);
70 std::cout <<
"Found size field identifier in cell data: " << currname
72 std::cout <<
"Removing " << currname <<
" from dataSet" << std::endl;
73 ds->GetCellData()->RemoveArray(i);
79 std::cout <<
"SizeFieldBase constructed" << std::endl;
vtkSmartPointer< vtkDataSet > ds
vtkSmartPointer< vtkDataArray > da
◆ ~SizeFieldBase()
virtual NEM::ADP::SizeFieldBase::~SizeFieldBase |
( |
| ) |
|
|
inlinevirtual |
Definition at line 50 of file SizeFieldGen.H.
51 std::cout <<
"SizeFieldBase destroyed" << std::endl;
◆ computeSizeField()
virtual void NEM::ADP::SizeFieldBase::computeSizeField |
( |
vtkDataArray * |
da | ) |
|
|
pure virtual |
◆ Create()
SizeFieldBase * NEM::ADP::SizeFieldBase::Create |
( |
vtkDataSet * |
_dataSet, |
|
|
const std::string & |
method, |
|
|
int |
arrayID, |
|
|
double |
_dev_mult, |
|
|
bool |
_maxIsmin, |
|
|
double |
_sizeFactor = 1.0 , |
|
|
int |
_order = 1 |
|
) |
| |
|
static |
Definition at line 82 of file SizeFieldGen.C.
References computeSizeField(), and setSizeFactor().
Referenced by CreateUnique().
87 if (method ==
"value") {
88 sf =
new ValSizeField(_dataSet, arrayID, _dev_mult, _maxIsmin);
89 }
else if (method ==
"gradient") {
90 sf =
new GradSizeField(_dataSet, arrayID, _dev_mult, _maxIsmin);
91 }
else if (method ==
"Z2 Error Estimator") {
92 sf =
new Z2ErrorSizeField(_dataSet, arrayID, _order);
94 std::cerr <<
"Specified method " << method <<
" is not supported\n";
95 std::cerr <<
"Available methods are gradient, value and error" << std::endl;
99 sf->computeSizeField(_dataSet->GetPointData()->GetArray(arrayID));
◆ CreateUnique()
std::unique_ptr< SizeFieldBase > NEM::ADP::SizeFieldBase::CreateUnique |
( |
vtkDataSet * |
_dataSet, |
|
|
const std::string & |
method, |
|
|
int |
arrayID, |
|
|
double |
_dev_mult, |
|
|
bool |
_maxIsmin, |
|
|
double |
_sizeFactor = 1.0 , |
|
|
int |
_order = 1 |
|
) |
| |
|
static |
Definition at line 103 of file SizeFieldGen.C.
References Create().
Referenced by meshBase::generateSizeField().
107 _dataSet, method, arrayID, _dev_mult, _maxIsmin, _sizeFactor, _order));
static SizeFieldBase * Create(vtkDataSet *_dataSet, const std::string &method, int arrayID, double _dev_mult, bool _maxIsmin, double _sizeFactor=1.0, int _order=1)
◆ mutateValues()
void NEM::ADP::SizeFieldBase::mutateValues |
( |
std::vector< double > & |
values | ) |
const |
|
protected |
Definition at line 112 of file SizeFieldGen.C.
References nemAux::cellsToRefineMaxdev(), dev_mult, ds, nemAux::getMeanStdev(), nemAux::getMinMax(), nemAux::hasZero(), maxIsmin, nemAux::reciprocal_vec(), nemAux::scale_vec_to_range(), and sizeFactor.
Referenced by NEM::ADP::GradSizeField::computeSizeField(), and NEM::ADP::ValSizeField::computeSizeField().
113 std::cout <<
"Size Factor = " <<
sizeFactor << std::endl;
115 std::vector<double> lengths(
ds->GetNumberOfCells());
116 for (vtkIdType i = 0; i <
ds->GetNumberOfCells(); ++i)
117 lengths[i] = std::sqrt(
ds->GetCell(i)->GetLength2());
122 lengthminmax[1] = lengthminmax[0];
124 lengthminmax[1] *= 0.65;
125 lengthminmax[0] -= lengthminmax[0] / 2.;
128 std::cout <<
"Min Elm Length Scale : " << lengthminmax[0] <<
"\n" 129 <<
"Max Elm Length Scale : " << lengthminmax[1] << std::endl;
138 std::vector<bool> cells2Refine =
141 std::vector<double> values_norm = (1. / meanStdev[0]) * values;
153 std::ofstream elmLst;
154 elmLst.open(
"refineCellList.csv");
155 if (!elmLst.good()) {
156 std::cerr <<
"Error opening the stream for refinement list." << std::endl;
159 bool isFirstElmIdx =
true;
160 for (
int i = 0; i < values.size(); ++i) {
161 if (!cells2Refine[i])
162 values[i] = lengthminmax[1];
167 isFirstElmIdx =
false;
void scale_vec_to_range(std::vector< T > &x, const std::vector< T > &xminmax, const std::vector< T > &yminmax)
std::vector< T > getMinMax(const std::vector< T > &x)
vtkSmartPointer< vtkDataSet > ds
std::vector< T > getMeanStdev(const std::vector< T > &x)
std::vector< bool > cellsToRefineMaxdev(const std::vector< T > &values, T dev)
void reciprocal_vec(std::vector< T > &x)
bool hasZero(const std::vector< T > &x)
◆ setSizeFactor()
void NEM::ADP::SizeFieldBase::setSizeFactor |
( |
double |
sf | ) |
|
|
inline |
◆ da
vtkSmartPointer<vtkDataArray> NEM::ADP::SizeFieldBase::da |
|
protected |
◆ dev_mult
double NEM::ADP::SizeFieldBase::dev_mult |
|
protected |
◆ ds
vtkSmartPointer<vtkDataSet> NEM::ADP::SizeFieldBase::ds |
|
protected |
◆ maxIsmin
bool NEM::ADP::SizeFieldBase::maxIsmin |
|
protected |
◆ sfname
std::string NEM::ADP::SizeFieldBase::sfname |
|
protected |
◆ sizeFactor
double NEM::ADP::SizeFieldBase::sizeFactor |
|
protected |
The documentation for this class was generated from the following files: