Example #1
0
sExpression *apply(sExpression *procOrLambda, sExpression *argument, sEnvironment *env){
  if(isPrimitiveProc(procOrLambda))
  {
    sProc *cfunc = toProc(procOrLambda);
    return applyProc(cfunc, argument);
  }
  else if(isLambdaType(procOrLambda))
  {
    sLambda *lambd = toLambda(procOrLambda);
    sList *body = lambd->body;
    sList *arguments;
    sList *parameters;

    if(isList(argument)){
      //可変長引数のため
      parameters = checkParameters(lambd->parameters, toList(argument));
      arguments = checkArguments(parameters, toList(argument), lambd->isVarArgument);
    }else{
      parameters = lambd->parameters;
      arguments = toList(cons(argument, &sNull));
    }

    sEnvironment *env = extendEnvironment(parameters, arguments, lambd->frame);
    if(isList(car(body))){
      return evalSequence(body, env);
    }else{
      return eval(newExp(body, LIST_TAG), env);
    }
  }
  return &sNull;
}
Foam::autoPtr<Foam::mapDistribute>
Foam::backgroundMeshDecomposition::distributePoints
(
    List<PointType>& points
) const
{
    labelList toProc(processorPosition(points));

    autoPtr<mapDistribute> map(buildMap(toProc));

    map().distribute(points);

    return map;
}
void domainScalingFvPatchField<Type>::initInterfaceMatrixUpdate
(
    const scalarField& psiInternal,
    scalarField&,
    const lduMatrix&,
    const scalarField&,
    const direction,
    const bool bufferdTransfer
) const
{
    if(Pstream::parRun())
    {
    
      labelList globalIndex;

      //this should be global size
      scalarField globalField(domainScalingPatch_.shadow().size(),0.0);

    
      scalarField neighbourField = mag(patchNeighbourField());
          
      forAll(neighbourField , facei)
      {
          label globalface = globalIndex[facei];
          globalField[globalface] = neighbourField[facei];
      }

      for(
               int slave = 0;
               slave <= Pstream::lastSlave();
                slave++
         )
      {
         
          OPstream toProc(slave);

          toProc << globalField;
             
      }
   }