本文整理汇总了C++中Domain类的典型用法代码示例。如果您正苦于以下问题:C++ Domain类的具体用法?C++ Domain怎么用?C++ Domain使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Domain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showSparseMtrxStructure
void
NonLinearDynamic :: showSparseMtrxStructure(int type, oofegGraphicContext &gc, TimeStep *tStep)
{
Domain *domain = this->giveDomain(1);
CharType ctype;
if ( type != 1 ) {
return;
}
ctype = TangentStiffnessMatrix;
for ( auto &elem : domain->giveElements() ) {
elem->showSparseMtrxStructure(ctype, gc, tStep);
}
for ( auto &elem : domain->giveElements() ) {
elem->showExtendedSparseMtrxStructure(ctype, gc, tStep);
}
}
示例2: minVal
Val minVal(Image &image, Point &p, Domain& domain)
{
typename Image::Domain dom( p*2, p*2 + Point::diagonal(1));
Val v=image(p*2);
for(typename Image::Domain::ConstIterator it=dom.begin(), itend=dom.end();
it != itend;
++it)
if ( domain.isInside(*it)&& image( *it) < v) v=image(*it);
return v;
}
示例3: checkConsistency
int
StructuralEngngModel :: checkConsistency()
{
Domain *domain = this->giveDomain(1);
// check for proper element type
for ( auto &elem : domain->giveElements() ) {
StructuralElement *sePtr = dynamic_cast< StructuralElement * >( elem.get() );
StructuralInterfaceElement *siePtr = dynamic_cast< StructuralInterfaceElement * >( elem.get() );
StructuralElementEvaluator *see = dynamic_cast< StructuralElementEvaluator * >( elem.get() );
if ( sePtr == NULL && see == NULL && siePtr == NULL ) {
OOFEM_WARNING("Element %d has no structural support", elem->giveLabel());
return 0;
}
}
EngngModel :: checkConsistency();
return 1;
}
示例4: unmarshal
static void unmarshal(data_pointers const &data, Descriptor const &d, block_type &b)
{
using namespace vsip;
if (!can_unmarshal(d))
VSIP_IMPL_THROW(std::invalid_argument("Incompatible Block type"));
Domain<block_type::dim> domain;
switch (d.dimensions)
{
case 3:
domain.impl_at(2) = Domain<1>(0, d.stride2, d.size2);
case 2:
domain.impl_at(1) = Domain<1>(0, d.stride1, d.size1);
case 1:
domain.impl_at(0) = Domain<1>(0, d.stride0, d.size0);
break;
default:
VSIP_IMPL_THROW(std::invalid_argument("Invalid dimension"));
}
rebind(b, data[0], data[1], d.storage_format, domain);
}
示例5: while
void
UniformExcitation::applyLoadSensitivity(double time)
{
Domain *theDomain = this->getDomain();
if (theDomain == 0)
return;
// if (numNodes != theDomain->getNumNodes()) {
NodeIter &theNodes = theDomain->getNodes();
Node *theNode;
while ((theNode = theNodes()) != 0) {
theNode->setNumColR(1);
theNode->setR(theDof, 0, 1.0);
}
// }
this->EarthquakePattern::applyLoadSensitivity(time);
return;
}
示例6: writeDomain
void ConfigManager::writeDomain(WriteStream &stream, const String &name, const Domain &domain) {
if (domain.empty())
return; // Don't bother writing empty domains.
// WORKAROUND: Fix for bug #1972625 "ALL: On-the-fly targets are
// written to the config file": Do not save domains that came from
// the command line
if (domain.contains("id_came_from_command_line"))
return;
String comment;
// Write domain comment (if any)
comment = domain.getDomainComment();
if (!comment.empty())
stream.writeString(comment);
// Write domain start
stream.writeByte('[');
stream.writeString(name);
stream.writeByte(']');
#ifdef _WIN32
stream.writeByte('\r');
stream.writeByte('\n');
#else
stream.writeByte('\n');
#endif
// Write all key/value pairs in this domain, including comments
Domain::const_iterator x;
for (x = domain.begin(); x != domain.end(); ++x) {
if (!x->_value.empty()) {
// Write comment (if any)
if (domain.hasKVComment(x->_key)) {
comment = domain.getKVComment(x->_key);
stream.writeString(comment);
}
// Write the key/value pair
stream.writeString(x->_key);
stream.writeByte('=');
stream.writeString(x->_value);
#ifdef _WIN32
stream.writeByte('\r');
stream.writeByte('\n');
#else
stream.writeByte('\n');
#endif
}
}
#ifdef _WIN32
stream.writeByte('\r');
stream.writeByte('\n');
#else
stream.writeByte('\n');
#endif
}
示例7: estimateMaxPackSize
int
NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType)
{
int mapSize = commMap.giveSize();
int i, j, ndofs, count = 0, pcount = 0;
IntArray locationArray;
Domain *domain = this->giveDomain(1);
DofManager *dman;
Dof *jdof;
if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) {
for ( i = 1; i <= mapSize; i++ ) {
count += domain->giveDofManager( commMap.at(i) )->giveNumberOfDofs();
}
return ( buff.givePackSize(MPI_DOUBLE, 1) * count );
} else if ( packUnpackType == ProblemCommMode__NODE_CUT ) {
for ( i = 1; i <= mapSize; i++ ) {
ndofs = ( dman = domain->giveDofManager( commMap.at(i) ) )->giveNumberOfDofs();
for ( j = 1; j <= ndofs; j++ ) {
jdof = dman->giveDof(j);
if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
//printf ("\nestimated count is %d\n",count);
return ( buff.givePackSize(MPI_DOUBLE, 1) * max(count, pcount) );
} else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) {
for ( i = 1; i <= mapSize; i++ ) {
count += domain->giveElement( commMap.at(i) )->estimatePackSize(buff);
}
return count;
}
return 0;
}
示例8: while
/// correlated sampling
WOSPotential::ValueType
WOSPotential::method2(ParticleSet& P)
{
double V0 = 0;
/// intialise the particles in WP;
WP->setP(P);
Domain domain; /// create domain;
double pe = 0.0;
double dpe = 0.0;
for(int irun = 0; irun < m_runs; irun++)
{
domain.runner = WP->R0; /// initialise runner
domain.in_device = true; /// runner is inside device
device->MaximumSphere(domain); /// calc d_{0}
domain.WalkOnSphere();
double vD0 = device->OC_contrib0(domain.radius,domain.runner,WP);
double vbare = device->OC_passage(V0,domain,WP);
WP->calcwt();
double vol = 0.0;
while(domain.in_device)
{
device->MaximumSphere(domain);
vol += device->contribk(domain,WP);
domain.WalkOnSphere();
vbare += device->OC_passage(V0,domain,WP);
}
vol *= WP->qwt; /// the half has been included
double vrun = vol + vbare + vD0;
pe += vrun;
dpe += vrun * vrun;
}
pe *= m_norm;
dpe *= m_norm;
dpe = ( dpe - pe * pe )/static_cast<double>(m_runs-1);
/// CHANGE FOR DMC, WARNING Tau is zero for VMC WOS
pe += dpe * Tau; // sigma^2 * Tau
// cout << "VWOS: "<< pe << '\t' << Tau << endl;
P.Properties(WOSVAR) = -dpe;
//P.Properties(WOSVAR) = dpe;
return pe;
}
示例9: OPS_PFEMElement2D
int OPS_PFEMElement2D(Domain& theDomain, const ID& elenodes, ID& eletags)
{
int numdata = OPS_GetNumRemainingInputArgs();
if(numdata < 4) {
opserr<<"WARNING: insufficient number of arguments\n";
return 0;
}
// rho, mu, b1, b2, (thickness, kappa, lumped)
numdata = OPS_GetNumRemainingInputArgs();
if(numdata > 7) numdata = 7;
double data[7] = {0,0,0,0,1.0,-1,1};
if(OPS_GetDoubleInput(&numdata,data) < 0) return 0;
// create elements
ElementIter& theEles = theDomain.getElements();
Element* theEle = theEles();
int currTag = 0;
if (theEle != 0) {
currTag = theEle->getTag();
}
eletags.resize(elenodes.Size()/3);
for (int i=0; i<eletags.Size(); i++) {
theEle = new PFEMElement2D(--currTag,elenodes(3*i),elenodes(3*i+1),elenodes(3*i+2),
data[0],data[1],data[2],data[3],data[4],data[5],data[6]);
if (theEle == 0) {
opserr<<"WARNING: run out of memory for creating element\n";
return -1;
}
if (theDomain.addElement(theEle) == false) {
opserr<<"WARNING: failed to add element to domain\n";
delete theEle;
return -1;
}
eletags(i) = currTag;
}
return 0;
}
示例10: applyUP
Domain MCSat::applyUP(const Domain& d) {
Domain reduced;
try {
reduced = performUnitPropagation(d);
} catch (contradiction& c) {
// rewrite error message
throw contradiction("Contradiction found in MCSat::run() when running unit prop()");
}
// default model is guaranteed to satisfy the facts
Model m = reduced.defaultModel();
// check to make sure hard clauses are satisfied
std::vector<ELSentence> hardClauses;
std::remove_copy_if(reduced.formulas_begin(), reduced.formulas_end(), std::back_inserter(hardClauses), std::not1(IsHardClausePred()));
for (std::vector<ELSentence>::const_iterator it = hardClauses.begin(); it != hardClauses.end(); it++) {
if (!it->fullySatisfied(m, reduced)) {
throw contradiction("Contradiction found in MCSat::run() when verifying hard clauses are satisfied");
}
}
return reduced;
}
示例11: requiresEquationRenumbering
bool
StaticStructural :: requiresEquationRenumbering(TimeStep *tStep)
{
if ( tStep->isTheFirstStep() ) {
return true;
}
// Check if Dirichlet b.c.s has changed.
Domain *d = this->giveDomain(1);
for ( auto &gbc : d->giveBcs() ) {
ActiveBoundaryCondition *active_bc = dynamic_cast< ActiveBoundaryCondition * >(gbc.get());
BoundaryCondition *bc = dynamic_cast< BoundaryCondition * >(gbc.get());
// We only need to consider Dirichlet b.c.s
if ( bc || ( active_bc && ( active_bc->requiresActiveDofs() || active_bc->giveNumberOfInternalDofManagers() ) ) ) {
// Check of the dirichlet b.c. has changed in the last step (if so we need to renumber)
if ( gbc->isImposed(tStep) != gbc->isImposed(tStep->givePreviousStep()) ) {
return true;
}
}
}
return false;
}
示例12: dom
Domain<ndim>::ProcessOverlap::ProcessOverlap(const Domain<ndim>& dom, coords_range<ndim> range): dom(dom), range(range) {
assert(range.lower >= coords<ndim>() && range.lower < dom.n);
assert(range.upper >= coords<ndim>() && range.upper <= dom.n);
assert(range.lower <= range.upper);
dom.find(range.lower, lip, loff);
dom.find(range.upper, uip, uoff);
for(int d = 0; d < ndim; d++)
if(uoff[d] == 0) {
uip[d]--;
uoff[d] = dom.nd[d][uip[d]+1] - dom.nd[d][uip[d]];
}
}
示例13: DYSECTVERBOSE
DysectAPI::DysectErrorCode Backend::handleTimerEvents() {
if(SafeTimer::anySyncReady()) {
DYSECTVERBOSE(true, "Handle timer notifications");
vector<Probe*> readyProbes = SafeTimer::getAndClearSyncReady();
vector<Probe*>::iterator probeIter = readyProbes.begin();
for(;probeIter != readyProbes.end(); probeIter++) {
Probe* probe = *probeIter;
Domain* dom = probe->getDomain();
DYSECTVERBOSE(true, "Sending enqueued notifications for timed probe: %x", dom->getId());
probe->sendEnqueuedNotifications();
pthread_mutex_lock(&probesPendingActionMutex);
probesPendingAction.push_back(probe);
pthread_mutex_unlock(&probesPendingActionMutex);
}
}
return OK;
}
示例14: boundsToJSON
mArray boundsToJSON(void) {
const Vector &theBounds = theDomain.getPhysicalBounds();
mArray bounds;
mValue tmp;
int i;
bounds.clear();
for(i = 0; i < 6; i++) {
tmp = theBounds(i);
bounds.push_back(tmp);
}
return bounds;
}
示例15: assert
bool Location::disable() {
assert(owner != 0);
if(codeLocations.empty()) {
return true;
}
Domain* dom = owner->getDomain();
ProcessSet::ptr procset;
if(!dom->getAttached(procset)) {
return Err::warn(false, "Could not get procset from domain");
}
if(!procset) {
return Err::warn(false, "Process set not present");
}
return disable(procset);
}