// -------------------------------------------------------------- void CairoFont::SelectFont( cairo_t * cr ) const { cairo_font_slant_t slant = GetProperties() & VGFont::kFontItalic ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL; cairo_font_weight_t weight = GetProperties() & VGFont::kFontBold ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL; cairo_select_font_face (cr, GetName(), slant, weight); cairo_set_font_size (cr, GetSize()); }
double& PointLoad2DCondition::CalculateIntegrationWeight(double& rIntegrationWeight) { if( GetProperties()[THICKNESS] > 0 ) rIntegrationWeight *= GetProperties()[THICKNESS]; return rIntegrationWeight; }
bool cSoundStream::CreateRenderingProperties() { if(GetProperties()) return true; vSoundStreamProperties *tmp = new (std::nothrow) vSoundStreamProperties; __super::m_RenderingProperties = tmp; return GetProperties() != NULL; };
bool cSprite3D::CreateRenderingProperties() { if(GetProperties()) return true; vSprite3DProperties *tmp = new (std::nothrow) vSprite3DProperties; __super::m_RenderingProperties = tmp; return GetProperties() != NULL; }
void LineLoadAxisym2DCondition::CalculateAndAddRHS(LocalSystemComponents& rLocalSystem, GeneralVariables& rVariables, Vector& rVolumeForce, double& rIntegrationWeight) { double IntegrationWeight = rIntegrationWeight * 2.0 * 3.141592654 * rVariables.CurrentRadius; if( GetProperties()[THICKNESS] > 0 ) IntegrationWeight /= GetProperties()[THICKNESS]; //contribution to external forces ForceLoadCondition::CalculateAndAddRHS( rLocalSystem, rVariables, rVolumeForce, IntegrationWeight ); //KRATOS_WATCH( rRightHandSideVector ) }
double& CamClayKinematicHardeningLaw::CalculateHardening(double &rHardening, const double &rAlpha, const double rTemperature) { double FirstPreconsolidationPressure = GetProperties()[PRE_CONSOLIDATION_STRESS]; double SwellingSlope = GetProperties()[SWELLING_SLOPE]; double OtherSlope = GetProperties()[NORMAL_COMPRESSION_SLOPE]; rHardening = -FirstPreconsolidationPressure*(std::exp (-rAlpha/(OtherSlope-SwellingSlope)) ) ; return rHardening; }
void LineLoadAxisym2DCondition::CalculateAndAddLHS(LocalSystemComponents& rLocalSystem, GeneralVariables& rVariables, double& rIntegrationWeight) { double IntegrationWeight = rIntegrationWeight * 2.0 * 3.141592654 * rVariables.CurrentRadius; if( GetProperties()[THICKNESS] > 0 ) rIntegrationWeight /= GetProperties()[THICKNESS]; //contributions to stiffness matrix calculated on the reference config ForceLoadCondition::CalculateAndAddLHS( rLocalSystem, rVariables, IntegrationWeight ); //KRATOS_WATCH( rLeftHandSideMatrix ) }
//************************************************************************************ //************************************************************************************ void ThermalFace2D::CalculateAll(MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, ProcessInfo& rCurrentProcessInfo, bool CalculateStiffnessMatrixFlag, bool CalculateResidualVectorFlag) { KRATOS_TRY unsigned int number_of_nodes = GetGeometry().size(); //resizing as needed the LHS unsigned int MatSize=number_of_nodes; ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS); const Variable<double>& rUnknownVar = my_settings->GetUnknownVariable(); const Variable<double>& rSurfaceSourceVar = my_settings->GetSurfaceSourceVariable(); //calculate lenght double x21 = GetGeometry()[1].X() - GetGeometry()[0].X(); double y21 = GetGeometry()[1].Y() - GetGeometry()[0].Y(); double lenght = x21*x21 + y21*y21; lenght = sqrt(lenght); const Properties& ConstProp = GetProperties(); const double& ambient_temperature = ConstProp[AMBIENT_TEMPERATURE]; double StefenBoltzmann = 5.67e-8; double emissivity = ConstProp[EMISSIVITY]; double convection_coefficient = ConstProp[CONVECTION_COEFFICIENT]; const double& T0 = GetGeometry()[0].FastGetSolutionStepValue(rUnknownVar); const double& T1 = GetGeometry()[1].FastGetSolutionStepValue(rUnknownVar); const double& q0 =GetGeometry()[0].FastGetSolutionStepValue(rSurfaceSourceVar); const double& q1 =GetGeometry()[1].FastGetSolutionStepValue(rSurfaceSourceVar); if (CalculateStiffnessMatrixFlag == true) //calculation of the matrix is required { if(rLeftHandSideMatrix.size1() != MatSize ) rLeftHandSideMatrix.resize(MatSize,MatSize,false); noalias(rLeftHandSideMatrix) = ZeroMatrix(MatSize,MatSize); rLeftHandSideMatrix(0,0) = ( convection_coefficient + emissivity*StefenBoltzmann*4.0*pow(T0,3) )* 0.5 * lenght; rLeftHandSideMatrix(1,1) = ( convection_coefficient + emissivity*StefenBoltzmann*4.0*pow(T1,3) )* 0.5 * lenght; } //resizing as needed the RHS double aux = pow(ambient_temperature,4); if (CalculateResidualVectorFlag == true) //calculation of the matrix is required { if(rRightHandSideVector.size() != MatSize ) rRightHandSideVector.resize(MatSize,false); rRightHandSideVector[0] = q0 - emissivity*StefenBoltzmann*(pow(T0,4) - aux) - convection_coefficient * ( T0 - ambient_temperature); rRightHandSideVector[1] = q1 - emissivity*StefenBoltzmann*(pow(T1,4) - aux) - convection_coefficient * ( T1 - ambient_temperature); rRightHandSideVector *= 0.5*lenght; } KRATOS_CATCH("") }
void TotalLagrangian::InitializeSolutionStep( ProcessInfo& CurrentProcessInfo ) { for ( unsigned int i = 0; i < mConstitutiveLawVector.size(); i++ ) mConstitutiveLawVector[i]->InitializeSolutionStep( GetProperties(), GetGeometry(), row( GetGeometry().ShapeFunctionsValues( mThisIntegrationMethod ), i ), CurrentProcessInfo ); }
void BeamElement::CalculateMassMatrix(MatrixType& rMassMatrix, ProcessInfo& rCurrentProcessInfo) { KRATOS_TRY unsigned int dimension = GetGeometry().WorkingSpaceDimension(); unsigned int NumberOfNodes = GetGeometry().size(); unsigned int MatSize = dimension * NumberOfNodes; if(rMassMatrix.size1() != MatSize) rMassMatrix.resize(MatSize,MatSize,false); rMassMatrix = ZeroMatrix(MatSize,MatSize); //const double& mlength = GetGeometry().Length(); double TotalMass = mArea*mlength*GetProperties()[DENSITY]; Vector LumpFact; LumpFact = GetGeometry().LumpingFactors(LumpFact); for(unsigned int i=0; i<NumberOfNodes; i++) { double temp = LumpFact[i]*TotalMass; for(unsigned int j=0; j<dimension; j++) { unsigned int index = i*dimension + j; rMassMatrix(index,index) = temp; if (index==3 || index==4 || index==5) rMassMatrix(index,index) = 0.00; } } KRATOS_CATCH("") }
bool CDRMUtils::GetCrtc() { for(auto i = 0; i < m_drm_resources->count_crtcs; i++) { m_crtc->crtc = drmModeGetCrtc(m_fd, m_drm_resources->crtcs[i]); if(m_crtc->crtc->crtc_id == m_encoder->encoder->crtc_id) { CLog::Log(LOGDEBUG, "CDRMUtils::%s - found crtc: %d", __FUNCTION__, m_crtc->crtc->crtc_id); m_crtc_index = i; break; } drmModeFreeCrtc(m_crtc->crtc); m_crtc->crtc = nullptr; } if(!m_crtc->crtc) { CLog::Log(LOGERROR, "CDRMUtils::%s - could not get crtc: %s", __FUNCTION__, strerror(errno)); return false; } if (!GetProperties(m_fd, m_crtc->crtc->crtc_id, DRM_MODE_OBJECT_CRTC, m_crtc)) { CLog::Log(LOGERROR, "CDRMUtils::%s - could not get crtc %u properties: %s", __FUNCTION__, m_crtc->crtc->crtc_id, strerror(errno)); return false; } return true; }
void FdoOdbcOvClassDefinition::AddProperty( FdoRdbmsOvPropertyDefinition* pProp ) { FdoOdbcOvPropertiesP properties = GetProperties(); properties->Add( dynamic_cast<FdoOdbcOvPropertyDefinition*>(pProp) ); }
STDMETHODIMP CStreamSwitcherAllocator::GetBuffer( IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags) { HRESULT hr = VFW_E_NOT_COMMITTED; if (!m_bCommitted) { return hr; } /* TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() + %x\n"), this); m_pPin->m_evBlock.Wait(); TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() - %x\n"), this); */ if (m_fMediaTypeChanged) { if (!m_pPin || !m_pPin->m_pFilter) { return hr; } CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pPin->m_pFilter))->GetOutputPin(); if (!pOut || !pOut->CurrentAllocator()) { return hr; } ALLOCATOR_PROPERTIES Properties, Actual; if (FAILED(pOut->CurrentAllocator()->GetProperties(&Actual))) { return hr; } if (FAILED(GetProperties(&Properties))) { return hr; } if (!m_bCommitted || Properties.cbBuffer < Actual.cbBuffer) { Properties.cbBuffer = Actual.cbBuffer; if (FAILED(Decommit())) { return hr; } if (FAILED(SetProperties(&Properties, &Actual))) { return hr; } if (FAILED(Commit())) { return hr; } ASSERT(Actual.cbBuffer >= Properties.cbBuffer); if (Actual.cbBuffer < Properties.cbBuffer) { return hr; } } } hr = CMemAllocator::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags); if (m_fMediaTypeChanged && SUCCEEDED(hr)) { (*ppBuffer)->SetMediaType(&m_mt); m_fMediaTypeChanged = false; } return hr; }
// Returns the amount if the component parameter is specified. If the component parameter is nil // it returns the definition of the component for the given index. global func GetComponent(id component, int index) { // Safety: can only be called from object or definition context. if (!this || (GetType(this) != C4V_C4Object && GetType(this) != C4V_Def)) return FatalError(Format("GetComponent must be called from object or definition context and not from %v", this)); // Safety: return nil if Components could not be found or are not a proplist. if (!this.Components || GetType(this.Components) != C4V_PropList) return; // If component is specified return the count for that definition. if (GetType(component) == C4V_Def) return this.Components[Format("%i", component)]; // Ensure the index is valid. index = Max(index, 0); // If component is not specified return the definition of the component at the index. var cnt = 0; for (var entry in GetProperties(this.Components)) { // Check if the entry is an actual valid definition. var entry_def = GetDefinition(entry); if (!entry_def) continue; if (index == cnt) return entry_def; cnt++; } return; }
double& AxisymUpdatedLagrangianElement::CalculateTotalMass( double& rTotalMass, const ProcessInfo& rCurrentProcessInfo ) { KRATOS_TRY //Compute the Volume Change acumulated: GeneralVariables Variables; this->InitializeGeneralVariables(Variables,rCurrentProcessInfo); const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( mThisIntegrationMethod ); rTotalMass = 0; //reading integration points for ( unsigned int PointNumber = 0; PointNumber < integration_points.size(); PointNumber++ ) { //compute element kinematics this->CalculateKinematics(Variables,PointNumber); //getting informations for integration double IntegrationWeight = Variables.detJ * integration_points[PointNumber].Weight(); //compute point volume change double PointVolumeChange = 0; PointVolumeChange = this->CalculateVolumeChange( PointVolumeChange, Variables ); rTotalMass += PointVolumeChange * GetProperties()[DENSITY] * 2.0 * 3.141592654 * Variables.CurrentRadius * IntegrationWeight; } return rTotalMass; KRATOS_CATCH( "" ) }
std::vector<UsdProperty> UsdPrim::_GetPropertiesInNamespace(const std::string &namespaces, bool onlyAuthored) const { // XXX Would be nice to someday plumb the prefix search down through pcp if (namespaces.empty()) return onlyAuthored ? GetAuthoredProperties() : GetProperties(); const char delim = UsdObject::GetNamespaceDelimiter(); TfTokenVector names = _GetPropertyNames(onlyAuthored, /*applyOrder=*/false); // Set terminator to the expected position of the delimiter after all the // supplied namespaces. We perform an explicit test for this char below // so that we don't need to allocate a new string if namespaces does not // already end with the delimiter const size_t terminator = namespaces.size() - (*namespaces.rbegin() == delim); // Prune out non-matches before we sort size_t insertionPt = 0; for (const auto& name : names) { const std::string &s = name.GetString(); if (s.size() > terminator && TfStringStartsWith(s, namespaces) && s[terminator] == delim) { names[insertionPt++] = name; } } names.resize(insertionPt); sort(names.begin(), names.end(), TfDictionaryLessThan()); _ApplyOrdering(GetPropertyOrder(), &names); return _MakeProperties(names); }
bool CDRMUtils::GetConnector() { for(auto i = 0; i < m_drm_resources->count_connectors; i++) { m_connector->connector = drmModeGetConnector(m_fd, m_drm_resources->connectors[i]); if(m_connector->connector->connection == DRM_MODE_CONNECTED) { CLog::Log(LOGDEBUG, "CDRMUtils::%s - found connector: %d", __FUNCTION__, m_connector->connector->connector_id); break; } drmModeFreeConnector(m_connector->connector); m_connector->connector = nullptr; } if(!m_connector->connector) { CLog::Log(LOGERROR, "CDRMUtils::%s - could not get connector: %s", __FUNCTION__, strerror(errno)); return false; } if (!GetProperties(m_fd, m_connector->connector->connector_id, DRM_MODE_OBJECT_CONNECTOR, m_connector)) { CLog::Log(LOGERROR, "CDRMUtils::%s - could not get connector %u properties: %s", __FUNCTION__, m_connector->connector->connector_id, strerror(errno)); return false; } return true; }
// Destructor Cluster3D::~Cluster3D() { if (GetProperties()[BREAKABLE_CLUSTER]) { for (unsigned int i = 0; i < mListOfCoordinates.size(); i++) { mListOfSphericParticles[i]->Set(DEMFlags::BELONGS_TO_A_CLUSTER, false); mListOfSphericParticles[i]->GetGeometry()[0].Set(DEMFlags::BELONGS_TO_A_CLUSTER, false); } GetGeometry()[0].Set(TO_ERASE, true); } else{ for (unsigned int i = 0; i < mListOfCoordinates.size(); i++) { mListOfSphericParticles[i]->Set(DEMFlags::BELONGS_TO_A_CLUSTER, false); mListOfSphericParticles[i]->GetGeometry()[0].Set(DEMFlags::BELONGS_TO_A_CLUSTER, false); mListOfSphericParticles[i]->Set(TO_ERASE, true); } } mListOfSphericParticles.clear(); mListOfCoordinates.clear(); mListOfRadii.clear(); if (mpIntegrationScheme!=NULL) { delete mpIntegrationScheme; } }
VtkConditionSource::VtkConditionSource() : _points(NULL), _cond_vec(NULL) { this->SetNumberOfInputPorts(0); const GeoLib::Color* c = GeoLib::getRandomColor(); GetProperties()->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); }
void WidgetStyle::AddExitProperty(UIState st, const NamedProperties& prop) { State state; state.type = STATE_EXIT; state.state1 = st; GetProperties()[state] = prop; }
constexpr BlendFormula(OutputType primaryOut, OutputType secondaryOut, GrBlendEquation equation, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) : fPrimaryOutputType(primaryOut) , fSecondaryOutputType(secondaryOut) , fBlendEquation(equation) , fSrcCoeff(srcCoeff) , fDstCoeff(dstCoeff) , fProps(GetProperties(primaryOut, secondaryOut, equation, srcCoeff, dstCoeff)) {}
VtkPointsSource::VtkPointsSource() : _points(nullptr) { _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); const DataHolderLib::Color c = DataHolderLib::getRandomColor(); GetProperties()->SetColor(c[0] / 255.0,c[1] / 255.0,c[2] / 255.0); }
void Cluster3D::CustomInitialize(ProcessInfo& r_process_info) { const double cl = GetGeometry()[0].FastGetSolutionStepValue(CHARACTERISTIC_LENGTH); const ClusterInformation& cl_info = GetProperties()[CLUSTER_INFORMATION]; //std::string& name = cl_info.mName; const double reference_size = cl_info.mSize; const double reference_volume = cl_info.mVolume; const std::vector<double>& reference_list_of_radii = cl_info.mListOfRadii; const std::vector<array_1d<double,3> >& reference_list_of_coordinates = cl_info.mListOfCoordinates; const array_1d<double,3>& reference_inertias = cl_info.mInertias; const unsigned int number_of_spheres = reference_list_of_radii.size(); mListOfRadii.resize(number_of_spheres); mListOfCoordinates.resize(number_of_spheres); mListOfSphericParticles.resize(number_of_spheres); const double scaling_factor = cl / reference_size; for(int i=0; i<(int)number_of_spheres; i++){ mListOfRadii[i] = scaling_factor * reference_list_of_radii[i]; mListOfCoordinates[i][0] = scaling_factor * reference_list_of_coordinates[i][0]; mListOfCoordinates[i][1] = scaling_factor * reference_list_of_coordinates[i][1]; mListOfCoordinates[i][2] = scaling_factor * reference_list_of_coordinates[i][2]; } const double particle_density = this->SlowGetDensity(); const double cluster_volume = reference_volume * scaling_factor*scaling_factor*scaling_factor; const double cluster_mass = particle_density * cluster_volume; GetGeometry()[0].FastGetSolutionStepValue(NODAL_MASS) = cluster_mass; GetGeometry()[0].FastGetSolutionStepValue(CLUSTER_VOLUME) = cluster_volume; GetGeometry()[0].FastGetSolutionStepValue(PARTICLE_MATERIAL) = this->SlowGetParticleMaterial(); const double squared_scaling_factor_times_density = scaling_factor * scaling_factor * particle_density; GetGeometry()[0].FastGetSolutionStepValue(PRINCIPAL_MOMENTS_OF_INERTIA)[0] = reference_inertias[0] * cluster_volume * squared_scaling_factor_times_density; GetGeometry()[0].FastGetSolutionStepValue(PRINCIPAL_MOMENTS_OF_INERTIA)[1] = reference_inertias[1] * cluster_volume * squared_scaling_factor_times_density; GetGeometry()[0].FastGetSolutionStepValue(PRINCIPAL_MOMENTS_OF_INERTIA)[2] = reference_inertias[2] * cluster_volume * squared_scaling_factor_times_density; array_1d<double, 3> base_principal_moments_of_inertia = GetGeometry()[0].FastGetSolutionStepValue(PRINCIPAL_MOMENTS_OF_INERTIA); Quaternion<double>& Orientation = GetGeometry()[0].FastGetSolutionStepValue(ORIENTATION); Orientation.normalize(); array_1d<double, 3> angular_velocity = GetGeometry()[0].FastGetSolutionStepValue(ANGULAR_VELOCITY); array_1d<double, 3> angular_momentum; double LocalTensor[3][3]; double GlobalTensor[3][3]; GeometryFunctions::ConstructLocalTensor(base_principal_moments_of_inertia, LocalTensor); GeometryFunctions::QuaternionTensorLocal2Global(Orientation, LocalTensor, GlobalTensor); GeometryFunctions::ProductMatrix3X3Vector3X1(GlobalTensor, angular_velocity, angular_momentum); noalias(this->GetGeometry()[0].FastGetSolutionStepValue(ANGULAR_MOMENTUM)) = angular_momentum; array_1d<double, 3> local_angular_velocity; GeometryFunctions::QuaternionVectorGlobal2Local(Orientation, angular_velocity, local_angular_velocity); noalias(this->GetGeometry()[0].FastGetSolutionStepValue(LOCAL_ANGULAR_VELOCITY)) = local_angular_velocity; }
void ezRTTI::GetAllProperties(ezHybridArray<ezAbstractProperty*, 32>& out_Properties) const { out_Properties.Clear(); if (m_pParentType) m_pParentType->GetAllProperties(out_Properties); out_Properties.PushBackRange(GetProperties()); }
VtkPolylinesSource::VtkPolylinesSource() : _polylines(NULL) { _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); const GeoLib::Color* c = GeoLib::getRandomColor(); GetProperties()->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); }
void TotalLagrangian::FinalizeSolutionStep( ProcessInfo& CurrentProcessInfo ) { // std::cout << "in TL: calling FinalizeSolutionStep" << std::endl; for ( unsigned int i = 0; i < mConstitutiveLawVector.size(); i++ ) mConstitutiveLawVector[i]->FinalizeSolutionStep( GetProperties(), GetGeometry(), row( GetGeometry().ShapeFunctionsValues( mThisIntegrationMethod ), i ), CurrentProcessInfo ); }
void cSprite3D::PrepareForRendering() { vSprite3DProperties *prop = GetProperties(); if(!prop) return; prop->Synchronize(this); }
void WidgetStyle::AddTransitionProperty(UIState start, UIState end, const NamedProperties& prop) { State st; st.state1 = start; st.state2 = end; st.type = STATE_TRANSITION; GetProperties()[st] = prop; }
int CPFAOptimize::GetProperties( const map< int, vector< int > >& IntVecMap, const int& iRow, const int& iLine ) { map< int, vector< int > >::const_iterator IntVecMapIt = IntVecMap.find( iRow ); if( IntVecMap.end() == IntVecMapIt ) { return 0; } return GetProperties( IntVecMapIt->second, iLine ); }
global func ApplyBaseQuality() { if (!this.QualitySettings) return false; var properties = GetProperties(this.QualitySettings.Properties); var len = GetLength(properties); for (var i = 0; i < len; ++i) { this[properties[i]] = this.QualitySettings.Properties[properties[i]].Base; } return true; }