当前位置: 首页>>代码示例>>C++>>正文


C++ Domain类代码示例

本文整理汇总了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);
    }
}
开发者ID:framby,项目名称:OOFEM_Johannes,代码行数:20,代码来源:nlineardynamic.C

示例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;    
} 
开发者ID:DGtal-team,项目名称:DGtalTools,代码行数:11,代码来源:volSubSample.cpp

示例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;
}
开发者ID:Benjamin-git,项目名称:OOFEM_Jim,代码行数:20,代码来源:structengngmodel.C

示例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);
  }
开发者ID:bambang,项目名称:vsipl,代码行数:20,代码来源:block_marshal.hpp

示例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;
}
开发者ID:lge88,项目名称:OpenSees,代码行数:20,代码来源:UniformExcitation.cpp

示例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
}
开发者ID:Templier,项目名称:residual,代码行数:56,代码来源:config-manager.cpp

示例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;
}
开发者ID:Benjamin-git,项目名称:OOFEM_LargeDef,代码行数:41,代码来源:nlineardynamic.C

示例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;
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:42,代码来源:WOSPotential.cpp

示例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;
}
开发者ID:fmckenna,项目名称:OpenSees,代码行数:41,代码来源:PFEMElement2D.cpp

示例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;
}
开发者ID:selmanj,项目名称:repel,代码行数:21,代码来源:MCSat.cpp

示例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;
}
开发者ID:nitramkaroh,项目名称:OOFEM,代码行数:21,代码来源:staticstructural.C

示例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]];
		}
}
开发者ID:ExaScience,项目名称:shark,代码行数:12,代码来源:domain.cpp

示例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;
}
开发者ID:SteveXiSong,项目名称:STAT,代码行数:21,代码来源:backend.cpp

示例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;
}
开发者ID:lge88,项目名称:OpenSees,代码行数:12,代码来源:jsonDomain.cpp

示例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);
}
开发者ID:wujieqian,项目名称:STAT,代码行数:21,代码来源:location_be.cpp


注:本文中的Domain类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。