本文整理汇总了C++中hermes::vector::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::empty方法的具体用法?C++ vector::empty怎么用?C++ vector::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hermes::vector
的用法示例。
在下文中一共展示了vector::empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void NeighborSearch<Scalar>::clear_initial_sub_idx()
{
_F_;
if(neighborhood_type != H2D_DG_GO_DOWN)
return;
// Obtain the transformations sequence.
Hermes::vector<unsigned int> transformations = get_transforms(original_central_el_transform);
// Test for active element.
if(transformations.empty())
return;
for(unsigned int i = 0; i < n_neighbors; i++)
{
// Find the index where the additional subelement mapping (on top of the initial one from assembling) starts.
unsigned int j = 0;
// Note that we do not have to test if central_transformations is empty or how long it is, because it has to be
// longer than transformations (and that is tested).
// Also the function compatible_transformations() does not have to be used, as now the array central_transformations
// has been adjusted so that it contains the array transformations.
while(central_transformations.get(i)->transf[j] == transformations[j])
if(++j > transformations.size() - 1)
break;
central_transformations.get(i)->strip_initial_transformations(j);
}
}
示例2:
void OGProjectionNOX<Scalar>::project_global(Hermes::vector<SpaceSharedPtr<Scalar> > spaces, Hermes::vector<MeshFunctionSharedPtr<Scalar> > source_slns,
Scalar* target_vec, Hermes::vector<NormType> proj_norms,
double newton_tol, int newton_max_iter)
{
int n = spaces.size();
// Sanity checks.
if(n != source_slns.size()) throw Exceptions::LengthException(1, 2, n, source_slns.size());
if(target_vec == nullptr) throw Exceptions::NullException(3);
if(!proj_norms.empty() && n != proj_norms.size()) throw Exceptions::LengthException(1, 5, n, proj_norms.size());
int start_index = 0;
for (int i = 0; i < n; i++)
{
if(proj_norms.empty())
project_global(spaces[i], source_slns[i], target_vec + start_index, HERMES_UNSET_NORM, newton_tol, newton_max_iter);
else
project_global(spaces[i], source_slns[i], target_vec + start_index, proj_norms[i], newton_tol, newton_max_iter);
start_index += spaces[i]->get_num_dofs();
}
}
示例3: LengthException
void OGProjection<Scalar>::project_global(Hermes::vector<SpaceSharedPtr<Scalar> > spaces, Hermes::vector<MeshFunctionSharedPtr<Scalar> > source_slns,
Hermes::vector<MeshFunctionSharedPtr<Scalar> > target_slns, Hermes::vector<NormType> proj_norms, bool delete_old_meshes)
{
int n = spaces.size();
// Sanity checks.
if(n != source_slns.size())
throw Exceptions::LengthException(1, 2, n, source_slns.size());
if(n != target_slns.size())
throw Exceptions::LengthException(1, 2, n, target_slns.size());
if(!proj_norms.empty() && n != proj_norms.size())
throw Exceptions::LengthException(1, 5, n, proj_norms.size());
int start_index = 0;
for (int i = 0; i < n; i++)
{
if(proj_norms.empty())
project_global(spaces[i], source_slns[i], target_slns[i], HERMES_UNSET_NORM);
else
project_global(spaces[i], source_slns[i], target_slns[i], proj_norms[i]);
start_index += spaces[i]->get_num_dofs();
}
}