本文整理汇总了C++中Model::FormRegionFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::FormRegionFrom方法的具体用法?C++ Model::FormRegionFrom怎么用?C++ Model::FormRegionFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::FormRegionFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configure
/**
This is based on a nearest node criterion to all boundaries.
@todo Improve efficiency. In most cases, we should be able to specify boundaries as planes
@todo Somewhat dependent on the resolution of the model boundary
*/
bool OmegaBDistanceConfigurator::configure(Model& m) const
{
Point<3> ebc;
m.UpdateIndices();
vector<size_t> omega_ids;
omega_ids.reserve(m.Region("Model").Elements());
for (const auto& eit : m.Region("Model").ElementVector())
{
ebc = eit->BaryCenter();
double dmin = numeric_limits<double>::max();
for (Model::boundaryIterator bit = m.BoundariesBegin(); bit != m.BoundariesEnd(); ++bit)
{
if (!is_main_boundary_id(bit->first.second))
continue;
for (const auto& bnit : bit->second.NodeVector())
{
double const dist = ebc.DistanceTo(bnit->Coordinate());
if (dist < dmin)
dmin = dist;
}
}
if (dmin >= dist_)
omega_ids.push_back(eit->Idx());
}
if (omega_ids.size()) {
m.FormRegionFrom("omega", omega_ids);
return true;
}
return false;
}
示例2: configure
bool OmegaCornerPointsConfigurator::configure(Model& m) const
{
size_t i(0);
Point<3> ebc;
m.UpdateIndices();
for (const auto& cpp : cpts_) {
auto cmm = min_max(cpp);
vector<size_t> omega_ids;
omega_ids.reserve(m.Region("Model").Elements());
for (const auto& eit : m.Region("Model").ElementVector())
{
ebc = eit->BaryCenter();
if (!within_bounds(ebc, cmm))
continue; // not within min-max bounds
omega_ids.push_back(eit->Idx()); // is within min-max bounds
}
auto rname = (string)"omega_" + to_string(i); ++i;
if (omega_ids.size())
m.FormRegionFrom(rname.c_str(), omega_ids);
}
return true;
}