14 #ifdef MFEM_USE_MESQUITE
16 #include "../fem/fem.hpp"
41 void MesquiteMesh::MeshTags::clear()
43 for (std::vector<TagData*>::iterator iter = tagList.begin();
44 iter != tagList.end(); ++iter)
53 size_t MesquiteMesh::MeshTags::size_from_tag_type( Mesh::TagType type )
57 case Mesh::BYTE:
return 1;
58 case Mesh::BOOL:
return sizeof(bool);
59 case Mesh::DOUBLE:
return sizeof(double);
60 case Mesh::INT:
return sizeof(int);
61 case Mesh::HANDLE:
return sizeof(
void*);
62 case Mesh::LONG_LONG:
return sizeof(
long long);
63 default: assert(0);
return 0;
67 size_t MesquiteMesh::MeshTags::create(
const std::string& name,
73 size_t h = handle( name, err );
76 MSQ_SETERR(err)(name, MsqError::TAG_ALREADY_EXISTS);
80 if (length == 0 || size_from_tag_type(type) == 0)
82 MSQ_SETERR(err)(MsqError::INVALID_ARG);
86 TagData* tag =
new TagData( name, type, length );
88 tagList.push_back(tag);
92 tag->defaultValue = malloc( tag->desc.size );
93 memcpy( tag->defaultValue, defval, tag->desc.size );
99 size_t MesquiteMesh::MeshTags::create(
const MfemTagDescription& desc,
103 size_t h = handle( desc.name.c_str(),
err );
106 MSQ_SETERR(err)(desc.name.c_str(), MsqError::TAG_ALREADY_EXISTS);
111 if (desc.size == 0 || (desc.size % size_from_tag_type(desc.type)) != 0)
113 MSQ_SETERR(err)(MsqError::INVALID_ARG);
117 TagData* tag =
new TagData( desc );
119 tagList.push_back(tag);
123 tag->defaultValue = malloc( tag->desc.size );
124 memcpy( tag->defaultValue, defval, tag->desc.size );
130 void MesquiteMesh::MeshTags::destroy(
size_t tag_index, MsqError& err )
133 if (tag_index >= tagList.size() || 0 == tagList[tag_index])
135 MSQ_SETERR(err)(MsqError::TAG_NOT_FOUND);
139 delete tagList[tag_index];
140 tagList[tag_index] = 0;
143 size_t MesquiteMesh::MeshTags::handle(
const std::string& name,
144 MsqError& err )
const
146 for (
size_t i = 0; i < tagList.size(); ++i)
147 if (tagList[i] && tagList[i]->desc.name == name)
155 const MesquiteMesh::MfemTagDescription& MesquiteMesh::MeshTags::properties(
156 size_t tag_index, MsqError& err )
const
158 static MfemTagDescription dummy_desc;
161 if (tag_index >= tagList.size() || !tagList[tag_index])
163 MSQ_SETERR(err)(
"Invalid tag handle", MsqError::INVALID_ARG);
167 return tagList[tag_index]->desc;
171 void MesquiteMesh::MeshTags::set_element_data(
size_t tag_index,
173 const size_t* index_array,
180 if (tag_index >= tagList.size() || !tagList[tag_index])
182 MSQ_SETERR(err)(
"Invalid tag handle", MsqError::INVALID_ARG);
186 TagData* tag = tagList[tag_index];
189 size_t total = tag->elementCount;
190 for (i = 0; i < num_indices; ++i)
191 if (index_array[i] >= total)
193 total = index_array[i] + 1;
197 if (total > tag->elementCount)
200 tag->elementData = realloc( tag->elementData, tag->desc.size * total );
202 if (tag->defaultValue)
204 data = ((
char*)tag->elementData) + tag->elementCount * tag->desc.size;
205 for (i = tag->elementCount; i < total; ++i)
207 memcpy( data, tag->defaultValue, tag->desc.size );
208 data += tag->desc.size;
213 memset( (
char*)tag->elementData + tag->elementCount * tag->desc.size, 0,
214 (total - tag->elementCount) * tag->desc.size );
216 tag->elementCount = total;
220 data = (
char*)tag->elementData;
221 const char* iter = (
const char*)values;
222 for (i = 0; i < num_indices; ++i)
224 memcpy( data + index_array[i]*tag->desc.size, iter, tag->desc.size );
225 iter += tag->desc.size;
229 void MesquiteMesh::MeshTags::get_element_data(
size_t tag_index,
231 const size_t* index_array,
233 MsqError& err )
const
236 if (tag_index >= tagList.size() || !tagList[tag_index])
238 MSQ_SETERR(err)(
"Invalid tag handle", MsqError::INVALID_ARG);
242 TagData* tag = tagList[tag_index];
244 char* iter = (
char*)values;
245 const char* data = (
const char*)tag->elementData;
247 for (
size_t i = 0; i < num_indices; ++i)
250 size_t index = index_array[i];
251 if (index >= tag->elementCount)
253 ptr = tag->defaultValue;
256 MSQ_SETERR(err)(MsqError::TAG_NOT_FOUND);
262 ptr = data + index * tag->desc.size;
265 memcpy( iter, ptr, tag->desc.size );
266 iter += tag->desc.size;
270 void MesquiteMesh::MeshTags::set_vertex_data(
size_t tag_index,
272 const size_t* index_array,
279 if (tag_index >= tagList.size() || !tagList[tag_index])
281 MSQ_SETERR(err)(
"Invalid tag handle", MsqError::INVALID_ARG);
285 TagData* tag = tagList[tag_index];
288 size_t total = tag->vertexCount;
289 for (i = 0; i < num_indices; ++i)
290 if (index_array[i] >= total)
292 total = index_array[i] + 1;
296 if (total > tag->vertexCount)
299 tag->vertexData = realloc( tag->vertexData, tag->desc.size * total );
301 if (tag->defaultValue)
303 data = ((
char*)tag->vertexData) + tag->vertexCount * tag->desc.size;
304 for (i = tag->vertexCount; i < total; ++i)
306 memcpy( data, tag->defaultValue, tag->desc.size );
307 data += tag->desc.size;
312 memset( (
char*)tag->vertexData + tag->vertexCount * tag->desc.size, 0,
313 (total - tag->vertexCount) * tag->desc.size );
315 tag->vertexCount = total;
319 data = (
char*)tag->vertexData;
320 const char* iter = (
const char*)values;
321 for (i = 0; i < num_indices; ++i)
323 memcpy( data + index_array[i]*tag->desc.size, iter, tag->desc.size );
324 iter += tag->desc.size;
328 void MesquiteMesh::MeshTags::get_vertex_data(
size_t tag_index,
330 const size_t* index_array,
332 MsqError& err )
const
335 if (tag_index >= tagList.size() || !tagList[tag_index])
337 MSQ_SETERR(err)(
"Invalid tag handle", MsqError::INVALID_ARG);
341 TagData* tag = tagList[tag_index];
343 char* iter = (
char*)values;
344 const char* data = (
const char*)tag->vertexData;
346 for (
size_t i = 0; i < num_indices; ++i)
349 size_t index = index_array[i];
350 if (index >= tag->vertexCount)
352 ptr = tag->defaultValue;
355 MSQ_SETERR(err)(MsqError::TAG_NOT_FOUND);
361 ptr = data + index * tag->desc.size;
364 memcpy( iter, ptr, tag->desc.size );
365 iter += tag->desc.size;
369 bool MesquiteMesh::MeshTags::tag_has_vertex_data(
size_t tag_index,
373 if (tag_index >= tagList.size() || !tagList[tag_index])
375 MSQ_SETERR(err)(
"Invalid tag handle", MsqError::INVALID_ARG);
379 TagData* tag = tagList[tag_index];
380 return 0 != tag->vertexData || tag->defaultValue;
383 bool MesquiteMesh::MeshTags::tag_has_element_data(
size_t tag_index,
387 if (tag_index >= tagList.size() || !tagList[tag_index])
389 MSQ_SETERR(err)(
"Invalid tag handle", MsqError::INVALID_ARG);
393 TagData* tag = tagList[tag_index];
394 return 0 != tag->elementData || tag->defaultValue;
397 MesquiteMesh::MeshTags::TagIterator MesquiteMesh::MeshTags::tag_begin()
400 while (index < tagList.size() && tagList[
index] == NULL)
404 return TagIterator(
this, index );
407 MesquiteMesh::MeshTags::TagIterator
411 while (index < tags->tagList.size() && NULL == tags->tagList[
index])
422 while (index < tags->tagList.size() && NULL == tags->tagList[
index])
434 while (index < tags->tagList.size() && NULL == tags->tagList[
index])
446 while (index < tags->tagList.size() && NULL == tags->tagList[
index])
457 : myTags( new MeshTags )
460 nelems = mesh->
GetNE();
469 dof_elem =
new Table;
474 ndofs = mesh->
GetNV();
478 mByte = vector<char>(ndofs);
479 mFixed = vector<bool>(ndofs,
false);
483 for (
int i = 0; i < mesh->
GetNBE(); i++)
493 for (
int j = 0; j < bdofs.Size(); j++)
495 mFixed[bdofs[j]] =
true;
507 Mesquite::MsqError& err)
509 elements.resize(nelems);
510 for (
int i = 0; i < nelems; i++)
512 elements[i] = (ElementHandle) i;
517 Mesquite::MsqError& err)
519 vertices.resize(ndofs);
520 for (
int i = 0; i < ndofs; i++)
522 vertices[i] = (VertexHandle) i;
527 MsqVertex* coordinates,
532 const size_t *indices = (
const size_t*) vert_array;
534 for (
int i = 0; i < num_vtx; i++)
536 mesh->
GetNode(indices[i], coords);
537 coordinates[i].x(coords[0]);
538 coordinates[i].y(coords[1]);
541 coordinates[i].z(coords[2]);
545 coordinates[i].z(0.0);
551 const Vector3D &coordinates,
555 coords[0] = coordinates.x();
556 coords[1] = coordinates.y();
557 coords[2] = coordinates.z();
558 mesh->
SetNode((
size_t) vertex, coords);
565 size_t index = (size_t) vertex;
570 const unsigned char *byte_array,
574 const size_t* indices = (
const size_t*) vert_array;
575 for (
int i = 0; i < array_size; i++)
577 mByte[indices[i]] = byte_array[i];
585 *byte = mByte[(
const size_t) vertex];
589 unsigned char *byte_array,
593 const size_t* indices = (
const size_t*) vertex;
594 for (
int i = 0; i < array_size; i++)
596 byte_array[i] = mByte[indices[i]];
601 std::vector<bool>& fixed_flag_array,
605 fixed_flag_array.resize(num_vtx + 1);
606 const size_t* indices = (
const size_t*) vert_array;
607 for (
int i = 0; i < num_vtx; i++)
609 fixed_flag_array[i] = mFixed[indices[i]];
614 const std::vector< bool > &fixed_flag_array,
618 const size_t* indices = (
const size_t*) vert_array;
619 for (
int i = 0; i < num_vtx; i++)
621 mFixed[indices[i]] = fixed_flag_array[i];
628 std::vector<VertexHandle>& vert_handles,
629 std::vector<size_t>& offsets,
632 const size_t* indices = (
const size_t*) elem_handles;
633 vert_handles.clear();
634 offsets.resize(num_elems + 1);
638 for (
int i = 0; i < num_elems; i++)
640 offsets[i] = vert_handles.size();
651 for (
int j = 0; j < elem_dofs.
Size(); j++)
655 vert_handles.push_back( (VertexHandle) elem_dofs[j] );
658 offsets[num_elems] = vert_handles.size();
664 std::vector<ElementHandle>& elements,
665 std::vector<size_t>& offsets,
668 const size_t* indices = (
const size_t*) vertex_array;
670 offsets.resize(num_vertex + 1);
672 for (
int i = 0; i < num_vertex; i++)
674 offsets[i] = elements.size();
675 int* vertex_elems = dof_elem->
GetRow(indices[i]);
676 for (
int j = 0; j < dof_elem->
RowSize(indices[i]); j++)
678 elements.push_back( (ElementHandle) vertex_elems[j] );
681 offsets[num_vertex] = elements.size();
685 *element_handle_array,
686 EntityTopology *element_topologies,
707 int mfem_to_mesquite[9] = {0,0,8,9,11,12,0,0,0};
708 const size_t* indices = (
const size_t*) element_handle_array;
709 for (
int i = 0; i < num_elements; i++)
711 element_topologies[i] = (EntityTopology) mfem_to_mesquite[mesh->
GetElementType(
730 TagHandle attributeTagHandle =
tag_create(
"material", Mesh::INT, 1, 0, err );
732 int *materialValues =
new int[nelems];
733 for (
int i=0; i<nelems; i++)
741 std::vector<ElementHandle> elements;
745 (
const void*)(materialValues), err );
747 delete[] materialValues;
757 size_t size = MeshTags::size_from_tag_type( type );
758 MfemTagDescription desc( name, type, length*size );
759 size_t index = myTags->create( desc, defval, err ); MSQ_ERRZERO(err);
760 return (TagHandle)
index;
765 myTags->destroy( (
size_t)handle, err ); MSQ_CHKERR(err);
770 size_t index = myTags->handle( name, err ); MSQ_ERRZERO(err);
773 MSQ_SETERR(err)( MsqError::TAG_NOT_FOUND,
"could not find tag \"%s\"",
776 return (TagHandle)
index;
785 const MfemTagDescription& desc
786 = myTags->properties( (
size_t)handle, err ); MSQ_ERRRTN(err);
790 length = (unsigned)(desc.size / MeshTags::size_from_tag_type( desc.type ));
796 const ElementHandle* elem_array,
800 myTags->set_element_data( (
size_t)handle,
802 (
const size_t*)elem_array,
804 err ); MSQ_CHKERR(err);
809 const ElementHandle* elem_array,
813 myTags->get_element_data( (
size_t)handle,
815 (
const size_t*)elem_array,
817 err ); MSQ_CHKERR(err);
822 const VertexHandle* elem_array,
826 myTags->set_vertex_data( (
size_t)handle,
828 (
const size_t*)elem_array,
830 err ); MSQ_CHKERR(err);
835 const VertexHandle* elem_array,
839 myTags->get_vertex_data( (
size_t)handle,
841 (
const size_t*)elem_array,
843 err ); MSQ_CHKERR(err);
853 int mNumInterfaceSmoothIters = 5;
854 bool mFixBndryInInterfaceSmooth =
true;
855 bool project_gradient=
false;
856 double cos_crease_angle=0.2;
859 std::vector<Mesquite::Mesh::VertexHandle> vertices;
861 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
862 int num_vertices = vertices.size();
865 std::vector<bool> app_fixed(num_vertices);
868 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
869 int num_app_fixed = 0;
871 for (
int i = 0; i < num_vertices; i++)
873 if (app_fixed[i]) { num_app_fixed++; }
876 mfem::out <<
"mesh has " << num_vertices <<
" vertices and " << num_app_fixed <<
880 Mesquite::PlanarDomain
geom( PlanarDomain::XY );
886 Mesquite::MeshBoundaryDomain2D* mesh_domain =
new
887 Mesquite::MeshBoundaryDomain2D( MeshBoundaryDomain2D::XY, 0.0, project_gradient,
888 Mesquite::MeshBoundaryDomain2D::QUADRATIC);
889 mesh_domain->skin_area_mesh(&mesh,cos_crease_angle,
"material");
891 std::vector<Mesquite::Mesh::VertexHandle> theBoundaryVertices;
892 mesh_domain->get_boundary_vertices( theBoundaryVertices );
894 int num_boundary_vertices = theBoundaryVertices.size();
896 std::vector<Mesquite::Mesh::VertexHandle> theBoundaryEdges;
897 mesh_domain->get_boundary_edges( theBoundaryEdges );
900 std::vector<bool> fixed_flags_boundary(num_boundary_vertices);
903 std::vector<bool> app_fixed_boundary(num_boundary_vertices);
905 num_boundary_vertices, err);
907 int num_app_fixed_boundary = 0;
908 for (
int i = 0; i < num_boundary_vertices; i++)
910 if (app_fixed_boundary[i]) { num_app_fixed_boundary++; }
913 mfem::out <<
"mesh has " << num_boundary_vertices <<
" boundary vertices and "
914 << num_app_fixed_boundary <<
" are app fixed" << std::endl;
918 int num_fixed_boundary_flags = 0;
920 std::vector<Mesquite::Mesh::VertexHandle> theCornerVertices;
921 mesh_domain->get_corner_vertices( theCornerVertices );
925 for (
int i = 0; i < num_boundary_vertices; i++)
927 if (!mFixBndryInInterfaceSmooth)
929 fixed_flags_boundary[i] =
false;
933 fixed_flags_boundary[i] = app_fixed_boundary[i];
936 for (
int j = 0; j < theCornerVertices.size(); j++)
939 if (theCornerVertices[j] == theBoundaryVertices[i])
941 fixed_flags_boundary[i] =
true;
942 num_fixed_boundary_flags++;
947 printf(
"fixed %d of %d boundary vertices (those classified corner)\n",
948 num_fixed_boundary_flags, num_boundary_vertices);
952 Mesquite::InstructionQueue boundary_queue;
953 Mesquite::InstructionQueue interior_queue;
956 boundary_queue.set_slaved_ho_node_mode(Settings::SLAVE_ALL);
957 interior_queue.set_slaved_ho_node_mode(Settings::SLAVE_ALL);
959 TShapeB1 targetMetric;
963 TQualityMetric metric( &tc, &targetMetric );
965 Mesquite::LPtoPTemplate* obj_func =
new Mesquite::LPtoPTemplate(&metric, pOrder,
967 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
969 Mesquite::QuasiNewton* boundary_alg =
new Mesquite::QuasiNewton( obj_func);
970 boundary_alg->use_element_on_vertex_patch();
972 Mesquite::QuasiNewton* interior_alg =
new Mesquite::QuasiNewton( obj_func );
973 interior_alg->use_global_patch();
976 double grad_norm = 1e-5;
977 double successiveEps = 1e-5;
978 int boundary_outer = 5;
979 int boundary_inner = 3;
982 Mesquite::TerminationCriterion* boundaryTermInner =
new
983 Mesquite::TerminationCriterion();
984 Mesquite::TerminationCriterion* boundaryTermOuter =
new
985 Mesquite::TerminationCriterion();
988 boundaryTermOuter->add_relative_successive_improvement(successiveEps);
989 boundaryTermOuter->add_iteration_limit(boundary_outer);
990 boundaryTermInner->add_iteration_limit(boundary_inner);
992 ostringstream bndryStream;
993 bndryStream<<
"boundary_"<<targetMetric.get_name()<<
"_p"<<pOrder;
994 boundaryTermOuter->write_mesh_steps(bndryStream.str().c_str());
995 boundary_alg->set_outer_termination_criterion(boundaryTermOuter);
996 boundary_alg->set_inner_termination_criterion(boundaryTermInner);
999 Mesquite::TerminationCriterion* interiorTermInner =
new
1000 Mesquite::TerminationCriterion();
1001 Mesquite::TerminationCriterion* interiorTermOuter =
new
1002 Mesquite::TerminationCriterion();
1003 interiorTermInner->add_absolute_gradient_L2_norm(grad_norm);
1004 interiorTermInner->add_relative_successive_improvement(successiveEps);
1006 interiorTermInner->add_iteration_limit(100);
1008 ostringstream interiorStream;
1009 interiorStream<<
"interior_"<<targetMetric.get_name()<<
"_p"<<pOrder;
1010 interiorTermOuter->write_mesh_steps(interiorStream.str().c_str());
1011 interiorTermOuter->add_iteration_limit(1);
1012 interior_alg->set_outer_termination_criterion(interiorTermOuter);
1013 interior_alg->set_inner_termination_criterion(interiorTermInner);
1027 boundary_queue.set_master_quality_improver(boundary_alg, err);
1029 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1033 interior_queue.set_master_quality_improver(interior_alg, err);
1035 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1039 std::vector<bool> fixed_flags(num_vertices);
1041 for (
int j=0; j<mNumInterfaceSmoothIters; j++)
1044 mfem::out<<
" Boundary + Interior smoothing pass "<< j<<
"....."<<endl;
1047 for (
int i = 0; i < num_vertices; i++) { fixed_flags[i] =
true; }
1049 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1052 num_boundary_vertices, err);
1053 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1059 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1061 for (
int i = 0; i < num_vertices; i++)
1063 if (fixed_flags[i]) { num_fixed++; }
1066 mfem::out <<
" For Boundary smooth, mesh has " << num_vertices <<
1067 " vertices and " << num_fixed <<
" are fixed. "<<endl;
1073 boundary_queue.run_instructions(&mesh, mesh_domain, err);
1074 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1075 mfem::out<<
" boundary smooth completed in "<<boundaryTermOuter->get_iteration_count()
1076 <<
" outer and "<<boundaryTermInner->get_iteration_count()
1077 <<
" inner iterations."<<endl;
1082 if (!mFixBndryInInterfaceSmooth)
1087 for (
int i = 0; i < num_vertices; i++) { fixed_flags[i] =
false; }
1097 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1098 for (
int i = 0; i < num_boundary_vertices; i++) { fixed_flags[i] =
true; }
1101 num_boundary_vertices, err);
1102 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1108 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1110 for (
int i = 0; i < num_vertices; i++)
1112 if (fixed_flags[i]) { num_fixed++; }
1115 mfem::out <<
" For Interior smooth, mesh has " << num_vertices <<
1116 " vertices and " << num_fixed <<
" are fixed. "<<endl;
1121 interior_queue.run_instructions(&mesh, &
geom, err);
1122 if (MSQ_CHKERR(err)) {
mfem::out << err << std::endl; exit(EXIT_FAILURE);}
1123 mfem::out<<
" interior smooth completed in "<<interiorTermOuter->get_iteration_count()
1124 <<
" outer and "<<interiorTermInner->get_iteration_count()
1125 <<
" inner iterations."<<endl;
1131 delete interiorTermOuter;
1132 delete interiorTermInner;
1133 delete boundaryTermOuter;
1134 delete boundaryTermInner;
1135 delete interior_alg;
1136 delete boundary_alg;
1147 MsqDebug::enable(1);
1152 const double vert_move_tol = 1e-3;
1154 switch (mesquite_option)
1156 case 0: method =
new LaplaceWrapper();
break;
1157 case 1: method =
new UntangleWrapper();
break;
1158 case 2: method =
new ShapeImprover();
break;
1159 case 3: method =
new PaverMinEdgeLengthWrapper(vert_move_tol);
break;
1162 if ( mesquite_option < 4 )
1165 method->set_slaved_ho_node_mode(Settings::SLAVE_NONE);
1169 method->run_instructions(&msq_mesh, err);
1173 Vector3D normal(0,0,1);
1174 Vector3D point(0,0,0);
1175 PlanarDomain mesh_plane(normal, point);
1177 method->run_instructions(&msq_mesh, &mesh_plane, err);
1183 BoundaryPreservingOptimization( msq_mesh );
void vertices_set_byte(const VertexHandle *vert_array, const unsigned char *byte_array, size_t array_size, MsqError &err)
void get_all_vertices(std::vector< VertexHandle > &vertices, MsqError &err)
void vertices_set_fixed_flag(const VertexHandle vert_array[], const std::vector< bool > &fixed_flag_array, size_t num_vtx, MsqError &err)
TagHandle tag_create(const std::string &tag_name, TagType type, unsigned length, const void *default_value, MsqError &err)
void vertex_set_coordinates(VertexHandle vertex, const Vector3D &coordinates, MsqError &err)
int Size() const
Return the logical size of the array.
int GetNDofs() const
Returns number of degrees of freedom.
void BuildElementToDofTable() const
virtual void GetVertices(Array< int > &v) const =0
Returns element's vertices.
int GetNBE() const
Returns number of boundary elements.
Element::Type GetElementType(int i) const
Returns the type of element i.
MesquiteMesh(mfem::Mesh *mfem_mesh)
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
void tag_get_element_data(TagHandle handle, size_t num_elems, const ElementHandle *elem_array, void *tag_data, MsqError &err)
int GetNE() const
Returns number of elements.
void get_all_elements(std::vector< ElementHandle > &elements, MsqError &err)
void vertices_get_coordinates(const VertexHandle vert_array[], MsqVertex *coordinates, size_t num_vtx, MsqError &err)
void tag_properties(TagHandle handle, std::string &name_out, TagType &type_out, unsigned &length_out, MsqError &err)
void vertex_set_byte(VertexHandle vertex, unsigned char byte, MsqError &err)
void MesquiteSmooth(const int mesquite_option=0)
void vertices_get_attached_elements(const VertexHandle *vertex_array, size_t num_vertex, std::vector< ElementHandle > &elements, std::vector< size_t > &offsets, MsqError &err)
void tag_get_vertex_data(TagHandle handle, size_t num_elems, const VertexHandle *node_array, void *tag_data, MsqError &err)
void vertices_get_fixed_flag(const VertexHandle vert_array[], std::vector< bool > &fixed_flag_array, size_t num_vtx, MsqError &err)
virtual void GetElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
void tag_set_vertex_data(TagHandle handle, size_t num_elems, const VertexHandle *node_array, const void *tag_data, MsqError &err)
void tag_delete(TagHandle handle, MsqError &err)
void Transpose(const Table &A, Table &At, int _ncols_A)
Transpose a Table.
const Element * GetElement(int i) const
FiniteElementSpace * FESpace()
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
void vertices_get_byte(const VertexHandle *vertex, unsigned char *byte_array, size_t array_size, MsqError &err)
virtual void GetBdrElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom for i'th boundary element.
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
void GetNode(int i, double *coord) const
int index(int i, int j, int nx, int ny)
void vertex_get_byte(const VertexHandle vertex, unsigned char *byte, MsqError &err)
void elements_get_topologies(const ElementHandle *element_handle_array, EntityTopology *element_topologies, size_t num_elements, MsqError &err)
void GetNodes(Vector &node_coord) const
void SetNode(int i, const double *coord)
const Table & GetElementToDofTable() const
Return a reference to the internal Table that stores the lists of scalar dofs, for each mesh element...
TagHandle tag_get(const std::string &name, MsqError &err)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void tag_set_element_data(TagHandle handle, size_t num_elems, const ElementHandle *elem_array, const void *tag_data, MsqError &err)
int GetAttribute(int i) const
Return the attribute of element i.
void elements_get_attached_vertices(const ElementHandle *elem_handles, size_t num_elems, std::vector< VertexHandle > &vert_handles, std::vector< size_t > &offsets, MsqError &err)
void GetBdrElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of boundary element i.
int get_geometric_dimension(MsqError &err)
Table * GetVertexToElementTable()
The returned Table must be destroyed by the caller.