static void e3(void)
{
  {
    if (scan_test_set(NULL, &rdp_e3_0_first, NULL))
    {
      e4();
    }
    else
    if (scan_test(NULL, RDP_T_43 /* + */, NULL))
    {
      scan_test(NULL, RDP_T_43 /* + */, &e3_stop);
      scan_();
      e3();
    }
    else
    if (scan_test(NULL, RDP_T_45 /* - */, NULL))
    {
      scan_test(NULL, RDP_T_45 /* - */, &e3_stop);
      scan_();
      e3();
    }
    else
      scan_test_set(NULL, &e3_first, &e3_stop)    ;
    scan_test_set(NULL, &e3_stop, &e3_stop);
   }
}
Example #2
0
static void e3(rdp_tree_node_data* rdp_tree)
{
  {
    if (scan_test_set(NULL, &rdp_e3_0_first, NULL))
    {
      if(rdp_tree_update) {rdp_tree->id = "e4"; rdp_tree->token = 0;}
e4(rdp_tree);
    }
    else
    if (scan_test(NULL, RDP_T_43 /* + */, NULL))
    {
      scan_test(NULL, RDP_T_43 /* + */, &e3_stop);
      scan_();
      e3(rdp_add_child("e3", rdp_tree));
    }
    else
    if (scan_test(NULL, RDP_T_45 /* - */, NULL))
    {
      if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data));
      scan_test(NULL, RDP_T_45 /* - */, &e3_stop);
      scan_();
      e3(rdp_add_child("e3", rdp_tree));
    }
    else
      scan_test_set(NULL, &e3_first, &e3_stop)    ;
    scan_test_set(NULL, &e3_stop, &e3_stop);
   }
}
static void e2(void)
{
  {
    e3();
    if (scan_test_set(NULL, &rdp_e2_2_first, NULL))
    { /* Start of rdp_e2_2 */
      while (1)
      {
        {
          if (scan_test(NULL, RDP_T_42 /* * */, NULL))
          {
            scan_test(NULL, RDP_T_42 /* * */, &e2_stop);
            scan_();
            e3();
          }
          else
          if (scan_test(NULL, RDP_T_47 /* / */, NULL))
          {
            scan_test(NULL, RDP_T_47 /* / */, &e2_stop);
            scan_();
            e3();
          }
          else
            scan_test_set(NULL, &rdp_e2_2_first, &e2_stop)          ;
          }
        if (!scan_test_set(NULL, &rdp_e2_2_first, NULL)) break;
      }
    } /* end of rdp_e2_2 */
    scan_test_set(NULL, &e2_stop, &e2_stop);
   }
}
Example #4
0
static integer e3(void)
{
  integer result;
  {
    if (scan_test(NULL, RDP_T_43 /* + */, NULL))
    {
      scan_test(NULL, RDP_T_43 /* + */, &e3_stop);
      scan_();
      result = e3();
    }
    else
    if (scan_test(NULL, RDP_T_45 /* - */, NULL))
    {
      scan_test(NULL, RDP_T_45 /* - */, &e3_stop);
      scan_();
      result = e3();
       result = -result; 
    }
    else
    if (scan_test_set(NULL, &rdp_e3_2_first, NULL))
    {
      result = e4();
    }
    else
      scan_test_set(NULL, &e3_first, &e3_stop)    ;
    scan_test_set(NULL, &e3_stop, &e3_stop);
   }
  return result;
}
Example #5
0
static int 
e2(void)
{
	if (eq(nxtarg(0), "!"))
		return(!e3());
	ap--;
	return(e3());
}
Example #6
0
File: if.c Project: quajo/v6shell
static bool
e2(void)
{

	if (equal(nxtarg(RETERR), "!"))
		return !e3();
	ap--;
	return e3();
}
Example #7
0
/* <e3> ( != | == | < | > ) <e4> */
static Expression *e4(void) {
  Expression *left = e3();
  enum EKind kind;

  if (isEqEq()) {
    kind = eEQ;
  } else if (isLt()) {
    kind = eLT;
  } else if (isGt()) {
    kind = eGT;
  } else if (isNe()) {
    kind = eNE;
  } else {
    return left;
  }

  consume();

  Expression *e = NEW(Expression);

  e->kind = kind;
  e->left = left;
  e->right = e4();
  return e;
}
std::vector<Domain>
AbstractDomainPropertyTest<Domain>::non_extremal_values() {
  Domain e1("a");
  Domain e2({"a", "b", "c"});
  Domain e3({"b", "c", "d"});
  return {e1, e2, e3};
}
Example #9
0
void Blocks::run () {
    long elementsX = width/size;
    long elementsY = height/size;
    int IDCounter = 0;
    for (int i = 0; i < elementsX-1; i++) {
        for (int j = 0; j < elementsY-1; j++) {
            //Points at the Edge
            Point p1(i*size, j*size, 0);
            Point p2((i+1)*size, j*size, 0);
            Point p3((i+1)*size, (j+1)*size, 0);
            Point p4(i*size, (j+1)*size, 0);            std::vector<Point> edgePoints;

            edgePoints.push_back(p1);
            edgePoints.push_back(p2);
            edgePoints.push_back(p3);
            edgePoints.push_back(p4);


            //Create Edges
            Edge e1(0,1);
            Edge e2(1,2);
            Edge e3(2,3);
            Edge e4(3,0);

            std::vector<Edge> edges;
            edges.push_back(e1);
            edges.push_back(e2);
            edges.push_back(e3);
            edges.push_back(e4);

            //Cretae Face
            std::vector<long> f;
            f.push_back(0);
            f.push_back(1);
            f.push_back(2);
            f.push_back(3);

            Face face(f);
            std::vector<Face> faces;
            faces.push_back(face);

            Point centerPoint((i+0.5)*size, (j+0.5)*size, 0);
            std::vector<Point> centerPoints;
            centerPoints.push_back(centerPoint);

            std::stringstream name;
            name << "Block_" << IDCounter;
            block->setPoints(name.str(), edgePoints);
            block->setEdges(name.str(), edges);
            block->setFaces(name.str(), faces);

            name.clear();
            name << "BlockCenterPoint_" << IDCounter;
            block->setPoints(name.str(), centerPoints);

            IDCounter++;
        }
    }

}
void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
{
    if (subDict)
    {
        os  << indent << name_ << nl
            << indent << token::BEGIN_BLOCK << incrIndent << nl;
    }

    // only write type for derived types
    if (type() != typeName_())
    {
        os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
    }

    // The note entry is optional
    if (note_.size())
    {
        os.writeKeyword("note") << note_ << token::END_STATEMENT << nl;
    }

    os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
    os.writeKeyword("e1") << e1() << token::END_STATEMENT << nl;
    os.writeKeyword("e3") << e3() << token::END_STATEMENT << nl;

    if (subDict)
    {
        os  << decrIndent << indent << token::END_BLOCK << endl;
    }
}
Example #11
0
    Py::Object removeSvgTags(const Py::Tuple& args)
    {
        const char* svgcode;
        if (!PyArg_ParseTuple(args.ptr(), "s",&svgcode))
            throw Py::Exception();

        std::string svg(svgcode);
        std::string empty = "";
        std::string endline = "--endOfLine--";
        std::string linebreak = "\\n";
        // removing linebreaks for regex to work
        boost::regex e1 ("\\n");
        svg = boost::regex_replace(svg, e1, endline);
        // removing starting xml definition
        boost::regex e2 ("<\\?xml.*?\\?>");
        svg = boost::regex_replace(svg, e2, empty);
        // removing starting svg tag
        boost::regex e3 ("<svg.*?>");
        svg = boost::regex_replace(svg, e3, empty);
        // removing sodipodi tags -- DANGEROUS, some sodipodi tags are single, better leave it
        //boost::regex e4 ("<sodipodi.*?>");
        //svg = boost::regex_replace(svg, e4, empty);
        // removing metadata tags
        boost::regex e5 ("<metadata.*?</metadata>");
        svg = boost::regex_replace(svg, e5, empty);
        // removing closing svg tags
        boost::regex e6 ("</svg>");
        svg = boost::regex_replace(svg, e6, empty);
        // restoring linebreaks
        boost::regex e7 ("--endOfLine--");
        svg = boost::regex_replace(svg, e7, linebreak);
        Py::String result(svg);
        return result;
    }
Example #12
0
bool ElasticBeam::initElement (const std::vector<int>& MNPC,
                               const FiniteElement& fe, const Vec3&, size_t,
                               LocalIntegral& elmInt)
{
  if (!this->initElement(MNPC,elmInt))
    return false;

  Vec3 e1 = fe.XC[1] - fe.XC[0]; // Initial local X-axis
  const Vector& eV = elmInt.vec.front();
  if (!eV.empty())
  {
    // Fetch nodal displacements
    Vec3 U0(eV.ptr());
    Vec3 U1(eV.ptr()+eV.size()-npv);
    e1 += U1 - U0; // Deformed local X-axis
  }

  // Calculate the co-rotated element coordinate system
  if (e1.normalize() <= 1.0e-8)
  {
    std::cerr <<" *** ElasticBeam::initElement: Zero beam length"<< std::endl;
    return false;
  }

  if (fe.Tn.size() < 2)
  {
    std::cerr <<" *** ElasticBeam::initElement: No end rotations"<< std::endl;
    return false;
  }

  Vec3 e2(fe.Tn[0][1]+fe.Tn[1][1]); // Sum of the nodal Y-axes
  Vec3 e3(fe.Tn[0][2]+fe.Tn[1][2]); // Sum of the nodal Z-axes
  if (e3*e1 < e2*e1)
  {
    e2.cross(e3,e1); // Local Y-axis = e3xe1 / |e3xe1|
    e2.normalize();
    e3.cross(e1,e2); // Local Z-axis = e1xe2
  }
  else
  {
    e3.cross(e1,e2); // Local Z-axis = e1xe2 / |e1xe2|
    e3.normalize();
    e2.cross(e3,e1); // Local Y-axis = e3xe1
  }

  Matrix& Tlg = this->getLocalAxes(elmInt);
  Tlg.fillColumn(1,e1.ptr());
  Tlg.fillColumn(2,e2.ptr());
  Tlg.fillColumn(3,e3.ptr());

#if INT_DEBUG > 1
  std::cout <<"ElasticBeam: local-to-global transformation matrix:"<< Tlg
            <<"ElasticBeam: T1n\n"<< fe.Tn[0] <<"ElasticBeam: T2n\n"<< fe.Tn[1];
#endif

  return true;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void StatsGenODFWidget::extractStatsData(int index, StatsData* statsData, unsigned int phaseType)
{
  VectorOfFloatArray arrays;
  if(phaseType == DREAM3D::PhaseType::PrimaryPhase)
  {
    PrimaryStatsData* pp = PrimaryStatsData::SafePointerDownCast(statsData);
    arrays = pp->getODF_Weights();
  }
  if(phaseType == DREAM3D::PhaseType::PrecipitatePhase)
  {
    PrecipitateStatsData* pp = PrecipitateStatsData::SafePointerDownCast(statsData);
    arrays = pp->getODF_Weights();
  }
  if(phaseType == DREAM3D::PhaseType::TransformationPhase)
  {
    TransformationStatsData* tp = TransformationStatsData::SafePointerDownCast(statsData);
    arrays = tp->getODF_Weights();
  }
  if (arrays.size() > 0)
  {
    QVector<float> e1(static_cast<int>(arrays[0]->getNumberOfTuples()));
    ::memcpy( e1.data(), arrays[0]->getVoidPointer(0), sizeof(float)*e1.size() );

    QVector<float> e2(static_cast<int>(arrays[1]->getNumberOfTuples()));
    ::memcpy( e2.data(), arrays[1]->getVoidPointer(0), sizeof(float)*e2.size() );

    QVector<float> e3(static_cast<int>(arrays[2]->getNumberOfTuples()));
    ::memcpy( e3.data(), arrays[2]->getVoidPointer(0), sizeof(float)*e3.size() );

    QVector<float> weights(static_cast<int>(arrays[3]->getNumberOfTuples()));
    ::memcpy( weights.data(), arrays[3]->getVoidPointer(0), sizeof(float)*weights.size() );

    QVector<float> sigmas(static_cast<int>(arrays[4]->getNumberOfTuples()));
    ::memcpy( sigmas.data(), arrays[4]->getVoidPointer(0), sizeof(float)*sigmas.size() );

    // Convert from Radians to Degrees for the Euler Angles
    for(int i = 0; i < e1.size(); ++i)
    {
      e1[i] = e1[i] * 180.0f / M_PI;
      e2[i] = e2[i] * 180.0f / M_PI;
      e3[i] = e3[i] * 180.0f / M_PI;
    }

    if(e1.size() > 0)
    {
      // Load the data into the table model
      m_ODFTableModel->setTableData(e1, e2, e3, weights, sigmas);
    }
  }
  // Write the MDF Data if we have that functionality enabled
  if (m_MDFWidget != NULL)
  {
    m_MDFWidget->extractStatsData(index, statsData, phaseType);
  }
  updatePlots();
}
Example #14
0
void Mesh::FindAdjacencies(const aiMesh* paiMesh, vector<unsigned int>& Indices)
{       
    // Step 1 - find the two triangles that share every edge
    for (uint i = 0 ; i < paiMesh->mNumFaces ; i++) {
        const aiFace& face = paiMesh->mFaces[i];

        Face Unique;
        
        // If a position vector is duplicated in the VB we fetch the 
        // index of the first occurrence.
        for (uint j = 0 ; j < 3 ; j++) {            
            uint Index = face.mIndices[j];
            aiVector3D& v = paiMesh->mVertices[Index];
            
            if (m_posMap.find(v) == m_posMap.end()) {
                m_posMap[v] = Index;
            }
            else {
                Index = m_posMap[v];
            }           
            
            Unique.Indices[j] = Index;
        }
        
        m_uniqueFaces.push_back(Unique);
        
        Edge e1(Unique.Indices[0], Unique.Indices[1]);
        Edge e2(Unique.Indices[1], Unique.Indices[2]);
        Edge e3(Unique.Indices[2], Unique.Indices[0]);
        
        m_indexMap[e1].AddNeigbor(i);
        m_indexMap[e2].AddNeigbor(i);
        m_indexMap[e3].AddNeigbor(i);
    }   

    // Step 2 - build the index buffer with the adjacency info
    for (uint i = 0 ; i < paiMesh->mNumFaces ; i++) {        
        const Face& face = m_uniqueFaces[i];
        
        for (uint j = 0 ; j < 3 ; j++) {            
            Edge e(face.Indices[j], face.Indices[(j + 1) % 3]);
            assert(m_indexMap.find(e) != m_indexMap.end());
            Neighbors n = m_indexMap[e];
            uint OtherTri = n.GetOther(i);
            
            assert(OtherTri != -1);

            const Face& OtherFace = m_uniqueFaces[OtherTri];
            uint OppositeIndex = OtherFace.GetOppositeIndex(e);
         
            Indices.push_back(face.Indices[j]);
            Indices.push_back(OppositeIndex);             
        }
    }    
}
/* ****************************************************************************
*
* all - 
*/
TEST(OrionError, all)
{
  StatusCode    sc(SccBadRequest, "no details 2");
  OrionError    e0;
  OrionError    e1(SccOk, "no details 3");
  OrionError    e3(sc);
  OrionError    e4(SccOk, "Good Request");
  std::string   out;
  const char*   outfile1 = "orion.orionError.all1.valid.xml";
  const char*   outfile2 = "orion.orionError.all1.valid.json";
  const char*   outfile5 = "orion.orionError.all3.valid.xml";
  const char*   outfile6 = "orion.orionError.all3.valid.json";
  const char*   outfile7 = "orion.orionError.all4.valid.xml";
  const char*   outfile8 = "orion.orionError.all4.valid.json";

  EXPECT_EQ(SccNone, e0.code);
  EXPECT_EQ("",      e0.reasonPhrase);
  EXPECT_EQ("",      e0.details);

  EXPECT_EQ(SccOk,          e1.code);
  EXPECT_EQ("OK",           e1.reasonPhrase);
  EXPECT_EQ("no details 3", e1.details);

  EXPECT_EQ(sc.code,         e3.code);
  EXPECT_EQ(sc.reasonPhrase, e3.reasonPhrase);
  EXPECT_EQ(sc.details,      e3.details);

  EXPECT_EQ(SccOk,          e4.code);
  EXPECT_EQ("OK",           e4.reasonPhrase);
  EXPECT_EQ("Good Request", e4.details);

  out = e1.render(XML, "");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  out = e3.render(XML, "");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile5)) << "Error getting test data from '" << outfile5 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  out = e4.render(XML, "");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile7)) << "Error getting test data from '" << outfile7 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  out = e1.render(JSON, "");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  out = e3.render(JSON, "");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile6)) << "Error getting test data from '" << outfile6 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  out = e4.render(JSON, "");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile8)) << "Error getting test data from '" << outfile8 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());
}
Example #16
0
File: dll-9a.c Project: 0day-ci/gcc
int main () {
  i1();
  i3();
  i4();
  i5();

  e1();
  e3();
  e4();
  e5();
}
    void init_from_periods(int n, cplx tau1, cplx tau2) {
        process_periods(tau1, tau2);

        cplx q(std::exp(tau_*cplx(0, M_PI)));
        cplx q2(q*q);

        /* e1 */

        cplx e1(0.0);
        for (cplx q2k(q2); ; q2k *= q2) {
            cplx t1(1.0 + q2k);
            cplx t2(1.0 - q2k);
            cplx term(q2k*(1.0/(t1*t1) + 1.0/(t2*t2)));

            if (std::abs(term) <= 1e-10) break;

            e1 += term;
        }

        e1 = (e1*8.0 + 2.0/3)*M_PI*M_PI;

        /* e2 */

        cplx e2(0.0);
        cplx qk;
        double s = -1;
        for (qk = q, s = -1; ; qk *= q, s = -s) {
            cplx t1(1.0 - qk);
            cplx term(s*qk/(t1*t1));

            if (std::abs(term) <= 1e-10) break;
        
            e2 += term;
        }

        e2 = (e2*8.0 - 1.0/3)*M_PI*M_PI;

        /* e3 */

        cplx e3(0.0);
        for (qk = q, s = -1; ; qk *= q, s = -s) {
            cplx t1(1.0 - s*qk);
            cplx term(qk/(t1*t1));

            if (std::abs(term) <= 1e-10) break;
        
            e3 += term;
        }
        
        e3 = (e3*8.0 - 1.0/3)*M_PI*M_PI;

        init(n, e1, e2, e3);
    }
/* ****************************************************************************
*
* all -
*/
TEST(OrionError, all)
{
  StatusCode    sc(SccBadRequest, "no details 2");
  OrionError    e0;
  OrionError    e1(SccOk, "no details 3");
  OrionError    e3(sc);
  OrionError    e4(SccOk, "Good Request");
  std::string   out;
  const char*   outfile1 = "orion.orionError.all1.valid.json";
  const char*   outfile2 = "orion.orionError.all3.valid.json";
  const char*   outfile3 = "orion.orionError.all4.valid.json";
  ConnectionInfo ci;

  ci.outMimeType = JSON;

  EXPECT_EQ(SccNone, e0.code);
  EXPECT_EQ("",      e0.reasonPhrase);
  EXPECT_EQ("",      e0.details);

  EXPECT_EQ(SccOk,          e1.code);
  EXPECT_EQ("OK",           e1.reasonPhrase);
  EXPECT_EQ("no details 3", e1.details);

  EXPECT_EQ(sc.code,         e3.code);
  EXPECT_EQ(sc.reasonPhrase, e3.reasonPhrase);
  EXPECT_EQ(sc.details,      e3.details);

  EXPECT_EQ(SccOk,          e4.code);
  EXPECT_EQ("OK",           e4.reasonPhrase);
  EXPECT_EQ("Good Request", e4.details);

  ci.outMimeType = JSON;

  out = e1.toJsonV1();
  EXPECT_EQ("OK", testDataFromFile(expectedBuf,
                                   sizeof(expectedBuf),
                                   outfile1)) << "Error getting test data from '" << outfile1 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  out = e3.toJsonV1();
  EXPECT_EQ("OK", testDataFromFile(expectedBuf,
                                   sizeof(expectedBuf),
                                   outfile2)) << "Error getting test data from '" << outfile2 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  out = e4.toJsonV1();
  EXPECT_EQ("OK", testDataFromFile(expectedBuf,
                                   sizeof(expectedBuf),
                                   outfile3)) << "Error getting test data from '" << outfile3 << "'";

  EXPECT_STREQ(expectedBuf, out.c_str());
}
TEST(generateExpression, binary_op) {
  static const bool user_facing = true;
  std::stringstream msgs;

  stan::lang::expression e1 = stan::lang::int_literal(5);
  stan::lang::double_literal b(-2.0);
  b.string_ = "-2.0";
  stan::lang::expression e2(b);
  stan::lang::expression e3(stan::lang::binary_op(e1,"+",e2));

  generate_expression(e3, user_facing, msgs);
  EXPECT_EQ(msgs.str(), "(5 + -2.0)");
}
Example #20
0
int main()
{
    H e1, e2(6), e3(3, 8);

    e1.display();
    e2.display();
    e3.display();

    H e4 = e3;

    e4.display();
    return 0;
}
Example #21
0
static integer e2(void)
{
  integer result;
  integer right;
  {
    result = e3();
    if (scan_test_set(NULL, &rdp_e2_2_first, NULL))
    { /* Start of rdp_e2_2 */
      while (1)
      {
        {
          if (scan_test(NULL, RDP_T_42 /* * */, NULL))
          {
            scan_test(NULL, RDP_T_42 /* * */, &e2_stop);
            scan_();
            right = e3();
             result *= right; 
          }
          else
          if (scan_test(NULL, RDP_T_47 /* / */, NULL))
          {
            scan_test(NULL, RDP_T_47 /* / */, &e2_stop);
            scan_();
            right = e3();
             if (result == 0)       \
                               text_message(TEXT_FATAL_ECHO, "Divide by zero attempted\n"); \
                             else result /= right; \
                          
          }
          else
            scan_test_set(NULL, &rdp_e2_2_first, &e2_stop)          ;
          }
        if (!scan_test_set(NULL, &rdp_e2_2_first, NULL)) break;
      }
    } /* end of rdp_e2_2 */
    scan_test_set(NULL, &e2_stop, &e2_stop);
   }
  return result;
}
Example #22
0
int main()
{
  graph_node<std::string> n1("A"), n2("B"), n3("C");
  graph_edge<std::string> e1(n1, n2, 3.0), e2(n1, n3, 1.47), e3(n2, n1, 3.0);

  std::cout << std::hash<graph_edge<std::string>>()(e1) << '\n';
  std::cout << std::hash<graph_edge<std::string>>()(e3) << '\n';
  std::cout << std::hash<graph_edge<std::string>>()(e2) << '\n';

  if (e1 == e3) {
    std::cout << "e1 == e3\n";
  }
}
Example #23
0
static void e2(rdp_tree_node_data* rdp_tree)
{
  {
    if(rdp_tree_update) {rdp_tree->id = "e3"; rdp_tree->token = 0;}
e3(rdp_tree);
    if (scan_test_set(NULL, &rdp_e2_2_first, NULL))
    { /* Start of rdp_e2_2 */
      while (1)
      {
        {
          if (scan_test(NULL, RDP_T_42 /* * */, NULL))
          {
            if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree);
            scan_test(NULL, RDP_T_42 /* * */, &e2_stop);
            scan_();
            e3(rdp_add_child("e3", rdp_tree));
          }
          else
          if (scan_test(NULL, RDP_T_47 /* / */, NULL))
          {
            if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree);
            scan_test(NULL, RDP_T_47 /* / */, &e2_stop);
            scan_();
            e3(rdp_add_child("e3", rdp_tree));
          }
          else
            scan_test_set(NULL, &rdp_e2_2_first, &e2_stop)          ;
          }
        if (!scan_test_set(NULL, &rdp_e2_2_first, NULL)) break;
      }
    } /* end of rdp_e2_2 */
    else
    {
      /* default action processing for rdp_e2_2*/
      if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;}
    }
    scan_test_set(NULL, &e2_stop, &e2_stop);
   }
}
void Foam::myHeatFluxFvPatchVectorField::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }

    // VARIABLEN/FELDER
    scalarField sn(patch().size()),
                st(patch().size()),
                sct(patch().size()),
                gt(patch().size());
    vectorField t(patch().size()),
                n(patch().size());
    vectorField& s = *this;

    // Berechnung von Richtungen
    n = this->patch().nf();
//    for(int i=0; i<g0.size(); i++){
//        if(mag(g0[i]) == 0)
//            t[i] = vector(0,0,0);
//        else
//            t[i] = g0[i]/mag(g0[i]);
//    }
    for(int i=0; i<n.size(); i++){
        const vector vec = n[i];
        t[i] = vector(vec.y(),-vec.x(),0);
    }

    // Betrag in normalen Richtung n
    const volScalarField& internalTheta = db().lookupObject<volScalarField>("Theta");
    const label patchID = patch().boundaryMesh().findPatchID(patch().name());
    scalarField boundaryTheta = internalTheta.boundaryField()[patchID];
    boundaryTheta = OFinterpolate(patch(), db(), boundaryTheta);
    sn = alpha * (boundaryTheta - Theta_wall);

    // Betrag in tangentiale Richtung t (Approximation durch einseitige FD)
    vector e1(1,0,0);
    vector e2(0,1,0);
    vector e3(0,0,1);
    vectorField sc = this->patchInternalField();
    scalarField d = 1.0/this->patch().deltaCoeffs();
    gt  = ( (g0 ^ n) & e3 );
    sct = ( (sc ^ n) & e3 );
    st = ( sct - d*gt ) / ( 1 + d*gamma );

    // gesamter Wärmestrom s
    s = sn*n + st*t;

    fixedValueFvPatchVectorField::updateCoeffs();
}
void
DsrSendBuffTest::DoRun ()
{
  q.SetMaxQueueLen (32);
  NS_TEST_EXPECT_MSG_EQ (q.GetMaxQueueLen (), 32, "trivial");
  q.SetSendBufferTimeout (Seconds (10));
  NS_TEST_EXPECT_MSG_EQ (q.GetSendBufferTimeout (), Seconds (10), "trivial");

  Ptr<const Packet> packet = Create<Packet> ();
  Ipv4Address dst1 = Ipv4Address ("0.0.0.1");
  dsr::SendBuffEntry e1 (packet, dst1, Seconds (1));
  q.Enqueue (e1);
  q.Enqueue (e1);
  q.Enqueue (e1);
  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.1")), true, "trivial");
  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("1.1.1.1")), false, "trivial");
  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 1, "trivial");
  q.DropPacketWithDst (Ipv4Address ("0.0.0.1"));
  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.1")), false, "trivial");
  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 0, "trivial");

  Ipv4Address dst2 = Ipv4Address ("0.0.0.2");
  dsr::SendBuffEntry e2 (packet, dst2, Seconds (1));
  q.Enqueue (e1);
  q.Enqueue (e2);
  Ptr<Packet> packet2 = Create<Packet> ();
  dsr::SendBuffEntry e3 (packet2, dst2, Seconds (1));
  NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("0.0.0.3"), e3), false, "trivial");
  NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("0.0.0.2"), e3), true, "trivial");
  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.2")), false, "trivial");
  q.Enqueue (e2);
  q.Enqueue (e3);
  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");
  Ptr<Packet> packet4 = Create<Packet> ();
  Ipv4Address dst4 = Ipv4Address ("0.0.0.4");
  dsr::SendBuffEntry e4 (packet4, dst4, Seconds (20));
  q.Enqueue (e4);
  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial");
  q.DropPacketWithDst (Ipv4Address ("0.0.0.4"));
  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");

  CheckSizeLimit ();

  Simulator::Schedule (q.GetSendBufferTimeout () + Seconds (1), &DsrSendBuffTest::CheckTimeout, this);

  Simulator::Run ();
  Simulator::Destroy ();
}
TEST(generateExpression, conditional_op) {
  static const bool user_facing = true;
  std::stringstream msgs;

  stan::lang::expression e1 = stan::lang::int_literal(5);
  stan::lang::double_literal a(2.0);
  a.string_ = "2.0";
  stan::lang::expression e2(a);
  stan::lang::double_literal b(-2.0);
  b.string_ = "-2.0";
  stan::lang::expression e3(b);
  stan::lang::expression e4(stan::lang::conditional_op(e1,e2,e3));

  generate_expression(e4, user_facing, msgs);
  EXPECT_EQ(msgs.str(), "(5 ? 2.0 : -2.0 )");
}
Example #27
0
int test_main(int,char *[])
{
    bu::quantity<mixed_length> a1(2.0 * mixed_length());
    bu::quantity<si_area> a2(a1);

    BOOST_CHECK((std::abs(a2.value() - .02) < .0001));

    bu::quantity<mixed_length> a3(a2);

    BOOST_CHECK((std::abs(a3.value() - 2.0) < .0001));

    bu::quantity<mixed_energy_1> e1(2.0 * mixed_energy_1());
    bu::quantity<mixed_energy_2> e2(e1);

    BOOST_CHECK((std::abs(e2.value() - 20.0) < .0001));

    bu::quantity<bu::si::energy> e3(e1);
    BOOST_CHECK((std::abs(e3.value() - .0002) < .0001));
    bu::quantity<mixed_energy_2> e4(e3);
    BOOST_CHECK((std::abs(e4.value() - 20.0) < .0001));

    bu::quantity<bu::cgs::force> F0 = 20 * bu::cgs::dyne;
    BOOST_CHECK((std::abs(F0.value() - 20.0) < .0001));

    bu::quantity<bu::si::force> F3(F0);
    BOOST_CHECK((std::abs(F3.value() - 2.0e-4) < .000000001));

    bu::quantity<bu::si::force> F5(20 * bu::cgs::dyne);
    BOOST_CHECK((std::abs(F5.value() - 2.0e-4) < .000000001));

    bu::quantity<bu::si::dimensionless> dimensionless_test1(1.0*bu::cgs::dyne/bu::si::newton);
    BOOST_CHECK(dimensionless_test1 == 1e-5);

    typedef bu::multiply_typeof_helper<bu::si::length, bu::cgs::length>::type m_cm;
    typedef bu::divide_typeof_helper<m_cm, m_cm>::type heterogeneous_dimensionless;
    bu::quantity<heterogeneous_dimensionless> dimensionless_test2(1.0*bu::cgs::dyne/bu::si::newton);
    BOOST_CHECK(dimensionless_test2.value() == 1e-5);
    bu::quantity<bu::divide_typeof_helper<bu::cgs::force, bu::si::force>::type> dimensionless_test3(dimensionless_test2);
    BOOST_UNITS_CHECK_CLOSE(dimensionless_test3.value(), 1.0);

    //m/cm -> g/kg
    bu::quantity<bu::divide_typeof_helper<bu::si::length, bu::cgs::length>::type> dimensionless_test4(2.0 * bu::si::meters / bu::cgs::centimeters);
    bu::quantity<bu::divide_typeof_helper<bu::cgs::mass, bu::si::mass>::type> dimensionless_test5(dimensionless_test4);
    BOOST_UNITS_CHECK_CLOSE(dimensionless_test5.value(), 2e5);

    return(0);
}
Example #28
0
int f4()
{
    try
    {
        throw 42;
    }
    catch (long & e)
    {
        e2(e);
    }
    catch (...)
    {
        e3();
    }

    return 2;
}
const FloatMatrix *
TrPlaneStrRot3d :: computeGtoLRotationMatrix()
// Returns the rotation matrix of the receiver of the size [3,3]
// coords(local) = T * coords(global)
//
// local coordinate (described by vector triplet e1',e2',e3') is defined as follows:
//
// e1'    : [N2-N1]    Ni - means i - th node
// help   : [N3-N1]
// e3'    : e1' x help
// e2'    : e3' x e1'
{
    if ( GtoLRotationMatrix == NULL ) {
        int i;
        FloatArray e1(3), e2(3), e3(3), help(3);

        // compute e1' = [N2-N1]  and  help = [N3-N1]
        for ( i = 1; i <= 3; i++ ) {
            e1.at(i) = ( this->giveNode(2)->giveCoordinate(i) - this->giveNode(1)->giveCoordinate(i) );
            help.at(i) = ( this->giveNode(3)->giveCoordinate(i) - this->giveNode(1)->giveCoordinate(i) );
        }

        // let us normalize e1'
        e1.normalize();

        // compute e3' : vector product of e1' x help
        e3.beVectorProductOf(e1,help);
        // let us normalize
        e3.normalize();

        // now from e3' x e1' compute e2'
        e2.beVectorProductOf(e3,e1);

        //
        GtoLRotationMatrix = new FloatMatrix(3, 3);

        for ( i = 1; i <= 3; i++ ) {
            GtoLRotationMatrix->at(1, i) = e1.at(i);
            GtoLRotationMatrix->at(2, i) = e2.at(i);
            GtoLRotationMatrix->at(3, i) = e3.at(i);
        }
    }

    return GtoLRotationMatrix;
}
TEST(SerializationMacros, TestClassesCopyCtorAssignWorks) {
  ComplexEntry e1, e2;
  e1.setRandom();
  e2.setRandom();

  ASSERT_TRUE(e1.isBinaryEqual(e1));
  ASSERT_FALSE(e1.isBinaryEqual(e2));
  ASSERT_FALSE(e2.isBinaryEqual(e1));

  e2 = e1;
  ASSERT_TRUE(e2.isBinaryEqual(e1));
  ASSERT_TRUE(e1.isBinaryEqual(e2));

  ComplexEntry e3(e1);
  ASSERT_TRUE(e3.isBinaryEqual(e1));
  ASSERT_TRUE(e1.isBinaryEqual(e3));

}