31 #include <vtkCellData.h> 32 #include <vtkPointData.h> 42 double dev_mult,
bool maxIsmin,
double edge_scale,
43 const std::string &_ofname,
double sizeFactor,
int order)
44 :
mesh(_mesh), ofname(_ofname), bndrConst(false) {
45 if (method !=
"uniform") {
50 }
else if (method ==
"uniform") {
80 std::cout <<
"Refine destroyed" << std::endl;
84 std::cout <<
"Uniform Refinement Selected" << std::endl;
87 gMesh->write(
"converted.msh", 2.0,
false);
89 MAd::pGModel gmodel =
nullptr;
92 MAd::M_load(
MadMesh,
"converted.msh");
97 pwlSF->setCurrentSize();
98 pwlSF->scale(edge_scale);
110 std::cout <<
"Time for adapter construction (ms): " << T.
elapsed() <<
"\n \n";
111 std::cout <<
"Refine constructed" << std::endl;
117 gMesh->write(
"converted.msh", 2.0,
false);
121 std::string array_name;
123 array_name =
mesh->
getDataSet()->GetPointData()->GetArrayName(arrayID);
124 if (method ==
"gradient")
125 array_name.append(
"GradientSF");
126 else if (method ==
"value")
127 array_name.append(
"ValueSF");
128 else if (method ==
"Z2 Error Estimator")
129 array_name.append(
"Z2ErrorSF");
130 for (i = 0; i < cd->GetNumberOfArrays(); ++i) {
131 if (array_name == cd->GetArrayName(i))
break;
133 if (i == cd->GetNumberOfArrays()) {
134 std::cerr <<
"Error: Did not find " << array_name <<
" in cell data set" 142 MAd::pGModel gmodel =
nullptr;
144 MAd::M_load(
MadMesh,
"converted.msh");
147 bSF =
new MAd::BackgroundSF(
"backgroundSF");
148 bSF->loadData(
"backgroundSF.msh");
150 std::cout <<
"\n \n Beginning Adapter Construction" << std::endl;
157 std::cout <<
"Time for adapter construction (ms): " << T.
elapsed() <<
"\n \n";
158 std::cout <<
"Refine constructed" << std::endl;
163 std::cerr <<
"Adapter hasn't been constructed!" << std::endl;
171 std::cout <<
"Statistics before refinement: " << std::endl;
172 adapter->printStatistics(std::cout);
175 std::cout <<
"Refining the mesh ..." << std::endl;
177 std::cout <<
"Statistics after refinement: " << std::endl;
178 adapter->printStatistics(std::cout);
181 std::cout <<
"Optimizing the mesh" << std::endl;
185 for (
int i = 0; i < 1; ++i) {
190 adapter->optimiseElementShape();
200 std::cout <<
"Statistics after optimization: " << std::endl;
201 adapter->printStatistics(std::cout);
206 MAd::M_writeMsh(
MadMesh,
"refined.msh", 2);
214 mesh, refinedVTK,
"Consistent Interpolation");
227 MadMesh->classify_unclassified_entities();
228 MadMesh->destroyStandAloneEntities();
229 bnd = (MAd::pGEntity)MAd::GM_faceByTag(
MadMesh->model, 0);
235 MadMesh->unclassify_grid_boundaries();
static meshBase * exportGmshToVtk(const std::string &fname)
construct vtkMesh from gmsh msh file (called in Create methods)
void setFileName(const std::string &fname)
set the file name.
A brief description of meshBase.
void classifyBoundaries()
vtkSmartPointer< vtkDataSet > getDataSet() const
get this meshes' dataSet
void generateSizeField(const std::string &method, int arrayID, double dev_mlt, bool maxIsmin, double sizeFactor=1.0, int order=1)
generate size field based on method and given a point data array.
virtual void write() const
write the mesh to file named after the private var 'filename'.
std::shared_ptr< meshBase > mesh
MAd::MeshAdapter * adapter
virtual void unsetCellDataArray(int arrayID)
delete array with id from dataSet's cell data
void initAdaptive(int arrayID, const std::string &method)
void run(bool transferData, bool bndryConstraint=false)
virtual void report() const
generate a report of the mesh
std::vector< std::string > getNewArrayNames()
get new array names for use in transfer
static std::shared_ptr< TransferBase > CreateTransferObject(meshBase *srcmsh, meshBase *trgmsh, const std::string &method)
void unClassifyBoundaries()
Refine(meshBase *_mesh, const std::string &method, int arrayID, double dev_mult, bool maxIsmin, double edge_scale, const std::string &_ofname, double sizeFactor=1.0, int order=1)
void initUniform(double edge_scale)
void writeMSH(std::ofstream &outputStream)
convert to gmsh format without data