void Domain1D::showSolution(const doublereal* x) { size_t nn = m_nv/5; for (size_t i = 0; i < nn; i++) { writeline('-', 79, false, true); writelog("\n z "); for (size_t n = 0; n < 5; n++) { writelog(" {:>10s} ", componentName(i*5 + n)); } writeline('-', 79, false, true); for (size_t j = 0; j < m_points; j++) { writelog("\n {:10.4g} ", m_z[j]); for (size_t n = 0; n < 5; n++) { double v = value(x, i*5+n, j); writelog(" {:10.4g} ", v); } } writelog("\n"); } size_t nrem = m_nv - 5*nn; writeline('-', 79, false, true); writelog("\n z "); for (size_t n = 0; n < nrem; n++) { writelog(" {:>10s} ", componentName(nn*5 + n)); } writeline('-', 79, false, true); for (size_t j = 0; j < m_points; j++) { writelog("\n {:10.4g} ", m_z[j]); for (size_t n = 0; n < nrem; n++) { double v = value(x, nn*5+n, j); writelog(" {:10.4g} ", v); } } writelog("\n"); }
bool Updater::getLatestComponents() { URL url = URL(UPDATER_URL_PREFIX).getChildURL("latest.php") .withParameter("channel", launcherApplication::getConfig()->getString("updater", "channel")) .withParameter("platform", launcherApplication::getConfig()->getString("updater", "platform")) .withParameter("components", "launcher,tremulous"); ScopedPointer<InputStream> stream(url.createInputStream(false, nullptr, nullptr, String(), 5000)); if (stream == nullptr) { return false; } var versionsVar = JSON::parse(*stream); if (versionsVar == var::null || !versionsVar.isObject()) { return false; } DynamicObject *versionsObject = versionsVar.getDynamicObject(); NamedValueSet *versionsSet = &versionsObject->getProperties(); components.clear(); for (int i = 0; i < versionsSet->size(); i++) { String componentName(versionsSet->getName(i)); Launcher::Component component(componentName); component.setRemoteVersion(versionsSet->getValueAt(i).toString()); components.add(component); } return true; }
void MountVertexLLamaCompSimImpl::initialize() { MountVertexLLamaCompSimBase::initialize(); /*std::vector<CAN::byte_t> sn(8,0x00); AMB::node_t node = 0x00; */ const std::string fnName("MountVertexLLamaCompSimImpl::initialize"); AUTO_TRACE(fnName); std::string componentName(compName_m); unsigned long long hashed_sn=AMB::Utils::getSimSerialNumber(componentName,"MountVertexLLama"); std::ostringstream msg; msg<< "simSerialNumber for " << compName_m << " with assembly name " << "MountVertexLLama" << " is " << std::hex << "0x" << hashed_sn << std::endl; ACS_LOG(LM_SOURCE_INFO, fnName, (LM_DEBUG, msg.str().c_str())); std::vector< CAN::byte_t > sn; AMB::node_t node = 0x00; AMB::TypeConversion::valueToData(sn,hashed_sn, 8U); // Antenna name conversion for shared simulator. SharedSimAntNameMapping ss_antID = SharedSimAntNameMapping(); try{ device_m = new AMB::MountVertexLLamaHWSimImpl(node, sn, ss_antID.getAntennaID(compName_m), getContainerServices()->getDefaultComponent<SHARED_SIMULATOR::SharedSimulator>("IDL:alma/SHARED_SIMULATOR/SharedSimulator:1.0")); } catch(maciErrType::CannotGetComponentExImpl &_ex) { device_m = new AMB::MountVertexLLamaHWSimImpl(node,sn); } simulationIf_m.setSimObj(device_m); device_m->start(); }
void Domain1D::showSolution(const doublereal* x) { size_t nn = m_nv/5; size_t i, j, n; //char* buf = new char[100]; char buf[100]; doublereal v; for (i = 0; i < nn; i++) { drawline(); sprintf(buf, "\n z "); writelog(buf); for (n = 0; n < 5; n++) { sprintf(buf, " %10s ",componentName(i*5 + n).c_str()); writelog(buf); } drawline(); for (j = 0; j < m_points; j++) { sprintf(buf, "\n %10.4g ",m_z[j]); writelog(buf); for (n = 0; n < 5; n++) { v = value(x, i*5+n, j); sprintf(buf, " %10.4g ",v); writelog(buf); } } writelog("\n"); } size_t nrem = m_nv - 5*nn; drawline(); sprintf(buf, "\n z "); writelog(buf); for (n = 0; n < nrem; n++) { sprintf(buf, " %10s ", componentName(nn*5 + n).c_str()); writelog(buf); } drawline(); for (j = 0; j < m_points; j++) { sprintf(buf, "\n %10.4g ",m_z[j]); writelog(buf); for (n = 0; n < nrem; n++) { v = value(x, nn*5+n, j); sprintf(buf, " %10.4g ", v); writelog(buf); } } writelog("\n"); }
/** * Utility to center detector. */ void LoadILLReflectometry::centerDetector(double xCenter) { std::string componentName("uniq_detector"); V3D pos = m_loader.getComponentPosition(m_localWorkspace, componentName); // TODO confirm! pos.setX(pos.X() - xCenter); m_loader.moveComponent(m_localWorkspace, componentName, pos); }
size_t Domain1D::componentIndex(const std::string& name) const { for (size_t n = 0; n < nComponents(); n++) { if (name == componentName(n)) { return n; } } throw CanteraError("Domain1D::componentIndex", "no component named "+name); }
XML_Node& Surf1D::save(XML_Node& o, const doublereal* const soln) { const doublereal* s = soln + loc(); XML_Node& inlt = Domain1D::save(o, soln); inlt.addAttribute("type","surface"); for (size_t k = 0; k < nComponents(); k++) { addFloat(inlt, componentName(k), s[k]); } return inlt; }
void MaterialObject::Element::populateMaterialProperties(MaterialProperties& materialProperties) const { double quantity; if(debugInactivate() == false) { if(service() == false) { quantity = totalGrams(materialProperties); materialProperties.addLocalMass(elementName(), componentName(), quantity); } } }
void Inlet1D:: save(XML_Node& o, doublereal* soln) { doublereal* s = soln + loc(); XML_Node& inlt = o.addChild("domain"); inlt.addAttribute("id",id()); inlt.addAttribute("points",1); inlt.addAttribute("type","inlet"); inlt.addAttribute("components",nComponents()); for (int k = 0; k < nComponents(); k++) { ctml::addFloat(inlt, componentName(k), s[k], "", "",lowerBound(k), upperBound(k)); } }
MaterialObject::Element::Element(const Element& original, double multiplier) : Element(original.materialType_) { if(original.destination.state()) destination(original.destination()); if(original.componentName.state()) componentName(original.componentName()); elementName(original.elementName()); service(original.service()); quantity(original.quantity() * original.scalingMultiplier() * multiplier); //apply the scaling in the copied object scaleOnSensor(0); unit(original.unit()); debugInactivate(original.debugInactivate()); }
void Domain1D::setProfile(const std::string& name, double* values, double* soln) { for (size_t n = 0; n < m_nv; n++) { if (name == componentName(n)) { for (size_t j = 0; j < m_points; j++) { soln[index(n, j) + m_iloc] = values[j]; } return; } } throw CanteraError("Domain1D::setProfile", "unknown component: "+name); }
int main (int argc, char **argv) { KLocalizedString::setApplicationDomain("kronometer"); QApplication app {argc, argv}; KCrash::initialize(); auto aboutData = KAboutData { QStringLiteral("kronometer"), // componentName i18nc("KAboutData display name", "Kronometer"), QStringLiteral(KRONOMETER_VERSION_STRING), i18n("Kronometer is a simple stopwatch application"), // shortDescription KAboutLicense::GPL_V2, // licenseType i18n("Copyright (C) 2014-2016 Elvis Angelaccio"), // copyrightStatement {}, // otherText QStringLiteral("http://aelog.org/kronometer") // homePageAddress }; aboutData.addAuthor( i18n("Elvis Angelaccio"), i18n("Maintainer"), QStringLiteral("*****@*****.**"), QStringLiteral("http://aelog.org") ); aboutData.addCredit( i18n("Ken Vermette"), i18n("Kronometer icon"), QStringLiteral("*****@*****.**") ); KAboutData::setApplicationData(aboutData); app.setApplicationName(aboutData.componentName()); app.setApplicationDisplayName(aboutData.displayName()); app.setOrganizationDomain(aboutData.organizationDomain()); app.setApplicationVersion(aboutData.version()); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kronometer"))); // Make sure that the local data directory is available. auto appdata = QFileInfo {QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)}; if (not appdata.exists()) { auto dir = QDir {appdata.absolutePath()}; dir.mkdir(appdata.fileName()); } auto window = new MainWindow {}; window->show(); return app.exec(); }
void ReactingSurf1D:: save(XML_Node& o, doublereal* soln) { doublereal* s = soln + loc(); //XML_Node& inlt = o.addChild("inlet"); XML_Node& inlt = o.addChild("domain"); inlt.addAttribute("id",id()); inlt.addAttribute("points",1); inlt.addAttribute("type","surface"); inlt.addAttribute("components",nComponents()); for (int k = 0; k < nComponents(); k++) { ctml::addFloat(inlt, componentName(k), s[k], "", "",0.0, 1.0); } }
XML_Node& Inlet1D::save(XML_Node& o, const doublereal* const soln) { const doublereal* s = soln + loc(); XML_Node& inlt = Domain1D::save(o, soln); inlt.addAttribute("type","inlet"); for (size_t k = 0; k < nComponents(); k++) { addFloat(inlt, componentName(k), s[k]); } for (size_t k=0; k < m_nsp; k++) { addFloat(inlt, "massFraction", m_yin[k], "", m_flow->phase().speciesName(k)); } return inlt; }
/** * Utility to place detector in space, according to data file */ void LoadILLReflectometry::placeDetector(double distance /* meter */, double angle /* degree */) { const double deg2rad = M_PI / 180.0; std::string componentName("uniq_detector"); V3D pos = m_loader.getComponentPosition(m_localWorkspace, componentName); // double r, theta, phi; // pos.getSpherical(r, theta, phi); double angle_rad = angle * deg2rad; V3D newpos(distance * sin(angle_rad), pos.Y(), distance * cos(angle_rad)); m_loader.moveComponent(m_localWorkspace, componentName, newpos); // Apply a local rotation to stay perpendicular to the beam const V3D axis(0.0, 1.0, 0.0); Quat rotation(angle, axis); m_loader.rotateComponent(m_localWorkspace, componentName, rotation); }
QString KAboutData::displayName() const { if (!d->_displayName.isEmpty()) return d->_displayName; return componentName(); }
static void resolveCallee( const std::string& calleeName, co::IComponent*& component, co::IPort*& facet, co::IMethod*& method ) { // was a method name specified? size_t colonPos = calleeName.rfind( ':' ); if( colonPos == std::string::npos ) { // resolve component type co::IType* type = co::getType( calleeName ); if( !type || type->getKind() != co::TK_COMPONENT ) CORAL_THROW( co::Exception, "'" << calleeName << "' is not a component." ); component = static_cast<co::IComponent*>( type ); // search the component's list of facets co::TSlice<co::IPort*> facets = component->getFacets(); for( ; facets; facets.popFirst() ) { facet = facets.getFirst(); co::IMember* member = facet->getType()->getMember( "main" ); method = static_cast<co::IMethod*>( member ); if( member && member->getKind() == co::MK_METHOD ) return; } CORAL_THROW( co::Exception, "none of " << calleeName << "'s facets has a main() method." ); } // parse the component.facet:method names std::string methodName( calleeName, colonPos + 1 ); size_t facetDotPos = calleeName.rfind( '.', colonPos ); if( facetDotPos == std::string::npos ) CORAL_THROW( co::Exception, "methods must be specified within a component's facet " "(syntax: module.component.facet:method)." ); std::string facetName( calleeName, facetDotPos + 1, colonPos - facetDotPos - 1 ); std::string componentName( calleeName, 0, facetDotPos ); // resolve component type co::IType* type = co::getType( componentName ); if( !type || type->getKind() != co::TK_COMPONENT ) CORAL_THROW( co::Exception, "'" << componentName << "' is not a component." ); component = static_cast<co::IComponent*>( type ); // resolve facet type co::IMember* member = component->getMember( facetName ); if( !member ) CORAL_THROW( co::Exception, "'" << componentName << "' has no facet named '" << facetName << "'." ); facet = static_cast<co::IPort*>( member ); if( member->getKind() != co::MK_PORT || !facet->getIsFacet() ) CORAL_THROW( co::Exception, "component port '" << componentName << "." << facetName << "' is a receptacle, not a facet." ); // resolve method member = facet->getType()->getMember( methodName ); if( !member ) CORAL_THROW( co::Exception, "interface '" << facet->getType()->getFullName() << "' has no method named '" << methodName << "'." ); if( member->getKind() != co::MK_METHOD ) CORAL_THROW( co::Exception, "interface member '" << facet->getType()->getFullName() << ":" << methodName << "' is a field, not a method." ); method = static_cast<co::IMethod*>( member ); }
QString KAboutData::productName() const { if (!d->productName.isEmpty()) return d->productName; return componentName(); }
QString KAboutData::programIconName() const { return d->programIconName.isEmpty() ? componentName() : d->programIconName; }
std::string CustomPlotTest::observerId() const { return componentName(); }