void Foam::variableHeightFlowRateFvPatchScalarField::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }

    const fvsPatchField<scalar>& phip =
        patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);

    scalargpuField alphap(this->patchInternalField());

    thrust::transform(phip.begin(),phip.end(),alphap.begin(),
                      thrust::make_zip_iterator(thrust::make_tuple(this->refValue().begin(),this->valueFraction().begin())),
                      variableHeightFlowRateUpdateCoeffs(lowerBound_,upperBound_));
/*
    forAll(phip, i)
    {
        if (phip[i] < -SMALL)
        {
            if (alphap[i] < lowerBound_)
            {
                this->refValue()[i] = 0.0;
            }
            else if (alphap[i] > upperBound_)
            {
                this->refValue()[i] = 1.0;
            }
            else
            {
                this->refValue()[i] = alphap[i];
            }

            this->valueFraction()[i] = 1.0;
        }
        else
        {
            this->refValue()[i] = 0.0;
            this->valueFraction()[i] = 0.0;
        }
    }
*/
    mixedFvPatchScalarField::updateCoeffs();
}
void Foam::variableHeightFlowRateFvPatchScalarField::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }

    const fvsPatchField<scalar>& phip =
        patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);

    scalarField alphap(this->patchInternalField());


    forAll(phip, i)
    {
        if (phip[i] < -small)
        {
            if (alphap[i] < lowerBound_)
            {
                this->refValue()[i] = 0.0;
            }
            else if (alphap[i] > upperBound_)
            {
                this->refValue()[i] = 1.0;
            }
            else
            {
                this->refValue()[i] = alphap[i];
            }

            this->valueFraction()[i] = 1.0;
        }
        else
        {
            this->refValue()[i] = 0.0;
            this->valueFraction()[i] = 0.0;
        }
    }

    mixedFvPatchScalarField::updateCoeffs();
}
Beispiel #3
0
/* Figure out a suitable encoding for BUFFER of LENGTH.
   Returns: 0 = Binary
            1 = String possible
            2 = Token possible
*/
static int
suitable_encoding (const unsigned char *buffer, size_t length)
{
  const unsigned char *s;
  int maybe_token = 1;

  if (!length)
    return 1;

  for (s=buffer; length; s++, length--)
    {
      if ( (*s < 0x20 || (*s >= 0x7f && *s <= 0xa0))
           && !strchr ("\b\t\v\n\f\r\"\'\\", *s))
        return 0; /*binary*/
      if ( maybe_token
           && !alphap (s) && !digitp (s)  && !strchr (TOKEN_SPECIALS, *s))
        maybe_token = 0;
    }
  s = buffer;
  if ( maybe_token && !digitp (s) )
    return 2;
  return 1;
}