void DataSet::reset( void ) { setDomain( false, false ); setDomain( 0.0f, 0.0f ); setRange( false, false ); setRange( 0.0f, 0.0f ); };
void PotentialFieldSolver::computeFarFieldBuffer() { m_p_massPos->copy(m_p_massPos->DEVICE_TO_HOST); setDomain(m_origin,m_p_massPos->getHostPtr(),m_N_mass,m_L); printf("%lf,%lf,%lf,%lf\n",m_L,m_origin.x,m_origin.y,m_origin.z); m_ParticleToMesh(); m_SolvePoisson(); m_ComputeGradient(); PotentialComputeFarField(m_SpatialHasher_mass.getStartTable(), m_SpatialHasher_mass.getEndTable(), m_p_massPos->getDevicePtr(), m_particle_mass_Reorder->getDevicePtr(), m_grid_density->getDevicePtr(), m_grid_phi->getDevicePtr(), m_grid_gradPhi->getDevicePtr(), m_far_gradPhi->getDevicePtr(), m_SpatialHasher_mass.getCellSize().x, 1.0,1.0, make_uint3(m_gridx,m_gridy,m_gridz), make_uint3(m_gridx,m_gridy,m_gridz), m_K, m_M_eval, m_origin); }
void SearchManager::startSearch(KURL const& root, SearchMode const& modo) { canceled_ = false; //time_.restart(); time_.start(); Q_ASSERT(root.isValid()); //Q_ASSERT(root.protocol() == "http" || root.protocol() == "https"); if(root.hasHost() && (domain_.isNull() || domain_.isEmpty())) { setDomain(root.host() + root.directory()); kdDebug(23100) << "Domain: " << domain_ << endl; } root_.setIsRoot(true); root_.setDepth(0); root_.setOriginalUrl(root.prettyURL()); root_.setAbsoluteUrl(root); root_.setOnlyCheckHeader(false); root_.setRootUrl(root); search_mode_ = modo; if(modo == depth) Q_ASSERT(depth_ != -1); else if(modo == domain) Q_ASSERT(depth_ == -1); else Q_ASSERT(depth_ != -1); searching_ = true; //Q_ASSERT(domain_ != QString::null); checkRoot(); }
//---------------------------------------------------------------------- Octree::Octree(ParametricPatch* patch_, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) : patch(*patch_) { root = new Node(); root->setPatch(&patch); // Set, manually for now, the limits of the domain setDomain(xmin, xmax, ymin, ymax, zmin, zmax); }
/// Constructor. /// @param fun :: A function to plot. /// @param startX :: A lower bound of the evaluation interval. /// @param endX :: An upper bound of the evaluation interval. /// @param nX :: A number of values to evaluate. MDFFunctionPlotData::MDFFunctionPlotData( boost::shared_ptr<Mantid::API::IFunction> fun, double startX, double endX, size_t nX) : m_function(fun), m_functionCurve(new QwtPlotCurve()) { setDomain(startX, endX, nX); auto pen = m_functionCurve->pen(); pen.setColor(FUNCTION_CURVE_COLOR); m_functionCurve->setPen(pen); }
auto add_float_child(std::shared_ptr<OSSIA::Node>& node, const std::string& name, Fun&& callback) { auto new_node = *node->emplace(node->children().cend(), name); auto addr = new_node->createAddress(OSSIA::Value::Type::FLOAT); addr->addCallback(callback); addr->setDomain(OSSIA::Domain::create(new OSSIA::Float(-100.), new OSSIA::Float(100.))); return new_node; }
void PotentialFieldSolver::computeFarFieldPotentialBuffer() { m_p_massPos->copy(m_p_massPos->DEVICE_TO_HOST); setDomain(m_origin,m_p_massPos->getHostPtr(),m_N_mass,m_L); m_ParticleToMesh(); m_SolvePoisson(); PotentialComputeScalarFarField(m_particle_mass->getDeviceWritePtr(),m_grid_density->getDeviceWritePtr(),m_grid_phi->getDeviceWritePtr(),m_SpatialHasher_mass.getCellSize().x, 1.0,1.0, make_uint3(m_gridx,m_gridy,m_gridz), make_uint3(m_gridx,m_gridy,m_gridz), m_K); }
HTTPCookie::HTTPCookie(const NameValueCollection& nvc): _version(0), _secure(false), _maxAge(-1), _httpOnly(false) { for (NameValueCollection::ConstIterator it = nvc.begin(); it != nvc.end(); ++it) { const std::string& name = it->first; const std::string& value = it->second; if (icompare(name, "comment") == 0) { setComment(value); } else if (icompare(name, "domain") == 0) { setDomain(value); } else if (icompare(name, "path") == 0) { setPath(value); } else if (icompare(name, "max-age") == 0) { setMaxAge(NumberParser::parse(value)); } else if (icompare(name, "secure") == 0) { setSecure(true); } else if (icompare(name, "expires") == 0) { int tzd; DateTime exp = DateTimeParser::parse(value, tzd); Timestamp now; setMaxAge((int) ((exp.timestamp() - now) / Timestamp::resolution())); } else if (icompare(name, "version") == 0) { setVersion(NumberParser::parse(value)); } else if (icompare(name, "HttpOnly") == 0) { setHttpOnly(true); } else { setName(name); setValue(value); } } }
exception_t decodeDomainInvocation(word_t label, unsigned int length, extra_caps_t extraCaps, word_t *buffer) { word_t domain; cap_t tcap; if (unlikely(label != DomainSetSet)) { current_syscall_error.type = seL4_IllegalOperation; return EXCEPTION_SYSCALL_ERROR; } if (unlikely(length == 0)) { userError("Domain Configure: Truncated message."); current_syscall_error.type = seL4_TruncatedMessage; return EXCEPTION_SYSCALL_ERROR; } else { domain = getSyscallArg(0, buffer); if (domain >= CONFIG_NUM_DOMAINS) { userError("Domain Configure: invalid domain (%u >= %u).", domain, CONFIG_NUM_DOMAINS); current_syscall_error.type = seL4_InvalidArgument; current_syscall_error.invalidArgumentNumber = 0; return EXCEPTION_SYSCALL_ERROR; } } if (unlikely(extraCaps.excaprefs[0] == NULL)) { userError("Domain Configure: Truncated message."); current_syscall_error.type = seL4_TruncatedMessage; return EXCEPTION_SYSCALL_ERROR; } tcap = extraCaps.excaprefs[0]->cap; if (unlikely(cap_get_capType(tcap) != cap_thread_cap)) { userError("Domain Configure: thread cap required."); current_syscall_error.type = seL4_InvalidArgument; current_syscall_error.invalidArgumentNumber = 1; return EXCEPTION_SYSCALL_ERROR; } setThreadState(ksCurThread, ThreadState_Restart); setDomain(TCB_PTR(cap_thread_cap_get_capTCBPtr(tcap)), domain); return EXCEPTION_NONE; }
HTTPCookie::HTTPCookie(const NameValueCollection& nvc): _version(0), _secure(false), _maxAge(-1), _httpOnly(false) { for (NameValueCollection::ConstIterator it = nvc.begin(); it != nvc.end(); ++it) { const std::string& name = it->first; const std::string& value = it->second; if (icompare(name, "comment") == 0) { setComment(value); } else if (icompare(name, "domain") == 0) { setDomain(value); } else if (icompare(name, "path") == 0) { setPath(value); } else if (icompare(name, "priority") == 0) { setPriority(value); } else if (icompare(name, "max-age") == 0) { throw NotImplementedException("HTTPCookie::HTTPCookie max-age"); } else if (icompare(name, "secure") == 0) { setSecure(true); } else if (icompare(name, "expires") == 0) { throw NotImplementedException("HTTPCookie::HTTPCookie expires"); } else if (icompare(name, "version") == 0) { throw NotImplementedException("HTTPCookie::HTTPCookie version"); } else if (icompare(name, "HttpOnly") == 0) { setHttpOnly(true); } else { setName(name); setValue(value); } } }
void BiotSavartSolver::sortVort() { m_p_vortPos->copy(gf_GpuArray<float4>::DEVICE_TO_HOST); setDomain(m_origin, m_p_vortPos->getHostPtr(),m_N_vort,m_L); m_SpatialHasher_vort.setSpatialHashGrid(m_gridx, m_L/(double)m_gridx, make_float3(m_origin.x,m_origin.y,m_origin.z), m_N_vort); m_SpatialHasher_vort.setHashParam(); m_SpatialHasher_vort.doSpatialHash(m_p_vortPos->getDevicePtr(),m_N_vort); m_p_vortPos_Reorder->memset(make_float4(0,0,0,0)); m_SpatialHasher_vort.reorderData(m_N_vort,(void*)(m_p_vortPos->getDevicePtr()),(void*)(m_p_vortPos_Reorder->getDevicePtr()),4,1); for(int i=0;i<NUM_COMPONENTS;i++) { m_particle_vort_Reorder[i]->memset(0); m_SpatialHasher_vort.reorderData(m_N_vort, (void*)(m_particle_vort[i]->getDevicePtr()), (void*)(m_particle_vort_Reorder[i]->getDevicePtr()), 1, 2); } }
// value 格式:xxx=xxx; domain=xxx; expires=xxx; path=xxx bool HttpCookie::setCookie(const char* value) { if (value == NULL || *value == 0) return false; ACL_ARGV* tokens = acl_argv_split(value, ";"); acl_assert(tokens->argc > 0); HTTP_PARAM param; // 从第一个 name=value 字段中取得 cookie 名及 cookie 值 if (splitNameValue(tokens->argv[0], ¶m) == false) { acl_argv_free(tokens); return false; } // name 肯定非 "\0",而 value 可以为 "\0" name_ = dbuf_->dbuf_strdup(param.name); value_ = dbuf_->dbuf_strdup(param.value); for (int i = 1; i < tokens->argc; i++) { if (splitNameValue(tokens->argv[i], ¶m) == false) continue; if (*(param.value) == 0) continue; if (strcasecmp(param.name, "domain") == 0) setDomain(param.value); else if (strcasecmp(param.name, "expires") == 0) setExpires(param.value); else if (strcasecmp(param.name, "path") == 0) setPath(param.value); else add(param.name, param.value); } acl_argv_free(tokens); return true; }
void Ssu::requestFinished(QNetworkReply *reply){ QSslConfiguration sslConfiguration = reply->sslConfiguration(); SsuLog *ssuLog = SsuLog::instance(); SsuCoreConfig *settings = SsuCoreConfig::instance(); QNetworkRequest request = reply->request(); QVariant originalDomainVariant = request.attribute(SSU_NETWORK_REQUEST_DOMAIN_DATA); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) ssuLog->print(LOG_DEBUG, QString("Certificate used was issued for '%1' by '%2'. Complete chain:") .arg(sslConfiguration.peerCertificate().subjectInfo(QSslCertificate::CommonName).join("")) .arg(sslConfiguration.peerCertificate().issuerInfo(QSslCertificate::CommonName).join(""))); foreach (const QSslCertificate cert, sslConfiguration.peerCertificateChain()){ ssuLog->print(LOG_DEBUG, QString("-> %1").arg(cert.subjectInfo(QSslCertificate::CommonName).join(""))); } #else ssuLog->print(LOG_DEBUG, QString("Certificate used was issued for '%1' by '%2'. Complete chain:") .arg(sslConfiguration.peerCertificate().subjectInfo(QSslCertificate::CommonName)) .arg(sslConfiguration.peerCertificate().issuerInfo(QSslCertificate::CommonName))); foreach (const QSslCertificate cert, sslConfiguration.peerCertificateChain()){ ssuLog->print(LOG_DEBUG, QString("-> %1").arg(cert.subjectInfo(QSslCertificate::CommonName))); } #endif pendingRequests--; QString action; QByteArray data; QDomDocument doc; QString xmlError; /// @TODO: indicate that the device is not registered if there's a 404 on credentials update url if (settings->contains("home-url")){ QString homeUrl = settings->value("home-url").toString().arg(""); homeUrl.remove(QRegExp("//+$")); if (request.url().toString().startsWith(homeUrl, Qt::CaseInsensitive)){ // we don't care about errors on download request if (reply->error() == 0) { QByteArray data = reply->readAll(); storeAuthorizedKeys(data); } goto success; } } if (reply->error() > 0){ setError(reply->errorString()); goto failure; } data = reply->readAll(); ssuLog->print(LOG_DEBUG, QString("RequestOutput %1") .arg(data.data())); if (!doc.setContent(data, &xmlError)){ setError(tr("Unable to parse server response (%1)").arg(xmlError)); goto failure; } action = doc.elementsByTagName("action").at(0).toElement().text(); if (!verifyResponse(&doc)) { goto failure; } ssuLog->print(LOG_DEBUG, QString("Handling request of type %1") .arg(action)); if (action == "register") { if (registerDevice(&doc)) { goto success; } } else if (action == "credentials") { if (setCredentials(&doc)) { goto success; } } else { setError(tr("Response to unknown action encountered: %1").arg(action)); } failure: // Restore the original domain in case of failures with the registration if (!originalDomainVariant.isNull()) { QString originalDomain = originalDomainVariant.toString(); ssuLog->print(LOG_DEBUG, QString("Restoring domain on error: '%1'").arg(originalDomain)); setDomain(originalDomain); } // Fall through to cleanup handling in success from failure label success: ssuLog->print(LOG_DEBUG, QString("Request finished, pending requests: %1").arg(pendingRequests)); if (pendingRequests == 0) { emit done(); } }
//! @brief Constructor. //! @param theDomain: domain where the constraint is defined. //! @param tag: tag for the multi-freedom constraint. //! @param nodeRetain: identifier of the retained node. //! @param nodeConstr: identifier of the constrained node. //! @param LrgDsp: true if large displacement (geometric non-linearity) must be expected: 0 for constant constraint matrix(small deformations), 1 for time varying constraint matrix(large deformations), 2 for large deformations with length correction. XC::MFreedom_Joint3D::MFreedom_Joint3D(Domain *theDomain, int tag, int nodeRetain, int nodeConstr, int nodeRot, int Rotdof, int nodeDisp, int Dispdof, int LrgDsp) :MFreedom_Joint(theDomain,tag,CNSTRNT_TAG_MFreedom_Joint3D,nodeRetain,nodeConstr,LrgDsp), nodeRotation(nodeRot), RotDOF(Rotdof), nodeDisplacement(nodeDisp), DispDOF(Dispdof), RotationNode(nullptr), DisplacementNode(nullptr), RotNormVect(3), DspNormVect(3), dbTag3(0) { setDomain(theDomain); // check for proper degrees of freedom int RnumDOF = RetainedNode->getNumberDOF(); int CnumDOF = ConstrainedNode->getNumberDOF(); if(RnumDOF != 9 || CnumDOF != 6 ) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; mismatch in numDOF\n DOF not supported by this type of constraint"; return; } // check the main degree of freedom. Assign auxilary DOF if( RotDOF<6 || RotDOF>8 || DispDOF<6 || DispDOF>8 || RotDOF==DispDOF ) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; Wrong degrees of freedom" ; return; } // check for proper dimensions of coordinate space const Vector &crdRet = RetainedNode->getCrds(); const int dimRet = crdRet.Size(); const Vector &crdCon = ConstrainedNode->getCrds(); const int dimCon = crdCon.Size(); const Vector &crdRot = RotationNode->getCrds(); const int dimRot = crdRot.Size(); const Vector &crdDsp = DisplacementNode->getCrds(); const int dimDsp = crdDsp.Size(); if(dimRet != 3 || dimCon != 3 || dimRot != 3 || dimDsp != 3 ) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; mismatch in dimnesion\n dimension not supported by this type of constraint"; return; } // calculate the initial length of the rigid link const double deltaX = crdCon(0) - crdRet(0); const double deltaY = crdCon(1) - crdRet(1); const double deltaZ = crdCon(2) - crdRet(2); Length0= sqrt( deltaX*deltaX + deltaY*deltaY + deltaY*deltaY ); if(Length0 <= 1.0e-12) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; the constraint length is zero\n"; } // calculate the normal vectors for the rotation mode and displacement mode for(int i = 0 ; i<3 ; i++ ) { RotNormVect(i)= crdRot(i) - crdRet(i); DspNormVect(i)= crdDsp(i) - crdRet(i); } if(RotNormVect.Norm() <= 1.0e-12 || DspNormVect.Norm() <= 1.0e-12 ) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; the normal vector for the rotation mode or the displacement mode is zero\n"; } RotNormVect= RotNormVect / RotNormVect.Norm(); DspNormVect= DspNormVect / DspNormVect.Norm(); // allocate and set up the constranted and retained id's // the end is released constrDOF= ID(6); retainDOF= ID(8); for(int j = 0 ; j<6 ; j++ ) { constrDOF(j) = j; retainDOF(j) = j; } retainDOF(6) = RotDOF; retainDOF(7) = DispDOF; // allocate and set up the constraint matrix constraintMatrix= Matrix(constrDOF.Size(),retainDOF.Size()); constraintMatrix (0,0) = 1.0 ; constraintMatrix (1,1) = 1.0 ; constraintMatrix (2,2) = 1.0 ; constraintMatrix (1,3) = -deltaZ; constraintMatrix (2,3) = deltaY; constraintMatrix (3,3) = 1.0 ; constraintMatrix (0,4) = deltaZ; constraintMatrix (2,4) = -deltaX; constraintMatrix (4,4) = 1.0 ; constraintMatrix (0,5) = -deltaY; constraintMatrix (1,5) = deltaX; constraintMatrix (5,5) = 1.0 ; constraintMatrix (3,6) = RotNormVect(0); constraintMatrix (4,6) = RotNormVect(1); constraintMatrix (5,6) = RotNormVect(2); constraintMatrix (0,7) = deltaZ*DspNormVect(1) - deltaY*DspNormVect(2); constraintMatrix (1,7) = deltaX*DspNormVect(2) - deltaZ*DspNormVect(0) ; constraintMatrix (1,7) = deltaY*DspNormVect(0) - deltaX*DspNormVect(1) ; }
void XFEMStatic :: terminate(TimeStep *tStep) { this->doStepOutput(tStep); this->printReactionForces(tStep, 1); // update load vectors before storing context fflush( this->giveOutputStream() ); this->updateLoadVectors(tStep); this->saveStepContext(tStep); // Propagate fronts for ( auto &domain: domainList ) { XfemManager *xMan = domain->giveXfemManager(); xMan->propagateFronts(); } // Update element subdivisions if necessary // (e.g. if a crack has moved and cut a new element) for ( int domInd = 1; domInd <= this->giveNumberOfDomains(); domInd++ ) { Domain *domain = this->giveDomain(domInd); // create a new set containing all elements Set elemSet(0, domain); elemSet.addAllElements(); if ( domain->giveXfemManager()->hasPropagatingFronts() || mForceRemap ) { // If domain cloning is performed, there is no need to // set values from the dof map. mSetValsFromDofMap = false; // Take copy of the domain to allow mapping of state variables // to the new Gauss points. Domain *dNew = domain->Clone(); bool deallocateOld = false; setDomain(1, dNew, deallocateOld); forceEquationNumbering(); // Map primary variables LSPrimaryVariableMapper primMapper; FloatArray u; primMapper.mapPrimaryVariables(u, * domain, * dNew, VM_Total, * tStep); if ( totalDisplacement.giveSize() == u.giveSize() ) { FloatArray diff; diff.beDifferenceOf(totalDisplacement, u); printf( "diff norm: %e\n", diff.computeNorm() ); } totalDisplacement = u; primMapper.mapPrimaryVariables(incrementOfDisplacement, * domain, * dNew, VM_Incremental, * tStep); int numEl = dNew->giveNumberOfElements(); for ( int i = 1; i <= numEl; i++ ) { //////////////////////////////////////////////////////// // Map state variables for regular Gauss points StructuralElement *el = dynamic_cast< StructuralElement * >( dNew->giveElement(i) ); el->createMaterialStatus(); el->mapStateVariables(* domain, * tStep); //////////////////////////////////////////////////////// // Map state variables for cohesive zone if applicable XfemStructuralElementInterface *xFemEl = dynamic_cast< XfemStructuralElementInterface * >(el); if ( xFemEl != NULL ) { if ( xFemEl->mpCZMat != NULL ) { size_t numCzRules = xFemEl->mpCZIntegrationRules.size(); for ( size_t czIndex = 0; czIndex < numCzRules; czIndex++ ) { if ( xFemEl->mpCZIntegrationRules [ czIndex ] != NULL ) { for ( GaussPoint *gp: *xFemEl->mpCZIntegrationRules [ czIndex ] ) { MaterialStatus *ms = xFemEl->mpCZMat->giveStatus(gp); if ( ms == NULL ) { OOFEM_ERROR("Failed to fetch material status."); } MaterialStatusMapperInterface *interface = dynamic_cast< MaterialStatusMapperInterface * > ( xFemEl->mpCZMat->giveStatus(gp) ); if ( interface == NULL ) { OOFEM_ERROR("Failed to fetch MaterialStatusMapperInterface."); } MaterialStatus *matStat = dynamic_cast< MaterialStatus * >( xFemEl->mpCZMat->giveStatus(gp) ); StructuralInterfaceMaterialStatus *siMatStat = dynamic_cast< StructuralInterfaceMaterialStatus * >(matStat); if ( siMatStat == NULL ) { OOFEM_ERROR("Failed to cast to StructuralInterfaceMaterialStatus."); } interface->MSMI_map_cz(* gp, * domain, elemSet, * tStep, * siMatStat); } } } } } } delete domain; domain = this->giveDomain(1); // Set domain pointer to various components ... this->nMethod->setDomain(domain); int numExpModules = this->exportModuleManager->giveNumberOfModules(); for ( int i = 1; i <= numExpModules; i++ ) { // ... by diving deep into the hierarchies ... :-/ VTKXMLExportModule *vtkxmlMod = dynamic_cast< VTKXMLExportModule * >( this->exportModuleManager->giveModule(i) ); if ( vtkxmlMod != NULL ) { vtkxmlMod->giveSmoother()->setDomain(domain); vtkxmlMod->givePrimVarSmoother()->setDomain(domain); } } this->setUpdateStructureFlag(true); } // if( domain->giveXfemManager()->hasPropagatingFronts() ) //#endif } // Fracture/failure mechanics evaluation for ( auto &domain: domainList ) { if ( domain->hasFractureManager() ) { // Will most likely fail if numDom > 1 FractureManager *fracMan = domain->giveFractureManager(); fracMan->evaluateYourself(tStep); fracMan->updateXFEM(tStep); // Update XFEM structure based on the fracture manager this->setUpdateStructureFlag( fracMan->giveUpdateFlag() ); // if the internal structure need to be updated } } }
void BiotSavartSolver::computeFarFieldBuffer() { //in order to do this, we need //grid based velocity, //sorted vortex and their start end table //a double3 5x5x5xDXxDYxDZ local velocity field m_p_vortPos->copy(gf_GpuArray<float4>::DEVICE_TO_HOST); setDomain(m_origin, m_p_vortPos->getHostPtr(),m_N_vort,m_L); //printf("%f,%f,%f,%f,\n",m_origin.x,m_origin.y,m_origin.z,m_L); if(!m_isVIC){ m_SpatialHasher_eval.setSpatialHashGrid(m_gridx, m_L/(double)m_gridx, make_float3(m_origin.x,m_origin.y,m_origin.z), m_M_eval); m_SpatialHasher_eval.setHashParam(); m_SpatialHasher_eval.doSpatialHash(m_evalPos->getDevicePtr(),m_M_eval); m_SpatialHasher_eval.reorderData(m_M_eval,m_evalPos->getDevicePtr(),m_evalPos_Reorder->getDevicePtr(),4,1); } m_ParticleToMesh(); m_SolvePoisson(); m_ComputeCurl(); m_grid_U[0]->copy(m_grid_U[0]->DEVICE_TO_HOST); m_grid_U[1]->copy(m_grid_U[1]->DEVICE_TO_HOST); m_grid_U[2]->copy(m_grid_U[2]->DEVICE_TO_HOST); if(!m_isVIC){ for(int i=0; i<3; i++) { cudaMemcpy(m_far_U[i]->getDevicePtr(), m_grid_U[i]->getDevicePtr(), sizeof(double)*m_grid_U[i]->getSize(), cudaMemcpyDeviceToDevice); } BiotSavartComputeFarField(m_SpatialHasher_eval.getStartTable(),m_SpatialHasher_eval.getEndTable(), m_evalPos->getDevicePtr(), m_grid_vort[0]->getDevicePtr(), m_grid_vort[1]->getDevicePtr(), m_grid_vort[2]->getDevicePtr(), m_grid_Psi[0]->getDevicePtr(), m_grid_Psi[1]->getDevicePtr(), m_grid_Psi[2]->getDevicePtr(), m_grid_U[0]->getDevicePtr(), m_grid_U[1]->getDevicePtr(), m_grid_U[2]->getDevicePtr(), m_far_U[0]->getDevicePtr(),m_far_U[1]->getDevicePtr(),m_far_U[2]->getDevicePtr(), m_SpatialHasher_vort.getCellSize().x, make_uint3(m_gridx,m_gridy,m_gridz), make_uint3(m_gridx,m_gridy,m_gridz), m_K, m_M_eval, m_origin); } m_grid_U[0]->copy(m_grid_U[0]->HOST_TO_DEVICE); m_grid_U[1]->copy(m_grid_U[1]->HOST_TO_DEVICE); m_grid_U[2]->copy(m_grid_U[2]->HOST_TO_DEVICE); }
void ParsedCookie::setDefaultDomain(const KURL& requestURL) { setDomain(requestURL.host()); m_hasDefaultDomain = true; }
void GeneOntology::loadOntology(map<GeneOntologyIdentifier,string>*identifiers, map<GeneOntologyIdentifier,string>*descriptions){ if(!m_gotGeneOntologyParameter){ return ; /*--*/ } /* pick up all these entries: * * [Term] * id: GO:2001312 * name: lysobisphosphatidic acid biosynthetic process */ KeyEncoder encoder; char line[2048]; ifstream f(m_ontologyFileName.c_str()); string identifier=""; bool processing=false; string typeDef="[Typedef]"; /* is_a: GO:0007005 ! mitochondrion organization */ string isARelation="is_a:"; string example="GO:*******"; string theNamespace="namespace:"; string alternate="alt_id: "; while(!f.eof()){ f.getline(line,2048); string overlay=line; if(overlay=="[Term]"){ processing=true; }else if(!processing){ // busy wait on input/output operations }else if(overlay.length()>=3 && overlay.substr(0,3)=="id:"){ identifier=overlay.substr(4); }else if(overlay.length()>=5 && overlay.substr(0,5)=="name:"){ string name=overlay.substr(6); #ifdef DEBUG_ONTOLOGY_LOADER cout<<"[DEBUG_ONTOLOGY_LOADER] "<<identifier<<" -> "<<name<<endl; #endif GeneOntologyIdentifier handle=encoder.encodeGeneOntologyHandle(identifier.c_str()); #ifdef ASSERT assert(identifiers->count(handle)==0); assert(descriptions->count(handle)==0); #endif (*identifiers)[handle]=identifier; (*descriptions)[handle]=name; if(name==GENE_ONTOLOGY_DOMAIN_biological_process_STRING){ m_biologicalProcessHandle=handle; }else if(name==GENE_ONTOLOGY_DOMAIN_molecular_function_STRING){ m_molecularFunctionHandle=handle; }else if(name==GENE_ONTOLOGY_DOMAIN_cellular_component_STRING){ m_cellularComponentHandle=handle; } }else if(overlay.length()>=theNamespace.length() && overlay.substr(0,theNamespace.length())==theNamespace){ string namespaceName=overlay.substr(theNamespace.length()+1); GeneOntologyDomain domain=getGeneOntologyDomain(namespaceName.c_str()); GeneOntologyIdentifier handle=encoder.encodeGeneOntologyHandle(identifier.c_str()); setDomain(handle,domain); }else if(overlay.length()>=alternate.length() && overlay.substr(0,alternate.length())==alternate){ string alternateIdentifier=overlay.substr(alternate.length()); GeneOntologyIdentifier alternateHandle=encoder.encodeGeneOntologyHandle(alternateIdentifier.c_str()); GeneOntologyIdentifier handle=encoder.encodeGeneOntologyHandle(identifier.c_str()); // an alternate handle can be utilised only once #ifdef ASSERT assert(m_symbolicLinks.count(alternateHandle)==0); #endif m_symbolicLinks[alternateHandle]=handle; }else if(overlay.length()>=isARelation.length() && overlay.substr(0,isARelation.length())==isARelation){ string parentIdentifier=overlay.substr(6,example.length()); GeneOntologyIdentifier parentHandle=encoder.encodeGeneOntologyHandle(parentIdentifier.c_str()); GeneOntologyIdentifier handle=encoder.encodeGeneOntologyHandle(identifier.c_str()); addParentGeneOntologyIdentifier(handle,parentHandle); }else if(overlay.length()>=typeDef.length() && overlay.substr(0,typeDef.length())==typeDef){ processing=false; } } f.close(); cout<<"Rank "<<m_rank<<": loaded "<<identifiers->size()<<" gene ontology terms."<<endl; #ifdef ASSERT assert(identifiers->size()==descriptions->size()); #endif }
CUrlData::CUrlData(string url_) : url(url_),dnsFailCount(0),keyCheckReturn(0) { setDomain(); ips.clear(); }
//! @brief Constructor. //! @param theDomain: domain where the constraint is defined. //! @param tag: tag for the multi-freedom constraint. //! @param nodeRetain: identifier of the retained node. //! @param nodeConstr: identifier of the constrained node. //! @param LrgDsp: true if large displacement (geometric non-linearity) must be expected: 0 for constant constraint matrix(small deformations), 1 for time varying constraint matrix(large deformations), 2 for large deformations with length correction. XC::MFreedom_Joint2D::MFreedom_Joint2D(Domain *domain, int tag, int nodeRetain, int nodeConstr,int Maindof, int fixedend, int LrgDsp ) : MFreedom_Joint(domain,tag,CNSTRNT_TAG_MFreedom_Joint2D,nodeRetain,nodeConstr,LrgDsp), MainDOF(Maindof), AuxDOF(0), FixedEnd(fixedend) { setDomain(domain); // check for proper degrees of freedom int RnumDOF = RetainedNode->getNumberDOF(); int CnumDOF = ConstrainedNode->getNumberDOF(); if(RnumDOF != 4 || CnumDOF != 3 ) { std::cerr << "MFreedom_Joint2D::MFreedom_Joint2D - mismatch in numDOF\n DOF not supported by this type of constraint"; return; } // check the XC::main degree of freedom. Assign auxilary DOF if( MainDOF!= 2 && MainDOF!=3 ) { std::cerr << "MFreedom_Joint2D::MFreedom_Joint2D - Wrong main degree of freedom" ; return; } if(MainDOF == 2 ) AuxDOF = 3; if(MainDOF == 3 ) AuxDOF = 2; // check the fixed end flag if( FixedEnd!= 0 && FixedEnd!=1 ) { std::cerr << "XC::MFreedom_Joint2D::MFreedom_Joint2D - Wrong fixed end flag"; return; } // check for proper dimensions of coordinate space const Vector &crdR = RetainedNode->getCrds(); int dimR = crdR.Size(); const Vector &crdC = ConstrainedNode->getCrds(); int dimC = crdC.Size(); if(dimR != 2 || dimC != 2 ) { std::cerr << "MFreedom_Joint2D::MFreedom_Joint2D - mismatch in dimnesion\n dimension not supported by this type of constraint"; return; } // calculate the initial length of the rigid link double deltaX = crdC(0) - crdR(0); double deltaY = crdC(1) - crdR(1); Length0 = sqrt( deltaX*deltaX + deltaY*deltaY ); if( Length0 <= 1.0e-12 ) { std::cerr << "XC::MFreedom_Joint2D::MFreedom_Joint2D - The constraint length is zero\n"; } // allocate and set up the constranted and retained id's // allocate and set up the constraint matrix if( FixedEnd == 0 ) { // the end is released set_constrained_dofs(ID(CnumDOF-1)); set_retained_dofs(ID(RnumDOF-1)); constrDOF(0) = 0; constrDOF(1) = 1; retainDOF(0) = 0; retainDOF(1) = 1; retainDOF(2) = MainDOF; set_constraint(Matrix( CnumDOF-1 , RnumDOF-1 )); constraintMatrix(0,0) = 1.0 ; constraintMatrix(0,2) = -deltaY ; constraintMatrix(1,1) = 1.0 ; constraintMatrix(1,2) = deltaX ; } else { // the end is fixed constrDOF = ID(CnumDOF); retainDOF = ID(RnumDOF); constrDOF(0) = 0; constrDOF(1) = 1; constrDOF(2) = 2; retainDOF(0) = 0; retainDOF(1) = 1; retainDOF(2) = 2; retainDOF(3) = 3; constraintMatrix= Matrix(CnumDOF,RnumDOF); constraintMatrix(0,0) = 1.0 ; constraintMatrix(0,MainDOF) = -deltaY ; constraintMatrix(1,1) = 1.0 ; constraintMatrix(1,MainDOF) = deltaX ; constraintMatrix(2,AuxDOF) = 1.0 ; } if(constraintMatrix.isEmpty()) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; ran out of memory \ncan not generate the constraint matrix"; exit(-1); } }
void Ssu::sendRegistration(QString usernameDomain, QString password){ errorFlag = false; QString ssuCaCertificate, ssuRegisterUrl; QString username, domainName; SsuLog *ssuLog = SsuLog::instance(); SsuCoreConfig *settings = SsuCoreConfig::instance(); // Username can include also domain, (user@domain), separate those if (usernameDomain.contains('@')) { // separate domain/username and set domain username = usernameDomain.section('@', 0, 0); domainName = usernameDomain.section('@', 1, 1); setDomain(domainName); } else { // No domain defined username = usernameDomain; } if (!settings->contains("ca-certificate")){ setError("CA certificate for SSU not set (config key 'ca-certificate')"); return; } else ssuCaCertificate = settings->value("ca-certificate").toString(); if (!settings->contains("register-url")){ ssuRegisterUrl = repoUrl("register-url"); if (ssuRegisterUrl.isEmpty()){ setError("URL for SSU registration not set (config key 'register-url')"); return; } } else ssuRegisterUrl = settings->value("register-url").toString(); QString IMEI = deviceInfo.deviceUid(); if (IMEI == ""){ setError("No valid UID available for your device. For phones: is your modem online?"); return; } QSslConfiguration sslConfiguration; if (!useSslVerify()) sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyNone); sslConfiguration.setCaCertificates(QSslCertificate::fromPath(ssuCaCertificate)); QNetworkRequest request; request.setUrl(QUrl(QString(ssuRegisterUrl) .arg(IMEI) )); request.setSslConfiguration(sslConfiguration); request.setRawHeader("Authorization", "Basic " + QByteArray(QString("%1:%2") .arg(username).arg(password) .toAscii()).toBase64()); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); QUrl form; form.addQueryItem("protocolVersion", SSU_PROTOCOL_VERSION); form.addQueryItem("deviceModel", deviceInfo.deviceModel()); if (!domain().isEmpty()){ form.addQueryItem("domain", domain()); } qDebug() << "Sending request to " << request.url(); qDebug() << form.encodedQueryItems(); QNetworkReply *reply; pendingRequests++; reply = manager->post(request, form.encodedQuery()); // we could expose downloadProgress() from reply in case we want progress info QString homeUrl = settings->value("home-url").toString().arg(username); if (!homeUrl.isEmpty()){ // clear header, the other request bits are reusable request.setHeader(QNetworkRequest::ContentTypeHeader, 0); request.setUrl(homeUrl + "/authorized_keys"); ssuLog->print(LOG_DEBUG, QString("Trying to get SSH keys from %1").arg(request.url().toString())); pendingRequests++; manager->get(request); } }
void DomainInfoDock::onDomainChanged(QString oldName, QString newName) { if(oldName==_domain.name()) setDomain(ConfigurationStack::instance().current().getDomainByName(newName)); }
void CUrlData::setUrl(const string url) { this->url = url; setDomain(); ips.clear(); }