本文整理汇总了C++中PatchData::initialize_data方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchData::initialize_data方法的具体用法?C++ PatchData::initialize_data怎么用?C++ PatchData::initialize_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchData
的用法示例。
在下文中一共展示了PatchData::initialize_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_next_global_patch
bool MeshSet::get_next_global_patch( PatchData& pd,
PatchDataParameters& pd_params,
MsqError& err )
{
// We only support global patches for a single Mesh
if (meshSet.size() != 1)
{
MSQ_SETERR(err)(
"Global patches only supported for single-Mesh MeshSets.",
MsqError::NOT_IMPLEMENTED );
return false;
}
pd.mType = PatchData::GLOBAL_PATCH;
pd.domainHint = NO_DOMAIN_HINT;
if (mDomain)
pd.domainHint = mDomain->hint();
// for a global patch, we always reset to start of the mesh.
reset(err);
if (MSQ_CHKERR(err)) return false;
size_t i;
// Get sizes for mesh data
size_t num_verts, num_elems, num_uses;
(*currentMesh)->get_all_sizes( num_verts, num_elems, num_uses, err ); MSQ_ERRZERO(err);
// Get handles and connectivity
pd.vertexHandlesArray.resize( num_verts );
pd.elementHandlesArray.resize( num_elems );
pd.elemConnectivityArray.resize( num_uses );
msq_std::vector<size_t> offsets(num_elems+1);
(*currentMesh)->get_all_mesh( &pd.vertexHandlesArray[0], num_verts,
&pd.elementHandlesArray[0], num_elems,
&offsets[0], offsets.size(),
&pd.elemConnectivityArray[0],
pd.elemConnectivityArray.size(),
err ); MSQ_ERRZERO(err);
// Get element topologies
pd.elementArray.resize( num_elems );
msq_std::vector<EntityTopology> elem_topologies(num_elems);
(*currentMesh)->elements_get_topologies( &pd.elementHandlesArray[0],
&elem_topologies[0],
num_elems, err );MSQ_ERRZERO(err);
// Put them into the patch
MsqMeshEntity* pd_elem_array = pd.get_element_array(err);MSQ_ERRZERO(err);
for (i = 0; i < num_elems; ++i)
pd_elem_array[i].set_element_type( elem_topologies[i] );
// Complete connectivity data in patch
pd.initialize_data( &offsets[0], err ); MSQ_ERRZERO(err);
// Get vertex coordinates
pd.vertexArray.resize( num_verts );
MsqVertex* pd_vert_array = pd.get_vertex_array(err);MSQ_ERRZERO(err);
(*currentMesh)->vertices_get_coordinates(&pd.vertexHandlesArray[0],
pd_vert_array,
num_verts,
err); MSQ_ERRZERO(err);
// Get vertex boundary flag
if (vertArraySize < num_verts)
{
delete [] vertexOnBoundary;
vertArraySize = num_verts;
vertexOnBoundary = new bool[vertArraySize];
}
(*currentMesh)->vertices_are_on_boundary( &pd.vertexHandlesArray[0],
vertexOnBoundary,
num_verts,
err );MSQ_ERRZERO(err);
for (i = 0; i < num_verts; i++)
{
// Get its flags
/*(*currentMesh)->vertex_get_byte(vertArray[i],
&(pd_vert_array[i].vertexBitFlags),
err); MSQ_CHKERR(err);*/
// Set its hard-fixed flag
if (/*(*currentMesh)->vertex_is_fixed(vertArray[i], err) ||*/
vertexOnBoundary[i])
{
pd_vert_array[i].vertexBitFlags |= MsqVertex::MSQ_HARD_FIXED;
}
else
{
pd_vert_array[i].vertexBitFlags &= ~(MsqVertex::MSQ_HARD_FIXED);
}
}
return true;
}
示例2: get_next_elem_on_vert_patch
//.........这里部分代码省略.........
else{
//get the fixed_bit_flag for the center vertex
(*currentMesh)->vertex_get_byte(**vertexIterator,¢er_fixed_byte, err);
if (MSQ_CHKERR(err)) return false;
//remove the hard fixed flag if it has been set
center_fixed_byte &= ~(MsqVertex::MSQ_HARD_FIXED);
//if it is culled, skip it
if(center_fixed_byte & cullFlag)
{
++(*vertexIterator);
}
else
{
// We found the right one
next_vertex_identified = true;
}//end else (vertex was not fixed [boundary] or culled)
}//end else (iterator was not at the end and vertex was not boundary)
}//end while (!next_vertex_identified)
Mesh::VertexHandle vertex = **vertexIterator;
vertexIterator->operator++();
if(num_layers == 0 ){
pd.vertexArray.resize( 1 );
MsqVertex* pd_vert_array = pd.get_vertex_array(err);
(*currentMesh)->vertices_get_coordinates(&vertex,
pd_vert_array,
1,
err); MSQ_ERRZERO(err);
pd_vert_array[0].vertexBitFlags=center_fixed_byte;
pd.vertexHandlesArray.resize(1);
pd.vertexHandlesArray[0]=vertex;
pd.initialize_data( NULL, err ); MSQ_ERRZERO(err);
return true;
}
// Get the number of elements in this vertex
size_t num_elems =
(*currentMesh)->vertex_get_attached_element_count(vertex, err);
if (MSQ_CHKERR(err)) return false;
pd.elementHandlesArray.resize( num_elems );
// Get the elements attached to this vertex
if (elemArraySize < num_elems)
{
delete [] elemTopologies;
elemTopologies = new EntityTopology[num_elems];
elemArraySize = num_elems;
}
(*currentMesh)->vertex_get_attached_elements(vertex,
&pd.elementHandlesArray[0],
num_elems, err);
if (MSQ_CHKERR(err)) return false;
// Get the topologies of those elements
(*currentMesh)->elements_get_topologies(&pd.elementHandlesArray[0],
elemTopologies,
num_elems, err);
if (MSQ_CHKERR(err)) return false;
// Figure out how many vertices we need to allocate
//size_t num_vert_uses = 1;
//size_t i;
//for (i = 0; i < num_elems; ++i)
// num_vert_uses += vertices_in_topology(elemTopologies[i]);