Example #1
0
int GeneOntology::getDeepestDepth(GeneOntologyIdentifier handle,int depth){

	bool skipDifferentDomain=true;

	vector<GeneOntologyIdentifier> children;
	getChildren(handle,&children);

	int deepest=depth;

	for(int i=0;i<(int)children.size();i++){

		GeneOntologyIdentifier child=children[i];
		
		if(skipDifferentDomain && getDomain(child)!=getDomain(handle)){

			continue;
		}

		int newDepth=getDeepestDepth(child,depth+1);

		if(newDepth>deepest){
			deepest=newDepth;
		}
	}

	return deepest;
}
Example #2
0
void GeneOntology::computeDepths(GeneOntologyIdentifier handle,int depth){

	if(m_depths.count(depth)==1){
		return;
	}

	m_depths[handle]=depth;

	bool skipDifferentDomain=true;

	vector<GeneOntologyIdentifier> children;

	getChildren(handle,&children);

	for(int i=0;i<(int)children.size();i++){

		GeneOntologyIdentifier child=children[i];
		
		if(skipDifferentDomain && getDomain(child)!=getDomain(handle)){

			continue;
		}

		computeDepths(child,depth+1);
	}
}
Example #3
0
int GeneOntology::computeRecursiveCount(GeneOntologyIdentifier handle,set<GeneOntologyIdentifier>*visited){

	bool skipDifferentDomain=true;

	int count=0;

	// don't count any term twice
	if(visited->count(handle)>1){
		return count;
	}
	
	count+=getGeneOntologyCount(handle);

	visited->insert(handle);

	vector<GeneOntologyIdentifier> children;
	getChildren(handle,&children);

	for(int i=0;i<(int)children.size();i++){

		GeneOntologyIdentifier child=children[i];
		
		if(skipDifferentDomain && getDomain(child)!=getDomain(handle)){
			continue;
		}

		count+=computeRecursiveCount(child,visited);
	}

	return count;
}
    BfBootCli::TaskMngProfile& NObjCommonBfTaskProfile::getMngProf()
    {
        if(!m_prof)
        {
            m_prof.reset(
                new BfBootCli::TaskMngProfile(getDomain(), *this, m_traceClient, 
				getDomain().LogCreator()));
        }
        return *m_prof;
    }
Example #5
0
    void Point::addForceContribution(const Point * & p, Vector<2> & force,
                                     Vector<2> & v2, Vector<3> & stress) {
        double thetaz = getDomain()->getModulus();
        double factor = getDomain()->getPassionsRatio();

        double cutOff = 2 * std::abs(this->getBurgersMagnitude());
        Complex b(this->getBurgersVector());
        Complex z(this->getLocation());

        double sig11 = 0;
        double sig22 = 0;
        double sig12 = 0;
        double sig11z = 0;
        double sig22z = 0;
        double sig12z = 0;


        Complex zSource(p->getLocation());
        Complex dz = z - zSource;
        double zd = dz.abs();


        if(zd > cutOff) {
            Complex phi1 = -1. * Complex::i * factor * b / dz;
            Complex phi11 = Complex::i * factor * b / (dz * dz);
            Complex phi2 = Complex::i * factor * b.conjugate() / dz;

            Complex tmp1 = 2. * Complex(phi1 * phi1.conjugate());
            Complex tmp2 = -2. * Complex(dz * phi11.conjugate() * phi2.conjugate());

            sig11 += Complex(0.5 * (tmp1 + tmp2)).real();
            sig22 += Complex(0.5 * (tmp1 - tmp2)).real();
            sig12 += Complex(.5 * tmp2).imag();

            Complex phi1z = Complex::i * factor * b / (dz * dz) * thetaz;
            Complex phi11z = -2. * Complex::i * factor * b / (dz * dz * dz) * thetaz;
            Complex phi2z = -1. * factor * b.conjugate() / (dz * dz) * thetaz;
            Complex tmp1z = 2. * (phi1z + phi1z.conjugate());
            Complex tmp2z = -2. * (dz * phi11z.conjugate() + phi2z.conjugate());

            sig11z += Complex(.5 * (tmp1z + tmp2z)).real();
            sig22z += Complex(.5 * (tmp1z - tmp2z)).real();
            sig12z += Complex(.5 * tmp2z).imag();
        }

        double cos2i = ::cos(2. * this->getSlipPlane()->getAngle());
        double sin2i = ::sin(2. * this->getSlipPlane()->getAngle());

        double bi = std::abs(getSlipPlane()->getBurgersMagnitude()) * getBurgersSign() *
                    ((sig22 - sig11) * .5 * sin2i + sig12 * cos2i);

        force += Vector<2>({bi, 0});
    }
 MinimalTIFFReader::MinimalTIFFReader():
   ::ome::bioformats::detail::FormatReader(props),
   tiff(),
   seriesIFDRange()
 {
   domains.push_back(getDomain(GRAPHICS_DOMAIN));
 }
Example #7
0
bool HttpListening::findServlet(
		const HttpRequest& request,
		std::pair<mxcore::SharedPtr<HttpVirtualServer>, mxcore::SharedPtr<
				HttpServlet> >& result) const
{
	std::string host =
			request.getHeaders().getValue(HttpConstants::HEADER_HOST);

	std::string domain = getDomain(host);

	mxcore::SharedPtr<HttpVirtualServer> vs = findVirtualServer(domain);

	if (vs.isNull())
	{
		vs = getFirstVirtualServer();
	}

	if (vs.isNull())
	{
		return false;
	}

	mxcore::SharedPtr<HttpServlet> servlet = vs->findServlet(request);

	if (servlet.isNull())
	{
		return false;
	}

	result.first = vs;
	result.second = servlet;
	return true;
}
Example #8
0
STDMETHODIMP GuestSessionWrap::COMGETTER(Domain)(BSTR *aDomain)
{
    LogRelFlow(("{%p} %s: enter aDomain=%p\n", this, "GuestSession::getDomain", aDomain));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        CheckComArgOutPointerValidThrow(aDomain);

        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = getDomain(BSTROutConverter(aDomain).str());
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave *aDomain=%ls hrc=%Rhrc\n", this, "GuestSession::getDomain", *aDomain, hrc));
    return hrc;
}
const String & ConfigManager::get(const String &key, const String &domName) const {
	// FIXME: For now we continue to allow empty domName to indicate
	// "use 'default' domain". This is mainly needed for the SCUMM ConfigDialog
	// and should be removed ASAP.
	if (domName.empty())
		return get(key);

	const Domain *domain = getDomain(domName);

	if (!domain)
		error("ConfigManager::get(%s,%s) called on non-existent domain",
								key.c_str(), domName.c_str());

	if (domain->contains(key))
		return (*domain)[key];

	return _defaultsDomain.get(key);

	if (!domain->contains(key)) {
#if 1
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__) || defined(IPOD))
	return String::emptyString;
#else
	return ConfMan._emptyString;
#endif
#else
		error("ConfigManager::get(%s,%s) called on non-existent key",
					key.c_str(), domName.c_str());
#endif
	}

	return (*domain)[key];
}
Example #10
0
escript::Data
FunctionSpace::getSize() const
{
  Data out=escript::Scalar(0,*this,true);
  getDomain()->setToSize(out);
  out.setProtection();
  return out;
}
Example #11
0
escript::Data
FunctionSpace::getNormal() const
{
  Data out=escript::Vector(0,*this,true);
  getDomain()->setToNormal(out);
  out.setProtection();
  return out;
}
Example #12
0
std::size_t InterfaceAddress::hashCode() const
{
    std::size_t seed = 0;

    boost::hash_combine(seed, getDomain());
    boost::hash_combine(seed, getInterface());

    return seed;
}
Example #13
0
LocalConnection_as::LocalConnection_as(as_object* o)
    :
    ActiveRelay(o),
    _domain(getDomain(owner())),
    _connected(false),
    _shm(defaultSize),
    _lastTime(0)
{
}
void ConfigManager::removeKey(const String &key, const String &domName) {
	Domain *domain = getDomain(domName);

	if (!domain)
		error("ConfigManager::removeKey(%s, %s) called on non-existent domain",
					key.c_str(), domName.c_str());

	domain->erase(key);
}
Example #15
0
bool ColumnBase::isNullable(GetColumnNullabilityType type) const
{
    if (!nullableM)
        return false;
    if (type == CheckDomainNullability)
    {
        if (DomainPtr d = getDomain())
            return d->isNullable();
    }
    return true;
}
Example #16
0
/*!
 * Is this domain crossing possible between mainPort and all connected subPorts?
 */
static bool isDomainCrossingAcceptable(
    const Port &mainPort,
    const std::vector<Port> &subPorts,
    const bool isInput
)
{
    auto mainDomain = getDomain(mainPort, isInput);

    bool allOthersAbdicate = true;
    std::set<std::string> subDomains;
    for (const auto &subPort : subPorts)
    {
        subDomains.insert(getDomain(subPort, not isInput));
        const auto subMode = getBufferMode(subPort, mainDomain, not isInput);
        if (subMode != "ABDICATE") allOthersAbdicate = false;
    }

    //cant handle multiple domains
    if (subDomains.size() > 1) return false;

    assert(subDomains.size() == 1);
    const auto subDomain = *subDomains.begin();
    const auto mainMode = getBufferMode(mainPort, subDomain, isInput);

    //error always means we make a copy block
    if (mainMode == "ERROR") return false;

    //always good when we abdicate
    if (mainMode == "ABDICATE") return true;

    //otherwise the mode should be custom
    assert(mainMode == "CUSTOM");

    //cant handle custom with multiple upstream
    if (isInput and mainMode == "CUSTOM" and subPorts.size() > 1) return false;

    //if custom, the sub ports must abdicate
    if (mainMode == "CUSTOM" and not allOthersAbdicate) return false;

    return true;
}
Example #17
0
void Agent::onConnect(std::shared_ptr<Channel> channel) {
    channel_ = std::move(channel);

    channel_->registerDomain(getDomain(), [this](std::string, int callId, const std::string& method, folly::dynamic args) {
        auto result = handle(method, std::move(args));
        if (result.isNull()) {
            result = folly::dynamic::object;
        }
        auto message = folly::dynamic::object("id", callId)("result", std::move(result));
        channel_->sendMessage(folly::toJson(std::move(message)));
    });
}
bool ConfigManager::hasKey(const String &key, const String &domName) const {
	// FIXME: For now we continue to allow empty domName to indicate
	// "use 'default' domain". This is mainly needed for the SCUMM ConfigDialog
	// and should be removed ASAP.
	if (domName.empty())
		return hasKey(key);

	const Domain *domain = getDomain(domName);

	if (!domain)
		return false;
	return domain->contains(key);
}
Example #19
0
ConfigDomain *ConfigFile::addDomain(const UString &name) {
	ConfigDomain *domain = getDomain(name);
	if (domain)
		// A domain with this name already exists, return that one then
		return domain;

	// Create a new domain
	domain = new ConfigDomain(name);

	_domainList.push_back(domain);
	_domainMap.insert(std::make_pair(name, domain));

	return domain;
}
Example #20
0
bool ColumnBase::getDefault(GetColumnDefaultType type, wxString& value) const
{
    if (hasDefaultM)
    {
        value = defaultM;
        return true;
    }
    if (type == ReturnDomainDefault)
    {
        if (DomainPtr d = getDomain())
        {
            if (d->getDefault(value))
                return true;
        }
    }
    value = wxEmptyString;
    return false;
}
Example #21
0
const String &ConfigManager::get(const String &key, const String &domName) const {
	// FIXME: For now we continue to allow empty domName to indicate
	// "use 'default' domain". This is mainly needed for the SCUMM ConfigDialog
	// and should be removed ASAP.
	if (domName.empty())
		return get(key);

	const Domain *domain = getDomain(domName);

	if (!domain)
		error("ConfigManager::get(%s,%s) called on non-existent domain",
		      key.c_str(), domName.c_str());

	if (domain->contains(key))
		return (*domain)[key];

	return _defaultsDomain.getVal(key);
}
void ConfigManager::set(const String &key, const String &value, const String &domName) {
	// FIXME: For now we continue to allow empty domName to indicate
	// "use 'default' domain". This is mainly needed for the SCUMM ConfigDialog
	// and should be removed ASAP.
	if (domName.empty()) {
		set(key, value);
		return;
	}

	Domain *domain = getDomain(domName);

	if (!domain)
		error("ConfigManager::set(%s,%s,%s) called on non-existent domain",
					key.c_str(), value.c_str(), domName.c_str());

	(*domain)[key] = value;
	
	// TODO/FIXME: We used to erase the given key from the transient domain
	// here. Do we still want to do that?
	// It was probably there to simplify the options dialogs code:
	// Imagine you are editing the current options (via the SCUMM ConfigDialog,
	// for example). If you edit the game domain for that, but a matching
	// entry in the transient domain is present, than your changes may not take
	// effect. So you want to remove the key from the transient domain before
	// adding it to the active domain.
	// But doing this here seems rather evil... need to comb the options dialog
	// code to find out if it's still necessary, and if that's the case, how
	// to replace it in a clean fashion...
/*
	if (domName == kTransientDomain)
		_transientDomain[key] = value;
	else {
		if (domName == kApplicationDomain) {
			_appDomain[key] = value;
			if (_activeDomainName.empty() || !_gameDomains[_activeDomainName].contains(key))
				_transientDomain.erase(key);
		} else {
			_gameDomains[domName][key] = value;
			if (domName == _activeDomainName)
				_transientDomain.erase(key);
		}
	}
*/
}
Example #23
0
//! @brief Returns a pointer to the loaded node.
const XC::Node *XC::NodalLoad::get_node_ptr(void) const
  {
    const Node *retval= nullptr;
    Domain *theDomain= getDomain();
    if(!theDomain)
      std::cerr << getClassName() << "::" << __FUNCTION__
		<< "; domain not set.";
    else
      {
        retval= theDomain->getNode(loadedNode);
        if(!retval)
          {
            std::cerr << getClassName() << "::" << __FUNCTION__
	              << "; node identified by: "
                      << loadedNode << " not found." << std::endl;
          }
      }
    return retval;
  }
Example #24
0
//! retrieve datatype from domain if possible
wxString ColumnBase::getDatatype(bool useConfig)
{
    enum
    {
        showType = 0,
        showFormula,
        showAll
    };
    int flag = (useConfig ? showFormula : showType);
    if (useConfig)
        config().getValue("ShowComputed", flag);
    // view columns are all computed and have their source empty
    if (flag == showFormula && !getComputedSource().empty())
        return getComputedSource();

    wxString ret;
    DomainPtr d = getDomain();
    wxString datatype(d ? d->getDatatypeAsString() : sourceM);

    enum
    {
        showDatatype = 0,
        showDomain,
        showBoth
    };
    int show = (useConfig ? showBoth : showDatatype);
    if (useConfig)
        config().getValue("ShowDomains", show);

    if (!d || d->isSystem() || show == showBoth || show == showDatatype)
        ret += datatype;

    if (d && !d->isSystem() && (show == showBoth || show == showDomain))
    {
        if (!ret.empty())
            ret += " ";
        ret += "(" + d->getName_() + ")";
    }

    if (flag == showAll && !getComputedSource().empty())
        ret += " (" + getComputedSource() + ")";
    return ret;
}
Example #25
0
/**
    以下这段程序封装了 Socket的 6种操作

**/
bool Socket::socket()
{
    if ( mSd >= 0 )
        return( true );

	if ( (mSd = ::socket( getDomain(), getType(), 0 ) ) < 0 )
	{
		Error( "socket(), errno = %d, error = %s", errno, strerror(errno) );
		return( false );
	}

	int val = 1;

	(void)::setsockopt( mSd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val) );
	(void)::setsockopt( mSd, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val) );

    mState = DISCONNECTED;

	return( true );
}
Example #26
0
void testScaled( const std::string & filename, const Vector3<uint_t> & size, const std::string & datatype, const bool vtkOut )
{
   WALBERLA_LOG_INFO( "Testing scaled" );
   BinaryRawFile brf( filename, size, datatype );

   Vector3<uint_t> scaledSize( std::max( uint_t( 1 ), size[0] / uint_t( 2 ) ),
                               std::max( uint_t( 1 ), size[1] / uint_t( 3 ) ),
                               std::max( uint_t( 1 ), size[2] / uint_t( 5 ) ) );

   auto blocks = blockforest::createUniformBlockGrid( uint_t( 1 ), uint_t( 1 ), uint_t( 1 ),
      scaledSize[0], scaledSize[1], scaledSize[2],
      real_t( 1 ),
      uint_t( 1 ), uint_t( 1 ), uint_t( 1 ) );

   BinaryRawFileInterpolator brfi( blocks->getDomain(), brf, BinaryRawFileInterpolator::NEAREST_NEIGHBOR );

   typedef GhostLayerField< uint8_t, uint_t( 1 ) > ScalarField;

   BlockDataID scalarFieldID = field::addToStorage<ScalarField>( blocks, "BinaryRawFile" );

   for (auto & block : *blocks)
   {
      auto field = block.getData<ScalarField>( scalarFieldID );

      CellInterval ci( 0, 0, 0, cell_idx_c( scaledSize[0] ) - 1, cell_idx_c( scaledSize[1] ) - 1, cell_idx_c( scaledSize[2] ) - 1 );

      for (const Cell & c : ci)
      {
         auto pos = blocks->getBlockLocalCellCenter( block, c );
         field->get( c ) = brfi.get( pos );
      }
   }

   if (vtkOut)
   {
      WALBERLA_LOG_INFO( "Writing scaled" );
      auto vtkOutput = vtk::createVTKOutput_BlockData( blocks, "BinaryRawFileScaled" );
      vtkOutput->addCellDataWriter( make_shared< field::VTKWriter< ScalarField, uint8_t > >( scalarFieldID, "BinaryRawFile" ) );
      writeFiles( vtkOutput, true )();
   }
}
Example #27
0
 virtual void render(std::ostream& out) const
 {
     if(!del) {
         cgicc::HTTPCookie::render(out);
     }
     else {
         out <<"Set-Cookie:"<<getName()<<"=";
         string domain=getDomain();
         if(!domain.empty()) {
             out<<"; Domain="<<domain;
         }
         string path=getPath();
         if(!path.empty()) {
             out<<"; Path="<<path;
         }
         if(isSecure()) {
             cout<<"; Secure";
         }
         out<<"; Expires=Fri, 01-Jan-1971 01:00:00 GMT; Version=1";
     }
 }
size_t TestParticleSetting1::fillGrid(std::vector<bool>& level_set) {

  size_t xgridsize, ygridsize, zgridsize;
  double xleft, yleft, zleft, xright, yright, zright;
  double dx, dy, dz;

  getGridSize(xgridsize, ygridsize, zgridsize);
  getDomain(xleft, yleft, zleft, xright, yright, zright);

  dx = (xright-xleft)/xgridsize;
  dy = (yright-yleft)/ygridsize;
  dz = (zright-zleft)/zgridsize;

  level_set.clear();

  size_t size = (xgridsize+1)*(ygridsize+1)*(zgridsize+1);

  level_set.resize(size);

  //Now fill up the grid.
  size_t index;
  for (size_t k = 0; k < zgridsize; ++k) {
    for (size_t j = 0; j < ygridsize; ++j) {
	    for (size_t i = 0; i < xgridsize; ++i) {
        index = i + j*xgridsize + k*xgridsize*ygridsize;
        //A diamond shaped region.
        //double temp = fabs( xleft + i*dx - 0.128) + fabs( yleft + j*dy - 0.128) + fabs( zleft + k*dz - 0.128);
        if ( fabs( xleft + i*dx - 0.128) + fabs( yleft + j*dy - 0.128) + fabs( zleft + k*dz - 0.576) <= 0.128 ) {
	     	  level_set[index] = true;
	     	} else {
	     	  level_set[index] = false;
	     	}     
         
	    }
	  }
  }

  return size;
}
    void NObjCommonBfTaskProfile::RunTask( DRI::IAsyncCmd *pAsyncCmd, ITask& task, const Domain::ObjectName& taskName, NObjBroadcastReceiver* postValidator)
    {        
        if (pAsyncCmd)
        {
            AsyncBegin(pAsyncCmd, boost::bind(&NObjCommonBfTaskProfile::AbortAsync, this));       
        }
        else
        {
            // это не первая задача
            ESS_ASSERT(AsyncActive());
        }

        m_postValidator = postValidator;       

        m_taskLog.reset(getDomain().LogCreator()->CreateSession(taskName.Name().toStdString(), m_traceClient));
        *m_taskLog << "RunTask" << iLogW::EndRecord;

        QString msg;
        msg += "Task ";
        msg += taskName.Name();
        msg += " started...";

        Log(msg);

        try
        {
            bool runAsLastTask;
            task.Run(runAsLastTask);
            if (!runAsLastTask) m_pNetTask = &task;
            else m_pNetTask = 0;
        }
        catch(const ESS::BaseException& e)
        {
            AsyncComplete(false, e.getTextMessage().c_str());
        }
    }
Example #30
0
void TransFunc::setUniform(tgt::Shader* shader, const std::string& uniform, const GLint texUnit) {
    tgtAssert(shader, "Null pointer passed");
    bool oldIgnoreError = shader->getIgnoreUniformLocationError();
    shader->setIgnoreUniformLocationError(true);
    shader->setUniform(uniform + ".texture_", texUnit);

    if(getNumDimensions() == 1) {
        shader->setUniform(uniform + ".domainLower_", getDomain(0).x);
        shader->setUniform(uniform + ".domainUpper_", getDomain(0).y);
    }
    else if(getNumDimensions() == 2) {
        shader->setUniform(uniform + ".domainLower_", tgt::vec2(getDomain(0).x, getDomain(1).x));
        shader->setUniform(uniform + ".domainUpper_", tgt::vec2(getDomain(0).y, getDomain(1).y));
    }
    else {
        LERROR("Unhandled dimensionality in glsl TransFunc object");
    }

    shader->setIgnoreUniformLocationError(oldIgnoreError);
}