Esempio n. 1
0
void
TestDataStructuresChild::Test6()
{
    IntDoubleArrays id1(int(42));
    InfallibleTArray<int> id2;
    id2.AppendElement(1); id2.AppendElement(2); id2.AppendElement(3);
    InfallibleTArray<double> id3;
    id3.AppendElement(1.0); id3.AppendElement(2.0); id3.AppendElement(3.0);

    InfallibleTArray<IntDoubleArrays> i1;
    i1.AppendElement(id1);
    i1.AppendElement(IntDoubleArrays(id2));
    i1.AppendElement(IntDoubleArrays(id3));

    InfallibleTArray<IntDoubleArrays> o1;
    if (!SendTest6(i1, &o1))
        fail("can't send Test6");

    test_assert(3 == o1.Length(), "wrong length");
    IntDoubleArrays od1(o1[0]);
    InfallibleTArray<int> od2(o1[1].get_ArrayOfint());
    InfallibleTArray<double> od3(o1[2].get_ArrayOfdouble());

    test_assert(42 == od1.get_int(), "wrong value");
    assert_arrays_equal(id2, od2);
    assert_arrays_equal(id3, od3);

    printf("  passed %s\n", __FUNCTION__);
}
  void 
  OPThermalConductivitySpeciesSpeciesE::accPass()
  {
    ++count;

    size_t Nsp(Sim->dynamics.getSpecies().size());
  
    for (size_t id1(0); id1 < Nsp; ++id1)
      for (size_t id2(0); id2 < Nsp; ++id2)
	{
	  Vector  sum1(0,0,0), sum2(0,0,0);
	
	  for (size_t i = 0; i < CorrelatorLength; ++i)
	    {
	      sum1 += G[id1][i];
	      sum2 += G[id2][i];

	      Vector  tmp (sum1);

	      for (size_t j(0); j < NDIM; ++j)
		tmp[j] *= sum2[j];
		
	      accG2[id1+Nsp*id2][i] += tmp;
	    }
	}
  }
Esempio n. 3
0
  void
  Scheduler::initialise()
  {
    //Now, the scheduler is used to test the state of the system.
    dout << "Checking the simulation configuration for any errors" << std::endl;
    size_t warnings(0);

    for (const auto& interaction_ptr : Sim->interactions)
      {
	dout << "Checking Interaction \"" << interaction_ptr->getName() << "\" for invalid states" << std::endl;
	warnings += interaction_ptr->validateState(warnings < 101, 101 - warnings);
      }
    
    for (size_t id1(0); id1 < Sim->particles.size(); ++id1)
      {
	std::unique_ptr<IDRange> ids(getParticleNeighbours(Sim->particles[id1]));
	for (const size_t id2 : *ids)
	  if (id2 > id1)
	    if (Sim->getInteraction(Sim->particles[id1], Sim->particles[id2])
		->validateState(Sim->particles[id1], Sim->particles[id2], (warnings < 101)))
	      ++warnings;
      }
    
    for(const Particle& part : Sim->particles)
      for (const shared_ptr<Local>& lcl : Sim->locals)
      if (lcl->isInteraction(part))
	if (lcl->validateState(part, (warnings < 101)))
	  ++warnings;
    
    if (warnings > 100)
      derr << "Over 100 warnings of invalid states, further output was suppressed (total of " << warnings << " warnings detected)" << std::endl;

    dout << "Building all events on collision " << Sim->eventCount << std::endl;
    rebuildList();
  }
void textureinfo_object_t::test<10>()
{
    LLTextureInfo tex_info;
    tex_info.setUpLogging(true, true);

    S32 requestStartTimeOne = 200;
    S32 requestEndTimeOne = 400;
    S32 requestSizeOne = 1024;
    S32 requestSizeOneBits = requestSizeOne * 8;
    LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
    tex_info.setRequestStartTime(id1, requestStartTimeOne);
    tex_info.setRequestSize(id1, requestSizeOne);
    tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
    tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);

    U32 requestStartTimeTwo = 100;
    U32 requestEndTimeTwo = 500;
    U32 requestSizeTwo = 2048;
    S32 requestSizeTwoBits = requestSizeTwo * 8;
    LLUUID id2("10e65d70-46fd-429f-841a-bf698e9424d4");
    tex_info.setRequestStartTime(id2, requestStartTimeTwo);
    tex_info.setRequestSize(id2, requestSizeTwo);
    tex_info.setRequestType(id2, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
    tex_info.setRequestCompleteTimeAndLog(id2, requestEndTimeTwo);

    S32 averageBitRate = ((requestSizeOneBits/(requestEndTimeOne - requestStartTimeOne)) +
                          (requestSizeTwoBits/(requestEndTimeTwo - requestStartTimeTwo))) / 2;

    S32 totalBytes = requestSizeOne + requestSizeTwo;

    LLSD results = tex_info.getAverages();
    ensure_equals("is average bits per second correct", results["bits_per_second"].asInteger(), averageBitRate);
    ensure_equals("is total bytes is correct", results["bytes_downloaded"].asInteger(), totalBytes);
    ensure_equals("is transport correct", results["transport"].asString(), std::string("HTTP"));
}
Esempio n. 5
0
void 
OPRijVij::process2PED(mapdata& ref, const PairEventData& PDat)
{
  Vector  rijnorm(PDat.rij / PDat.rij.nrm());
  Vector  vijnorm(PDat.vijold / PDat.vijold.nrm());

  double rvdot(rijnorm | vijnorm);

  for (size_t iDim(0); iDim < NDIM; ++iDim)
    {
      ref.rij[iDim].addVal(rijnorm[iDim]);
      ref.vij[iDim].addVal(vijnorm[iDim]);

      size_t id1(static_cast<size_t>((rijnorm[iDim] + 1.0) * 1000));
      size_t id2(static_cast<size_t>(-rvdot * 1000.0));

      ++ref.rijcostheta[iDim].at(id1).first;
      ref.rijcostheta[iDim].at(id1).second += rvdot;

      ++ref.costhetarij[iDim].at(id2).first;
      ref.costhetarij[iDim].at(id2).second += std::fabs(rijnorm[iDim]);


      id1 = static_cast<size_t>((rijnorm[iDim] + 1.0) * 100);
      id2 = static_cast<size_t>(-rvdot * 100.0);

      ++ref.anglemapcount;
      ++ref.anglemap[iDim][id1][id2];
    }
}
CFComparisonResult
SecIdentityCompare(
	SecIdentityRef identity1,
	SecIdentityRef identity2,
	CFOptionFlags compareOptions)
{
	if (!identity1 || !identity2)
	{
		if (identity1 == identity2)
			return kCFCompareEqualTo;
		else if (identity1 < identity2)
			return kCFCompareLessThan;
		else
			return kCFCompareGreaterThan;
	}

	BEGIN_SECAPI

	SecPointer<Identity> id1(Identity::required(identity1));
	SecPointer<Identity> id2(Identity::required(identity2));

	if (id1 == id2)
		return kCFCompareEqualTo;
	else if (id1 < id2)
		return kCFCompareLessThan;
	else
		return kCFCompareGreaterThan;

	END_SECAPI1(kCFCompareGreaterThan);
}
Esempio n. 7
0
bool TestDataStructuresParent::RecvTest6(
        const InfallibleTArray<IntDoubleArrays>& i1,
        InfallibleTArray<IntDoubleArrays>* o1)
{
    test_assert(3 == i1.Length(), "wrong length");

    IntDoubleArrays id1(i1[0]);
    test_assert(42 == id1.get_int(), "wrong value");

    InfallibleTArray<int> i2a(i1[1].get_ArrayOfint());
    test_assert(3 == i2a.Length(), "wrong length");
    test_assert(1 == i2a[0], "wrong value");
    test_assert(2 == i2a[1], "wrong value");
    test_assert(3 == i2a[2], "wrong value");

    InfallibleTArray<double> i3a(i1[2].get_ArrayOfdouble());
    test_assert(3 == i3a.Length(), "wrong length");
    test_assert(1.0 == i3a[0], "wrong value");
    test_assert(2.0 == i3a[1], "wrong value");
    test_assert(3.0 == i3a[2], "wrong value");

    o1->AppendElement(id1);
    o1->AppendElement(IntDoubleArrays(i2a));
    o1->AppendElement(IntDoubleArrays(i3a));

    return true;
}
void tst_QOrganizerCollection::idStringFunctions()
{
    // TODO: review test
    QOrganizerCollectionId id1(makeId("a", 1));
    QOrganizerCollectionId id2(makeId("a", 1));
    QOrganizerCollectionId id3(makeId("b", 1));
    QOrganizerCollectionId id4(makeId("a", 2));
    QVERIFY(qHash(id1) == qHash(id2));
    QVERIFY(qHash(id1) != qHash(id4));

    // note that the toString and fromString functions are
    // engine and id specific.  This test merely checks that
    // the API is hooked up correctly.

    QVERIFY(id1.toString() == id2.toString());
    QVERIFY(id1.toString() != id3.toString());
    QVERIFY(id1.toString() != id4.toString());
    QVERIFY(id3.toString() != id4.toString());

    // this should "work" -- string of the correct format
    QString prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString("::") + QString::number(2);
    QOrganizerCollectionId rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    // QVERIFY(rebuiltid == id4); // -- this requires a working backend.

    // this string has the right format and one parameter, but requires a working backend
    prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value") + QString(":") + QString::number(2);
    rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    // QVERIFY(rebuiltid == id4); // -- this requires a working backend.

    // this string has the right format and some parameters, but requires a working backend
    prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value&key2=value2") + QString(":") + QString::number(2);
    rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    // QVERIFY(rebuiltid == id4); // -- this requires a working backend.

    // this string has the right format but misses the value for a parameter
    prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value&key2=") + QString(":") + QString::number(2);
    rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    // QVERIFY(rebuiltid == id4); // -- this requires a working backend.

    // this string misses a field (the parameters)
    prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString::number(2);
    rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.

    // this string misses two fields (params plus manager uri)
    prebuiltidstring = QString("qtorganizer") + QString(":") + QString::number(2);
    rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.

    // this string misses the prefix (qtorganizer)
    prebuiltidstring = QString("notorganizer") + QString(":") + QString("a") + QString("::") + QString::number(2);
    rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.

    // this string misses the manager uri
    prebuiltidstring = QString("notorganizer") + QString(":::") + QString::number(2);
    rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
    QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.
}
Esempio n. 9
0
TEST(GuidTest, TestParse1)
{
    capu::Guid id1("BA28BA67-E777-4014-B8DD-6B928BDF57B1");
    capu::Guid id2;
    EXPECT_FALSE(id1.equals(id2));
    id2.parse(id1.toString());
    EXPECT_TRUE(id1.equals(id2));
    EXPECT_EQ(capu::String("BA28BA67-E777-4014-B8DD-6B928BDF57B1"), id2.toString());
}
Esempio n. 10
0
TEST(GuidTest, TestAssignmentOperator2)
{
    capu::Guid id1("BA28BA67-E777-4014-B8DD-6B928BDF57B1");
    capu::Guid id2;
    EXPECT_FALSE(id1.equals(id2));
    id2 = id1.getGuidData();
    EXPECT_TRUE(id1.equals(id2));
    EXPECT_EQ(capu::String("BA28BA67-E777-4014-B8DD-6B928BDF57B1"), id2.toString());
}
Esempio n. 11
0
int64_t u6_run_test(int64_t clos, int64_t i, int64_t acc) { 
  int64_t id1_clos = ((int64_t*)clos)[2];
  int64_t id2_clos = ((int64_t*)clos)[3];
  int64_t (*id1)(int64_t, int64_t) = 
    (int64_t(*)(int64_t, int64_t)) ((int64_t*) id1_clos)[0];
  int64_t (*id2)(int64_t, int64_t) = 
    (int64_t(*)(int64_t, int64_t)) ((int64_t*) id2_clos)[0];
  int64_t tmp1 = id1(id1_clos, (1 + acc));
  return id2(id2_clos, tmp1);
}
Esempio n. 12
0
TEST_F(EnvironmentFactorTest, Getters) {
  Id id1("env1");
  EnvironmentFactor envFactor1(id1);
  EXPECT_EQ(id1, envFactor1.getId());

  envFactor1.setVariableType(OTHER);
  EXPECT_EQ(OTHER, envFactor1.getVariableType());

  envFactor1.setVariableType(BINARY);
  EXPECT_EQ(BINARY, envFactor1.getVariableType());
}
Esempio n. 13
0
// ----------------------------------------------------------------------------
// Internalize an array of item ids from stream
// ----------------------------------------------------------------------------
//
EXPORT_C void MPXUser::InternalizeL(RArray<TMPXItemId>& aArray, RReadStream& aStream)
    {
    CleanupClosePushL(aArray);
    TInt n=aStream.ReadInt32L();
    for (TInt i=0;i<n;++i)
        {
        TUint32 id1(aStream.ReadUint32L());
        TUint32 id2(aStream.ReadUint32L());
        aArray.AppendL(TMPXItemId(id1,id2));
        }
    CleanupStack::Pop();
    }
Esempio n. 14
0
void testTypeIDBase::copyTest()
{
  edmtest::empty e;
  edm::TypeIDBase id1(typeid(e));

  edm::TypeIDBase id3=id1;
  CPPUNIT_ASSERT(!(id1 < id3));
  CPPUNIT_ASSERT(!(id3 < id1));

  std::string n1(id1.name());
  std::string n3(id3.name());
  CPPUNIT_ASSERT(n1== n3);
}
void Ut_MAttributeExtensionManager::testSetExtendedAttribute()
{
    MAttributeExtensionId id1(1, "Ut_MAttributeExtensionManager");
    MAttributeExtensionId id2(2, "Ut_MAttributeExtensionManager");

    QList<MAttributeExtensionId> idList;
    idList <<  id1 << id2;

    int attributteExtentionCount = 0;
    // register all extended attributes
    for (int i = 0; i < idList.count(); i++) {
        subject->registerAttributeExtension(idList.at(i), "");
        attributteExtentionCount ++;
        QTest::qWait(50);
        QCOMPARE(subject->attributeExtensionIdList().count(), attributteExtentionCount);
    }

    QSignalSpy spy(subject, SIGNAL(keyOverrideCreated()));
    QVERIFY(spy.isValid());
    for (int i = 0; i < idList.count(); i++) {
        QCOMPARE(subject->keyOverrides(idList.at(i)).count(), 0);

        // set extended attribute not registered before.
        subject->setExtendedAttribute(idList.at(i),
                                      "/keys",
                                      "testKey",
                                      "label",
                                      QVariant("testLabel"));

        // new key overrides will be created
        QCOMPARE(spy.count(), 1);
        spy.clear();
        QCOMPARE(subject->keyOverrides(idList.at(i)).count(), 1);
        QVERIFY(subject->keyOverrides(idList.at(i)).value("testKey"));
        QCOMPARE(subject->keyOverrides(idList.at(i)).value("testKey")->label(), QString("testLabel"));
    }

    spy.clear();
    // item attribute is modified in one, the same item attribute must not change in the other one.
    subject->setExtendedAttribute(idList.at(0),
                                  "/keys",
                                  "testKey",
                                  "icon",
                                  QVariant("testIcon"));
    QCOMPARE(subject->keyOverrides(idList.at(0)).count(), 1);
    QVERIFY(subject->keyOverrides(idList.at(0)).value("testKey"));
    QCOMPARE(subject->keyOverrides(idList.at(0)).value("testKey")->icon(), QString("testIcon"));
    QVERIFY(subject->keyOverrides(idList.at(1)).value("testKey")->icon().isEmpty());
}
Esempio n. 16
0
void testTypeIDBase::equalityTest()

{
  edmtest::empty e;
  edm::TypeIDBase id1(typeid(e));
  edm::TypeIDBase id2(typeid(e));
  
  CPPUNIT_ASSERT(!(id1 < id2));
  CPPUNIT_ASSERT(!(id2 < id1));

  std::string n1(id1.name());
  std::string n2(id2.name());

  CPPUNIT_ASSERT(n1==n2);
}
void tst_QMailMessagePart::setContentID()
{
    QMailMessagePart part;

    QString id1("Some content-ID x@yyyy");
    QString id2("<Some other content-ID y@yyyy>");

    QCOMPARE( part.contentID(), QString() );

    part.setContentID(id1);
    QCOMPARE( part.contentID(), id1 );

    part.setContentID(id2);
    QCOMPARE( part.contentID(), id2.mid(1, id2.length() - 2) );
}
Esempio n. 18
0
TEST(Entity, checkMatchingSingle)
{
  std::shared_ptr<ice::Entity> id1(new ice::Entity(nullptr, {{"id1", "value_id1"}, {"id2", "value_id2"}}));

  std::string key = "id1";
  std::string value = "value_id1";
  ASSERT_EQ(ice::entity_match::FULL_MATCH, id1->checkMatching(key, value));

  key = "id3";
  value = "value_id3";
  ASSERT_EQ(ice::entity_match::NO_MATCH, id1->checkMatching(key, value));

  key = "id1";
  value = "value_id1_1";
  ASSERT_EQ(ice::entity_match::CONFLICTING, id1->checkMatching(key, value));
}
Esempio n. 19
0
TEST(Entity, checkMatchingList)
{
   std::shared_ptr<ice::Entity> id1(new ice::Entity(nullptr, {{"id1", "value_id1"}, {"id2", "value_id2"}}));

   ASSERT_EQ(ice::entity_match::FULL_MATCH, id1->checkMatching({{"id1", "value_id1"}, {"id2", "value_id2"}}));

   ASSERT_EQ(ice::entity_match::PARTIAL_MATCH, id1->checkMatching({{"id2", "value_id2"}, {"id3", "value_id3"}}));

   ASSERT_EQ(ice::entity_match::INCLUDED, id1->checkMatching({{"id1", "value_id1"}, {"id2", "value_id2"}, {"id3", "value_id3"}}));

   ASSERT_EQ(ice::entity_match::INCLUDING, id1->checkMatching({{"id1", "value_id1"}}));

   ASSERT_EQ(ice::entity_match::NO_MATCH, id1->checkMatching({{"id1", "value_id1_1"}}));

   ASSERT_EQ(ice::entity_match::CONFLICTING, id1->checkMatching({{"id1", "value_id1_1"}, {"id2", "value_id2"}}));
}
Esempio n. 20
0
void JobSupervisorTest::TestResubmit()
{
  std::list<Arc::Job> jobs;
  std::string id1("http://test.nordugrid.org/1234567890test1"),
              id2("http://test.nordugrid.org/1234567890test2"),
              id3("http://test.nordugrid.org/1234567890test3");

  j.State = Arc::JobStateTEST(Arc::JobState::FAILED);
  j.JobID = id1;
  j.JobDescriptionDocument = "CONTENT";
  jobs.push_back(j);

  j.State = Arc::JobStateTEST(Arc::JobState::RUNNING);
  j.JobID = id1;
  j.JobDescriptionDocument = "CONTENT";
  jobs.push_back(j);

  usercfg.Broker("TEST");

  Arc::ComputingServiceType cs;

  Arc::ComputingEndpointType ce;
  ce->URLString = "http://test2.nordugrid.org";
  ce->InterfaceName = "org.nordugrid.test";
  ce->Capability.insert(Arc::Endpoint::GetStringForCapability(Arc::Endpoint::JOBSUBMIT));
  ce->HealthState = "ok";

  cs.ComputingEndpoint.insert(std::pair<int, Arc::ComputingEndpointType>(0, ce));
  cs.ComputingShare.insert(std::pair<int, Arc::ComputingShareType>(0, Arc::ComputingShareType()));
  Arc::ComputingManagerType cm;
  cm.ExecutionEnvironment.insert(std::pair<int, Arc::ExecutionEnvironmentType>(0, Arc::ExecutionEnvironmentType()));
  cs.ComputingManager.insert(std::pair<int, Arc::ComputingManagerType>(0, cm));

  Arc::TargetInformationRetrieverPluginTESTControl::targets.push_back(cs);
  Arc::TargetInformationRetrieverPluginTESTControl::status = Arc::EndpointQueryingStatus::SUCCESSFUL;

  Arc::BrokerPluginTestACCControl::match = true;

  js = new Arc::JobSupervisor(usercfg, jobs);

  std::list<Arc::Endpoint> services(1, Arc::Endpoint("http://test2.nordugrid.org",  Arc::Endpoint::COMPUTINGINFO, "org.nordugrid.tirtest"));
  std::list<Arc::Job> resubmitted;
  CPPUNIT_ASSERT(js->Resubmit(0, services, resubmitted));
  CPPUNIT_ASSERT_EQUAL(2, (int)resubmitted.size());

  delete js;
}
Esempio n. 21
0
int64_t u10_run_test(int64_t clos, int64_t i, int64_t acc) { 
  int64_t id1_clos = ((int64_t*)clos)[2];
  int64_t id2_clos = ((int64_t*)clos)[3];
  int64_t id3_clos = ((int64_t*)clos)[4];
  int64_t id4_clos = ((int64_t*)clos)[5];
  int64_t (*id1)(int64_t, int64_t) = 
    (int64_t(*)(int64_t, int64_t)) ((int64_t*) id1_clos)[0];
  int64_t (*id2)(int64_t, int64_t) = 
    (int64_t(*)(int64_t, int64_t)) ((int64_t*) id2_clos)[0];
  int64_t (*id3)(int64_t, int64_t) = 
    (int64_t(*)(int64_t, int64_t)) ((int64_t*) id3_clos)[0];
  int64_t (*id4)(int64_t, int64_t) = 
    (int64_t(*)(int64_t, int64_t)) ((int64_t*) id4_clos)[0];
  int64_t tmp1 = id1(id1_clos, (1 + acc));
  int64_t tmp2 = id2(id2_clos, tmp1);
  int64_t tmp3 = id3(id3_clos, tmp2);
  return id4(id4_clos, tmp3);
}
Esempio n. 22
0
void textureinfo_object_t::test<12>()
{
    LLTextureInfo tex_info;
    tex_info.setUpLogging(true, true);

    S32 requestStartTimeOne = 200;
    S32 requestEndTimeOne = 400;
    S32 requestSizeOne = 1024;
    LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
    tex_info.setRequestStartTime(id1, requestStartTimeOne);
    tex_info.setRequestSize(id1, requestSizeOne);
    tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);

    ensure_equals("map item created", tex_info.getTextureInfoMapSize(), 1);

    tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);

    ensure_equals("map item removed when consumed", tex_info.getTextureInfoMapSize(), 0);
}
void tst_QOrganizerCollection::idHash()
{
    // TODO: review tests
    QOrganizerCollectionId id1(makeId(QString(), 1));
    QOrganizerCollectionId id2(makeId(QString(), 1));
    QOrganizerCollectionId id3(makeId(QString(), 2));
    QOrganizerCollectionId id4(makeId("a", 1));
    QVERIFY(qHash(id1) == qHash(id2));
    QVERIFY(qHash(id1) != qHash(id3));
    // note that the hash function is dependent on the id type
    // in BasicCollectionLocalId, the hash function ignores the managerUri.

    QSet<QOrganizerCollectionId> set;
    set.insert(id1);
    set.insert(id2);
    set.insert(id3);
    set.insert(id4);
    QCOMPARE(set.size(), 3);
}
Esempio n. 24
0
  void Prepreprocess::magic_quote(const std::string &line)
  {
    int end=line.length();
    bool use_suffix=true;

    state=START;

    for (int pos=0; pos<end; ++pos) {
      if (line[pos]=='$') {
	if (pos == end-1) {
	  use_suffix=false;
	  break;
	} else {
	  if (id0(line[pos+1])) {
	    ++pos;
	    int begin=pos;
	    while (pos < end && id1(line[pos])) ++pos;
	    emit_expression(line.substr(begin,(pos-begin)));
	    --pos;
	    continue;
	  }
	  if (line[pos+1] == '(') {
	    ++pos;
	    int begin=pos;
	    int parens=0;
	    while (pos < end) {
	      if (line[pos]=='(') ++parens;
	      if (line[pos]==')') {--parens; if (parens==0) { ++pos; break; } }
	      ++pos;
	    }
	    emit_expression(line.substr(begin,(pos-begin)));
	    --pos;
	    continue;
	  }
	  if (line[pos+1]=='$') {
	    ++pos;
	  }
	}
      }
      emit_char(line[pos]);
    }
    emit_end(use_suffix);
  }
Esempio n. 25
0
bool Law2_ScGeom_MindlinPhys_HertzWithLinearShear::go(shared_ptr<IGeom>& ig, shared_ptr<IPhys>& ip, Interaction* contact){
	Body::id_t id1(contact->getId1()), id2(contact->getId2());
	ScGeom* geom = static_cast<ScGeom*>(ig.get());
	MindlinPhys* phys=static_cast<MindlinPhys*>(ip.get());	
	const Real uN=geom->penetrationDepth;
	if (uN<0) {
		if (neverErase) {phys->shearForce = phys->normalForce = Vector3r::Zero(); phys->kn=phys->ks=0; return true;}
		else return false;
	}
	// normal force
	Real Fn=phys->kno*pow(uN,3/2.);
	phys->normalForce=Fn*geom->normal;
	//phys->kn=3./2.*phys->kno*std::pow(uN,0.5); // update stiffness, not needed
	
	// shear force
	Vector3r& Fs=geom->rotate(phys->shearForce);
	Real ks= nonLin>0 ? phys->kso*std::pow(uN,0.5) : phys->kso;
	Vector3r shearIncrement;
	if(nonLin>1){
		State *de1=Body::byId(id1,scene)->state.get(), *de2=Body::byId(id2,scene)->state.get();	
		Vector3r shiftVel=scene->isPeriodic ? Vector3r(scene->cell->velGrad*scene->cell->hSize*contact->cellDist.cast<Real>()) : Vector3r::Zero();
		Vector3r shift2 = scene->isPeriodic ? Vector3r(scene->cell->hSize*contact->cellDist.cast<Real>()): Vector3r::Zero();
		
		
		Vector3r incidentV = geom->getIncidentVel(de1, de2, scene->dt, shift2, shiftVel, /*preventGranularRatcheting*/ nonLin>2 );	
		Vector3r incidentVn = geom->normal.dot(incidentV)*geom->normal; // contact normal velocity
		Vector3r incidentVs = incidentV-incidentVn; // contact shear velocity
		shearIncrement=incidentVs*scene->dt;
	} else { shearIncrement=geom->shearIncrement(); }
	Fs-=ks*shearIncrement;
	// Mohr-Coulomb slip
	Real maxFs2=pow(Fn,2)*pow(phys->tangensOfFrictionAngle,2);
	if(Fs.squaredNorm()>maxFs2) Fs*=sqrt(maxFs2)/Fs.norm();

	// apply forces
	Vector3r f=-phys->normalForce-phys->shearForce; /* should be a reference returned by geom->rotate */ assert(phys->shearForce==Fs); 
	scene->forces.addForce(id1,f);
	scene->forces.addForce(id2,-f);
	scene->forces.addTorque(id1,(geom->radius1-.5*geom->penetrationDepth)*geom->normal.cross(f));
	scene->forces.addTorque(id2,(geom->radius2-.5*geom->penetrationDepth)*geom->normal.cross(f));
	return true;
}
Esempio n. 26
0
bool Law2_ScGeom_MindlinPhys_MindlinDeresiewitz::go(shared_ptr<IGeom>& ig, shared_ptr<IPhys>& ip, Interaction* contact){
	Body::id_t id1(contact->getId1()), id2(contact->getId2());
	ScGeom* geom = static_cast<ScGeom*>(ig.get());
	MindlinPhys* phys=static_cast<MindlinPhys*>(ip.get());	
	const Real uN=geom->penetrationDepth;
	if (uN<0) {
		if (neverErase) {phys->shearForce = phys->normalForce = Vector3r::Zero(); phys->kn=phys->ks=0; return true;}
		else {return false;}
	}
	// normal force
	Real Fn=phys->kno*pow(uN,3/2.);
	phys->normalForce=Fn*geom->normal;
	// exactly zero would not work with the shear formulation, and would give zero shear force anyway
	if(Fn==0) return true;
	//phys->kn=3./2.*phys->kno*std::pow(uN,0.5); // update stiffness, not needed

	// contact radius
	Real R=geom->radius1*geom->radius2/(geom->radius1+geom->radius2);
	phys->radius=pow(Fn*pow(R,3/2.)/phys->kno,1/3.);
	
	// shear force: transform, but keep the old value for now
	geom->rotate(phys->usTotal);
	//Vector3r usOld=phys->usTotal;     //The variable set but not used
	Vector3r dUs=geom->shearIncrement();
	phys->usTotal-=dUs;

#if 0
	Vector3r shearIncrement;
	shearIncrement=geom->shearIncrement();
	Fs-=ks*shearIncrement;
	// Mohr-Coulomb slip
	Real maxFs2=pow(Fn,2)*pow(phys->tangensOfFrictionAngle,2);
	if(Fs.squaredNorm()>maxFs2) Fs*=sqrt(maxFs2)/Fs.norm();
#endif
	// apply forces
	Vector3r f=-phys->normalForce-phys->shearForce; 
	scene->forces.addForce(id1,f);
	scene->forces.addForce(id2,-f);
	scene->forces.addTorque(id1,(geom->radius1-.5*geom->penetrationDepth)*geom->normal.cross(f));
	scene->forces.addTorque(id2,(geom->radius2-.5*geom->penetrationDepth)*geom->normal.cross(f));
	return true;
}
void tst_QOrganizerCollection::idLessThan()
{
    // TODO: review tests
    QOrganizerCollectionId id1(makeId("a", 1));
    QOrganizerCollectionId id2(makeId("a", 1));
    QVERIFY(!(id1 < id2));
    QVERIFY(!(id2 < id1));
    QVERIFY(id1 == id2);
    QOrganizerCollectionId id3(makeId("a", 2));
    QOrganizerCollectionId id4(makeId("b", 1));
    QOrganizerCollectionId id5(makeId(QString(), 2));
    QVERIFY(id1 < id3);
    QVERIFY(!(id3 < id1));
    QVERIFY(id1 < id4);
    QVERIFY(!(id4 < id1));
    QVERIFY(id3 < id4);
    QVERIFY(!(id4 < id3));
    QVERIFY(id5 < id1);
    QVERIFY(!(id1 < id5));
}
  void 
  OPThermalConductivitySpeciesSpeciesE::output(magnet::xml::XmlStream &XML)
  {
    XML << magnet::xml::tag("EinsteinCorrelator")
	<< magnet::xml::attr("name") << name
	<< magnet::xml::attr("size") << accG2.size()
	<< magnet::xml::attr("dt") << dt/Sim->dynamics.units().unitTime()
	<< magnet::xml::attr("LengthInMFT") << dt * accG2.size()
      / Sim->getOutputPlugin<OPMisc>()->getMFT()
	<< magnet::xml::attr("simFactor") << rescaleFactor()
	<< magnet::xml::attr("SampleCount") << count;
  
    double factor = rescaleFactor();

    size_t Nsp(Sim->dynamics.getSpecies().size());
  
    for (size_t id1(0); id1 < Nsp; ++id1)
      for (size_t id2(0); id2 < Nsp; ++id2)      
	{
	  XML << magnet::xml::tag("Component") 
	      << magnet::xml::attr("Species1") << id1
	      << magnet::xml::attr("Species2") << id2
	      << magnet::xml::chardata();

	  for (unsigned int i = 0; i < accG2.size(); i++)
	    {
	      XML << (1+i) * dt / Sim->dynamics.units().unitTime()
		  << "\t ";
	    
	      for (size_t j=0;j<NDIM;j++)
		XML << accG2[id1 + Nsp * id2][i][j] * factor 
		    << "\t ";
	    
	      XML << "\n";
	    }

	  XML << magnet::xml::endtag("Component");
	}
  
    XML << magnet::xml::endtag("EinsteinCorrelator");
  }
Esempio n. 29
0
void textureinfo_object_t::test<11>()
{
    LLTextureInfo tex_info;
    tex_info.setUpLogging(true, true);

    S32 requestStartTimeOne = 200;
    S32 requestEndTimeOne = 400;
    S32 requestSizeOne = 1024;
    LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
    tex_info.setRequestStartTime(id1, requestStartTimeOne);
    tex_info.setRequestSize(id1, requestSizeOne);
    tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
    tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);

    tex_info.getAverages();
    tex_info.reset();
    LLSD results = tex_info.getAverages();
    ensure_equals("is average bits per second correct", results["bits_per_second"].asInteger(), 0);
    ensure_equals("is total bytes is correct", results["bytes_downloaded"].asInteger(), 0);
    ensure_equals("is transport correct", results["transport"].asString(), std::string("NONE"));
}
Esempio n. 30
0
TEST_F(EnvironmentFactorTest, Operators) {
  Id id1("env1");
  EnvironmentFactor envFactor1(id1);

  Id id2("env2");
  EnvironmentFactor envFactor2(id2);

  Id id3("a_env");
  EnvironmentFactor envFactor3(id3);

  EnvironmentFactor envFactor4(id1);

  EXPECT_EQ(envFactor4, envFactor1);
  EXPECT_FALSE(envFactor1 == envFactor2);
  EXPECT_FALSE(envFactor4 == envFactor2);
  EXPECT_FALSE(envFactor1 == envFactor3);
  EXPECT_FALSE(envFactor4 == envFactor3);
  EXPECT_FALSE(envFactor3 == envFactor2);

  if(id1 < id2){
    EXPECT_TRUE(envFactor1 < envFactor2);
  }else{
    EXPECT_TRUE(envFactor2 < envFactor1);
  }

  if(id1 < id3){
    EXPECT_TRUE(envFactor1 < envFactor3);
  }else{
    EXPECT_TRUE(envFactor3 < envFactor1);
  }

  if(id2 < id3){
    EXPECT_TRUE(envFactor2 < envFactor3);
  }else{
    EXPECT_TRUE(envFactor3 < envFactor2);
  }
}