47 #include "QualityImprover.hpp"
48 #include "MsqError.hpp"
49 #include "MsqDebug.hpp"
52 #ifdef MSQ_USE_OLD_IO_HEADERS
88 list<Mesquite::Mesh*>::iterator it =
meshSet.begin();
116 MSQ_SETERR(err)(
"Meshes of different dimensions added to the same MeshSet.",
198 MSQ_SETERR(err)(
"no implementation for specified patch type.",
223 if ((
unsigned)num_layers > (
unsigned)1)
225 MSQ_SETERR(err)(
"no implementation for patch depth > 1.",
246 bool next_vertex_identified =
false;
247 while (!next_vertex_identified)
265 (*currentMesh)->vertices_are_on_boundary(&vtx, &on_bnd, 1, err);
289 (*currentMesh)->vertex_get_byte(**
vertexIterator,¢er_fixed_byte, err);
302 next_vertex_identified =
true;
308 if(num_layers == 0 ){
311 (*currentMesh)->vertices_get_coordinates(&vertex,
325 (*currentMesh)->vertex_get_attached_element_count(vertex, err);
337 (*currentMesh)->vertex_get_attached_elements(vertex,
353 size_t num_vert_uses = (*currentMesh)->
359 size_t num_verts = num_vert_uses - num_elems + 1;
387 for (i = 0; i < num_elems; ++
i)
400 for (i = 0; i < num_verts; i++)
433 "Global patches only supported for single-Mesh MeshSets.",
450 size_t num_verts, num_elems, num_uses;
451 (*currentMesh)->get_all_sizes( num_verts, num_elems, num_uses, err );
MSQ_ERRZERO(err);
457 msq_std::vector<size_t> offsets(num_elems+1);
460 &offsets[0], offsets.size(),
467 msq_std::vector<EntityTopology> elem_topologies(num_elems);
474 for (i = 0; i < num_elems; ++
i)
475 pd_elem_array[i].set_element_type( elem_topologies[i] );
501 for (i = 0; i < num_verts; i++)
559 list<Mesquite::Mesh*>::iterator mesh_itr = meshSet.begin();
560 assert( mesh_itr != meshSet.end() );
569 if ( mesh_itr==meshSet.end() )
571 cur_mesh = *mesh_itr;
573 vert_itr = cur_mesh->vertex_iterator(err);
MSQ_ERRRTN(err);
600 bool finished_with_vertices=
false;
606 while(!finished_with_vertices){
615 finished_with_vertices=
true;
617 if(!finished_with_vertices){
625 (*currentMesh)->vertex_get_byte(**
vertexIterator,&fixed_byte, err);
627 fixed_byte &= (~
MsqVertex::MSQ_SOFT_FIXED);
628 (*currentMesh)->vertex_set_byte(**
vertexIterator,fixed_byte, err);
655 msq_stdio::ofstream file(out_filename);
670 file <<
"# vtk DataFile Version 2.0\n";
671 file <<
"Mesquite Mesh " << out_filename <<
" .\n";
673 file <<
"DATASET UNSTRUCTURED_GRID\n";
676 file <<
"POINTS " << pd.
num_nodes() <<
" float\n";
686 size_t connectivity_size = 0;
690 file <<
"CELLS " << pd.
num_elements() <<
' ' << connectivity_size <<
'\n';
693 std::vector<size_t> vtx_indices;
695 file << vtx_indices.size();
696 for (msq_stdc::size_t
j = 0;
j < vtx_indices.size(); ++
j)
698 file <<
' ' << vtx_indices[
j];
707 unsigned char type_id = 0;
726 file << (int)type_id <<
'\n';
731 <<
"\nSCALARS fixed float\nLOOKUP_TABLE default\n";
759 string out_filename = out_filebase;
760 out_filename +=
".gpt";
761 ofstream file(out_filename.c_str());
780 std::vector<size_t> vtx_indices;
782 for (
size_t j = 0;
j < vtx_indices.size(); ++
j)
Iterates through a set of entities. An EntityIterator is typically obtained via Mesh::vertex_iterator...
msq_stdc::size_t elemArraySize
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
PatchDataMem< MsqVertex > vertexArray
void set_patch_type(PatchData::PatchType patch_type, MsqError &err, int patch_param1=0, int patch_param2=0)
Tells the MeshSet what kind of data the patches should include.
void resize(size_t new_size)
Used to hold the error state and return it to the application.
void set_domain_constraint(MeshDomain *domain, MsqError &err)
Sets the geometrical domain for the MeshSet.
msq_stdc::size_t vertArraySize
Mesquite::VertexIterator * vertexIterator
Keeps track of where we are in the current mesh's vertex list.
requested functionality is not (yet) implemented
EntityHandle VertexHandle
vertex is fixed. This flag can be set on and off.
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
bool get_next_global_patch(PatchData &, PatchDataParameters &, MsqError &)
PatchDataMem< size_t > elemConnectivityArray
bool get_next_elem_on_vert_patch(PatchData &, PatchDataParameters &, MsqError &)
void write_vtk(const char *out_filebase, MsqError &err)
msq_stdc::size_t csrOffsetsSize
void initialize_data(size_t *elem_offset_array, MsqError &err)
Call after filling vertex handle and connectivity arrays to finish initializing the PatchData...
void update_mesh(const PatchData &pd, MsqError &err)
Updates the coordinates in the underlying mesh with the coordinates stored in PatchData.
size_t num_elements() const
number of elements in the Patch.
void clear()
Removes data.
msq_std::list< Mesquite::Mesh * >::iterator currentMesh
Keeps track of which Mesh* we're currently working with in get_next_patch().
#define MSQ_CHKERR(err)
Mesquite's Error Checking macro.
int spaceDim
The number of coordinates in this mesh (2D or 3D)
int get_nb_layers(MsqError &err)
Returns numbers of layers for local patch.
msq_stdc::size_t * csrOffsets
These are arrays that we cache so we don't have to reallocate at every patch.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
Mesquite::MeshDomain * mDomain
virtual DomainHint hint() const =0
Give a hint about the nature of the domain for better performance.
long unsigned int get_culling_method_bits()
returns the bitset.
Mesquite::EntityTopology * elemTopologies
A Mesquite::Mesh is a collection of mesh elements which are composed of mesh vertices. Intermediate objects are not accessible through this interface (where intermediate objects include things like the faces of a hex, or an element's edges).
size_t num_nodes() const
Get number of nodes (vertex + higher-order nodes)
void no_culling_method()
No culling performed (sets off all culling criteria).
File cannot be opened/created.
void write_gnuplot(const char *out_filebase, MsqError &err)
PatchDataMem< MsqMeshEntity > elementArray
const MsqVertex * get_vertex_array(MsqError &err) const
Returns a pointer to the start of the vertex array.
msq_std::list< Mesquite::Mesh * > meshSet
Meshes in this MeshSet.
PatchData::PatchType get_patch_type()
Returns Patch Type (local around vertices, local around elements, global)
vertex is always fixed. This can only be set on and never off.
object is in an invalid state
bool clear_all_soft_fixed_flags(MsqError &err)
Mesquite::MsqVertex::FlagMask cullFlag
#define MSQ_FUNCTION_TIMER(NAME)
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
virtual bool is_at_end() const =0
Returns false until the iterator has been advanced PAST the last entity.
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray
const MsqMeshEntity * get_element_array(MsqError &err) const
Returns a pointer to the start of the element array.
virtual void restart()=0
Moves the iterator back to the first entity in the list.
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
void add_mesh(Mesquite::Mesh *mesh, MsqError &err)
adds a mesh to the MeshSet.
virtual int get_geometric_dimension(MsqError &err)=0
Returns whether this mesh lies in a 2D or 3D coordinate system.
void reset(MsqError &err)
Resets the MeshSet object so that get_next_patch() will restart its iterations at the first vertex...
bool get_next_patch(PatchData &pd, PatchDataUser *pd_user, MsqError &err)
Gets the next PatchData.