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); } }
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; }
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; }
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); }
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; }
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 }
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; }
/// 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; }
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; }
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; }
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; }
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]]; } }
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; }
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; }
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); }
void NonLinearDynamic :: showSparseMtrxStructure(int type, oofegGraphicContext &gc, TimeStep *tStep) { Domain *domain = this->giveDomain(1); CharType ctype; if ( type != 1 ) { return; } ctype = TangentStiffnessMatrix; int nelems = domain->giveNumberOfElements(); for ( int i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showSparseMtrxStructure(ctype, gc, tStep); } for ( int i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showExtendedSparseMtrxStructure(ctype, gc, tStep); } }
void NonStationaryTransportProblem :: assembleAlgorithmicPartOfRhs(FloatArray &answer, EquationID ut, const UnknownNumberingScheme &s, TimeStep *tStep) { IntArray loc; FloatMatrix charMtrx, bcMtrx; FloatArray unknownVec, contrib, intSource; Element *element; Domain *domain = this->giveDomain(1); int nelem = domain->giveNumberOfElements(); for ( int i = 1; i <= nelem; i++ ) { element = domain->giveElement(i); #ifdef __PARALLEL_MODE // skip remote elements (these are used as mirrors of remote elements on other domains // when nonlocal constitutive models are used. They introduction is necessary to // allow local averaging on domains without fine grain communication between domains). if ( element->giveParallelMode() == Element_remote ) { continue; } #endif element->giveLocationArray(loc, ut, s); //(alpha-1)*K+C/dt this->giveElementCharacteristicMatrix(charMtrx, i, NSTP_MidpointRhs, tStep, domain); //contribution from previous boundary convection element->giveCharacteristicMatrix(bcMtrx, LHSBCMatrix, tStep); bcMtrx.times(this->alpha - 1.0); if ( bcMtrx.isNotEmpty() ) { charMtrx.add(bcMtrx); } if ( charMtrx.isNotEmpty() ) { element->computeVectorOf(EID_ConservationEquation, VM_Total, tStep, unknownVec); contrib.beProductOf(charMtrx, unknownVec); answer.assemble(contrib, loc); } } }
void Pointer::store(const Domain &value, State &state) const { CANAL_ASSERT(!mTop); // Go through all target memory blocks for the pointer and merge // them with the value being stored. PlaceTargetMap::const_iterator it = mTargets.begin(), itend = mTargets.end(); for (; it != itend; ++it) { if (it->second->mType != Target::Block) continue; const Domain *source = state.findBlock(*it->second->mTarget); CANAL_ASSERT(source); std::vector<Domain*> offsets; if (!it->second->mOffsets.empty()) { CANAL_ASSERT_MSG(Integer::Utils::getSet(*it->second->mOffsets[0]).mValues.size() == 1, "First offset is expected to be zero!"); CANAL_ASSERT_MSG(Integer::Utils::getSet(*it->second->mOffsets[0]).mValues.begin()->isMinValue(), "First offset is expected to be zero!"); offsets = std::vector<Domain*>(it->second->mOffsets.begin() + 1, it->second->mOffsets.end()); } Domain *result = source->clone(); result->store(value, offsets, mTargets.size() == 1); if (state.hasGlobalBlock(*it->second->mTarget)) state.addGlobalBlock(*it->second->mTarget, result); else state.addFunctionBlock(*it->second->mTarget, result); } }
void NonLinearDynamic :: packMigratingData(TimeStep *atTime) { Domain *domain = this->giveDomain(1); int ndofman = domain->giveNumberOfDofManagers(), ndofs, idofman, idof, _eq; DofManager *_dm; Dof *_dof; bool initialLoadVectorEmpty = initialLoadVector.isEmpty(); bool initialLoadVectorOfPrescribedEmpty = initialLoadVectorOfPrescribed.isEmpty(); for ( idofman = 1; idofman <= ndofman; idofman++ ) { _dm = domain->giveDofManager(idofman); ndofs = _dm->giveNumberOfDofs(); for ( idof = 1; idof <= ndofs; idof++ ) { _dof = _dm->giveDof(idof); if ( _dof->isPrimaryDof() ) { if ( ( _eq = _dof->__giveEquationNumber() ) ) { // pack values in solution vectors _dof->updateUnknownsDictionary( atTime, VM_Total, totalDisplacement.at(_eq) ); if ( initialLoadVectorEmpty ) { _dof->updateUnknownsDictionary(atTime, VM_RhsInitial, 0.0); } else { _dof->updateUnknownsDictionary( atTime, VM_RhsInitial, initialLoadVector.at(_eq) ); } _dof->updateUnknownsDictionary( atTime, VM_RhsIncremental, incrementalLoadVector.at(_eq) ); } else if ( ( _eq = _dof->__givePrescribedEquationNumber() ) ) { // pack values in prescribed solution vectors if ( initialLoadVectorOfPrescribedEmpty ) { _dof->updateUnknownsDictionary(atTime, VM_RhsInitial, 0.0); } else { _dof->updateUnknownsDictionary( atTime, VM_RhsInitial, initialLoadVectorOfPrescribed.at(_eq) ); } _dof->updateUnknownsDictionary( atTime, VM_RhsIncremental, incrementalLoadVectorOfPrescribed.at(_eq) ); } } // end primary dof } // end dof loop } // end dofman loop }
void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &domain) { if (domain.empty()) return; // Don't bother writing empty domains. String comment; // Write domain comment (if any) comment = domain.getDomainComment(); if (!comment.empty()) fprintf(file, "%s", comment.c_str()); // Write domain start fprintf(file, "[%s]\n", name.c_str()); // Write all key/value pairs in this domain, including comments Domain::const_iterator x; for (x = domain.begin(); x != domain.end(); ++x) { const String &value = x->_value; if (!value.empty()) { // Write comment (if any) if (domain.hasKVComment(x->_key)) { comment = domain.getKVComment(x->_key); fprintf(file, "%s", comment.c_str()); } // Write the key/value pair fprintf(file, "%s=%s\n", x->_key.c_str(), value.c_str()); } } fprintf(file, "\n"); }
void MatlabExportModule :: doOutputData(TimeStep *tStep, FILE *FID) { Domain *domain = emodel->giveDomain(1); std :: vector< int >DofIDList; std :: vector< int > :: iterator it; std :: vector< std :: vector< double > >valuesList; for ( auto &dman : domain->giveDofManagers() ) { for ( Dof *thisDof: *dman ) { it = std :: find( DofIDList.begin(), DofIDList.end(), thisDof->giveDofID() ); double value = thisDof->giveUnknown(VM_Total, tStep); if ( it == DofIDList.end() ) { DofIDList.push_back( thisDof->giveDofID() ); valuesList.push_back({value}); } else { std::size_t pos = it - DofIDList.begin(); valuesList[pos].push_back(value); } } } fprintf(FID, "\tdata.DofIDs=["); for ( auto &dofid : DofIDList ) { fprintf( FID, "%d, ", dofid ); } fprintf(FID, "];\n"); for ( size_t i = 0; i < valuesList.size(); i++ ) { fprintf(FID, "\tdata.a{%lu}=[", static_cast< long unsigned int >(i) + 1); for ( double val: valuesList[i] ) { fprintf( FID, "%f,", val ); } fprintf(FID, "];\n"); } }
double Pressure_Constraint::getPressure(int last) { if (pval != 0) { return pval[0]; } Domain* theDomain = this->getDomain(); if(theDomain == 0) { opserr<<"WARNING: domain has not been set"; opserr<<" -- Pressure_Constraint::getPressureNode\n"; return 0; } Node* pNode = theDomain->getNode(pTag); if(pNode == 0) return 0.0; const Vector& vel = pNode->getVel(); if(last == 1) { if(vel.Size()==0) return 0.0; return vel(0); } return 0.0; }
int Mesh::clearNodes() { Domain* domain = OPS_GetDomain(); return 0; // clear nodes for (int i=0; i<newndtags.Size(); ++i) { Node* node = domain->removeNode(newndtags(i)); if (node != 0) { delete node; } Pressure_Constraint* pc = domain->removePressure_Constraint(newndtags(i)); if (pc != 0) { delete pc; } } newndtags=ID(); return 0; }
std::vector<typename Domain::Point> pointsInStandardPlane ( const Domain & domain, typename Domain::Integer a, typename Domain::Integer b, typename Domain::Integer c, typename Domain::Integer mu ) { typedef typename Domain::Integer Integer; typedef typename Domain::Point Point; typedef typename Domain::ConstIterator ConstIterator; std::vector<Point> pts; Integer mup = mu + abs(a) + abs(b) + abs(c); for ( ConstIterator it = domain.begin(), itE = domain.end(); it != itE; ++it ) { Point p = *it; Integer r = a * p[ 0 ] + b * p[ 1 ] + c * p[ 2 ]; if ( ( mu <= r ) && ( r < mup ) ) pts.push_back( p ); } return pts; }
bool PLnodeRadius :: propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp) { if ( !iEnrFront.propagationIsAllowed() ) { printf("EnrichmentFront.propagationIsAllowed is false \n"); return false; } const TipInfo &tipInfo = iEnrFront.giveTipInfo(); // includes the dofman numbers which represent the boundary of the EI. //tipInfo.mTipDofManNumbers.printYourself(); // No listbased tip (or EI) present, so nothing to propagate. if ( tipInfo.mTipDofManNumbers.giveSize() == 0 ) { printf("No dofmans in tip; nothing to propagate. \n"); return false; } // Localise nodes within certain radius from tip nodes oTipProp.mPropagationDofManNumbers.clear(); SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer(); for ( int i = 1 ; i <= tipInfo.mTipDofManNumbers.giveSize() ; i++ ) { //DofManager *dofMan = iDomain.giveDofManager(tipInfo.mTipDofManNumbers.at(i)); //const FloatArray gCoords = dofMan->giveCoordinates(); Node *iNode = iDomain.giveNode(tipInfo.mTipDofManNumbers.at(i)); const FloatArray gCoords = iNode->giveNodeCoordinates(); std :: list< int > nodeList; localizer->giveAllNodesWithinBox(nodeList,gCoords,mRadius); for ( int jNode : nodeList ) { //printf("nodeList node %d \n",jNode); oTipProp.mPropagationDofManNumbers.insertSortedOnce(jNode); } } //oTipProp.mPropagationDofManNumbers.printYourself(" The following noded will be propagated to:"); return true; }
bool TransientTransportProblem :: requiresEquationRenumbering(TimeStep *tStep) { ///@todo This method should be set as the default behavior instead of relying on a user specified flag. Then this function should be removed. 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; }
int FreeWarping :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType) { int count = 0, pcount = 0; IntArray locationArray; Domain *domain = this->giveDomain(1); if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) { for ( int map: commMap ) { count += domain->giveDofManager( map )->giveNumberOfDofs(); } return ( buff.givePackSize(MPI_DOUBLE, 1) * count ); } else if ( packUnpackType == ProblemCommMode__NODE_CUT ) { for ( int map: commMap ) { for ( Dof *jdof: *domain->giveDofManager( map ) ) { if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) { count++; } else { pcount++; } } } // -------------------------------------------------------------------------------- // only pcount is relevant here, since only prescribed components are exchanged !!!! // -------------------------------------------------------------------------------- return ( buff.givePackSize(MPI_DOUBLE, 1) * pcount ); } else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) { for ( int map: commMap ) { count += domain->giveElement( map )->estimatePackSize(buff); } return count; } return 0; }
mObject patternsToJSON(void) { LoadPatternIter &thePatterns = theDomain.getLoadPatterns(); LoadPattern *thePattern; TimeSeries *theSeries; NodalLoadIter *nli; NodalLoad *nload; const Vector *load_vec; // TODO: // ElementalLoadIter *eli; // SP_ConstraintIter *spci; mObject patterns, pattern, nloads; mArray arr; mValue tmp, tmp2, tmp3; char tag_str[15]; int i, size; patterns.clear(); while ((thePattern = thePatterns()) != 0) { pattern.clear(); // TODO: tmp = thePattern->getClassType(); pattern["type"] = tmp; theSeries = thePattern->getTimeSeries(); tmp2 = theSeries->getTag(); sprintf(tag_str, "%d", tmp2.get_int()); pattern["tsTag"] = tag_str; nli = &(thePattern->getNodalLoads()); nloads.clear(); while((nload = (*nli)()) != 0) { tmp2 = nload->getNodeTag(); sprintf(tag_str, "%d", tmp2.get_int()); load_vec = nload->getLoadValue(); size = load_vec->Size(); arr.clear(); for (i = 0; i < size; i++) { tmp3 = (*load_vec)(i); arr.push_back(tmp3); } nloads[tag_str] = arr; } pattern["nodalLoads"] = nloads; tmp2 = thePattern->getTag(); sprintf(tag_str, "%d", tmp2.get_int()); patterns[tag_str] = pattern; } return patterns; }
// needed for CemhydMat void NonStationaryTransportProblem :: averageOverElements(TimeStep *tStep) { Domain *domain = this->giveDomain(1); int ielem, i; int nelem = domain->giveNumberOfElements(); double dV; TransportElement *element; IntegrationRule *iRule; GaussPoint *gp; FloatArray vecTemperature; TransportMaterial *mat; for ( ielem = 1; ielem <= nelem; ielem++ ) { element = ( TransportElement * ) domain->giveElement(ielem); mat = ( TransportMaterial * ) element->giveMaterial(); if ( mat->giveClassID() == CemhydMatClass ) { iRule = element->giveDefaultIntegrationRulePtr(); for ( i = 0; i < iRule->getNumberOfIntegrationPoints(); i++ ) { gp = iRule->getIntegrationPoint(i); dV = element->computeVolumeAround(gp); element->giveIPValue(vecTemperature, gp, IST_Temperature, tStep); //mat->IP_volume += dV; //mat->average_temp += vecState.at(1) * dV; } } } for ( i = 1; i <= domain->giveNumberOfMaterialModels(); i++ ) { mat = ( TransportMaterial * ) domain->giveMaterial(i); if ( mat->giveClassID() == CemhydMatClass ) { //mat->average_temp /= mat->IP_volume; } } }
/** * @brief enables/disables available actions according to context * @param index - index of selected item * * Depending on the item (hypervisor or domain) and their state * certain actions are available which are enabled, or unavailable * which are disabled. */ void VirtnosisWindow::enableVirtualMachineActions(const QModelIndex &index) { ui->menuVmActionStart->setDisabled(true); ui->menuVmActionReboot->setDisabled(true); ui->menuVmActionShutoff->setDisabled(true); ui->menuVmActionDestroy->setDisabled(true); ui->menuVmActionPause->setDisabled(true); ui->menuVmActionResume->setDisabled(true); ui->menuHypervisorActionConnect->setDisabled(true); ui->menuHypervisorActionDisconnect->setDisabled(true); ui->menuHypervisorActionRemove->setDisabled(true); if (index.data(DomainViewModel::domainTypeRole) == DomainViewModel::typeHypervisor) { Hypervisor hypervisor = qvariant_cast<Hypervisor>( index.data(DomainViewModel::domainHypervisorRole)); ui->menuHypervisorActionRemove->setEnabled(true); if (hypervisor.alive()) { ui->menuHypervisorActionDisconnect->setEnabled(true); } else { ui->menuHypervisorActionConnect->setEnabled(true); } } else { Domain domain = qvariant_cast<Domain>(index.data(DomainViewModel::domainDomainRole)); if (domain.isRunning()) { ui->menuVmActionShutoff->setEnabled(true); ui->menuVmActionDestroy->setEnabled(true); ui->menuVmActionPause->setEnabled(true); ui->menuVmActionReboot->setEnabled(true); } else if (domain.isPaused()) { ui->menuVmActionResume->setEnabled(true); } else { ui->menuVmActionStart->setEnabled(true); } } }