本文整理汇总了C++中PatchData::get_mesh方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchData::get_mesh方法的具体用法?C++ PatchData::get_mesh怎么用?C++ PatchData::get_mesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchData
的用法示例。
在下文中一共展示了PatchData::get_mesh方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_weight
double WeightReader::get_weight( PatchData &pd,
size_t element,
Sample sample,
MsqError& err )
{
WeightReaderData& data = get_data( pd );
// calculate index of sample in array
NodeSet all_samples = pd.get_samples( element );
unsigned offset = all_samples.num_before( sample );
if (!data.weights.empty() && data.elementIndex == element) {
assert(offset < data.weights.size());
return data.weights[offset];
}
const unsigned num_samples = all_samples.num_nodes();
const unsigned handle_idx = num_samples - 1;
// get the tag handle
const TagHandle INVALID_HANDLE = (TagHandle)-1;
if (data.handles.size() <= handle_idx)
data.handles.resize( handle_idx + 1, INVALID_HANDLE );
TagHandle& tag_handle = data.handles[handle_idx];
if (tag_handle == INVALID_HANDLE) {
tag_handle = get_tag( pd.get_mesh(),
num_samples,
tagBaseName.c_str(),
err );
MSQ_ERRZERO(err);
assert(tag_handle != INVALID_HANDLE);
}
// get the tag data
data.weights.resize( num_samples );
pd.get_mesh()->tag_get_element_data( tag_handle, 1,
pd.get_element_handles_array() + element,
&data.weights[0],
err );
if (MSQ_CHKERR(err)) {
data.weights.clear();
return false;
}
data.elementIndex = element;
assert(offset < num_samples);
return data.weights[offset];
}
示例2: initialize
void TCTFauxOptimizer::initialize( PatchData& pd, MsqError& err )
{
CPPUNIT_ASSERT(all.empty());
culled.clear();
visited.clear();
numPasses = 1;
pd.get_mesh()->get_all_vertices( all, err ); MSQ_ERRRTN(err);
std::vector<bool> fixed;
pd.get_mesh()->vertices_get_fixed_flag( &all[0], fixed, all.size(), err );
size_t w = 0;
for (size_t r = 0; r < all.size(); ++r)
if (!fixed[r])
all[w++] = all[r];
all.resize(w);
MSQ_ERRRTN(err);
perturbFrac = 1;
}
示例3: optimize_vertex_positions
void NonSmoothDescent::optimize_vertex_positions(PatchData &pd,
MsqError &err)
{
MSQ_FUNCTION_TIMER( "NonSmoothDescent" );
// cout << "- Executing NonSmoothDescent::optimize_node_positions()\n";
/* perform the min max smoothing algorithm */
MSQ_PRINT(2)("\nInitializing the patch iteration\n");
MSQ_PRINT(3)("Number of Vertices: %d\n",(int)pd.num_nodes());
MSQ_PRINT(3)("Number of Elements: %d\n",(int)pd.num_elements());
//Michael: Note: is this a reliable way to get the dimension?
mDimension = pd.get_mesh()->get_geometric_dimension(err); MSQ_ERRRTN(err);
MSQ_PRINT(3)("Spatial Dimension: %d\n",mDimension);
MSQ_PRINT(3)("Num Free = %d\n",(int)pd.num_free_vertices());
MsqFreeVertexIndexIterator free_iter(pd, err); MSQ_ERRRTN(err);
free_iter.reset();
free_iter.next();
freeVertexIndex = free_iter.value();
MSQ_PRINT(3)("Free Vertex Index = %d\n",freeVertexIndex);
// TODO - need to switch to validity via metric evaluations should
// be associated with the compute_function somehow
/* check for an invalid mesh; if it's invalid return and ask the user
to use untangle */
if (this->validity_check(pd,err)!=1) {
MSQ_PRINT(1)("ERROR: Invalid mesh\n");
MSQ_SETERR(err)("Invalid Mesh: Use untangle to create a valid "
"triangulation", MsqError::INVALID_MESH);
return;
}
/* assumes one function value per element */
// TODO - need to include vertex metrics
numFunctionValues = pd.num_elements();
/* initialize the optimization data up to numFunctionValues */
this->init_opt(err); MSQ_ERRRTN(err);
this->init_max_step_length(pd,err); MSQ_ERRRTN(err);
MSQ_PRINT(3)("Done initializing optimization\n");
/* compute the initial function values */
//TODO this should return a bool with the validity
this->compute_function(&pd, originalFunction, err); MSQ_ERRRTN(err);
// find the initial active set
this->find_active_set(originalFunction, mActive, err); MSQ_ERRRTN(err);
this->minmax_opt(pd,err); MSQ_ERRRTN(err);
}
示例4: write_timestep
void TerminationCriterion::write_timestep( PatchData& pd,
const Vector3D* gradient,
MsqError& err )
{
std::ostringstream str;
if (timeStepFileType == VTK) {
str << timeStepFileName << '_' << iterationCounter << ".vtk";
MeshWriter::write_vtk( pd, str.str().c_str(), err, gradient );
}
else if (timeStepFileType == GNUPLOT) {
str << timeStepFileName << '.' << iterationCounter;
MeshWriter::write_gnuplot( pd.get_mesh(), str.str().c_str(), err );
}
}