示例#1
0
int main(int argc, char **argv)
{
  plan_tests(17);

  ok1(Directory::Exists(_T("test/data/file_visitor_test")));
  ok1(File::Exists(_T("test/data/file_visitor_test/a.txt")));
  ok1(File::Exists(_T("test/data/file_visitor_test/b.txt")));
  ok1(File::Exists(_T("test/data/file_visitor_test/c.tx")));
  ok1(File::Exists(_T("test/data/file_visitor_test/subfolder/d.txt")));

  TestingFileVisitor fv1(false, false);
  Directory::VisitFiles(_T("test/data/file_visitor_test"), fv1, false);

  TestingFileVisitor fv2(true, false);
  Directory::VisitFiles(_T("test/data/file_visitor_test"), fv2, true);

  TestingFileVisitor fv3(false, true);
  Directory::VisitSpecificFiles(_T("test/data/file_visitor_test"),
                                _T("*.txt"), fv3, false);

  TestingFileVisitor fv4(true, true);
  Directory::VisitSpecificFiles(_T("test/data/file_visitor_test"),
                                _T("*.txt"), fv4, true);

  return exit_status();
}
MeshGeometry PrimitiveGeometryBuilder::buildCylinderMesh(std::vector<tgt::vec3>& vertices, size_t numSides, tgt::vec3 color) {
    // Transform vec3 to vec4
    tgt::vec4 color4(color[0], color[1], color[2], 1.f);
    
    // Build cylinder's sides
    MeshGeometry cyl;
    for (size_t i = 0; i < 2*numSides; i+=2) {
        FaceGeometry face;
        
        tgt::vec3 faceNormal = tgt::cross(vertices[i+1] - vertices[i], vertices[i+2] - vertices[i]);
        
        // Face vertices
        // TODO Replace faceNormal with vertex normals for smoother representation
        VertexGeometry fv1(vertices[i], tgt::vec3(0.f), color4, faceNormal);
        VertexGeometry fv2(vertices[i+1], tgt::vec3(0.f), color4, faceNormal);
        VertexGeometry fv3(vertices[i+3], tgt::vec3(0.f), color4, faceNormal);
        VertexGeometry fv4(vertices[i+2], tgt::vec3(0.f), color4, faceNormal);
        face.addVertex(fv1);
        face.addVertex(fv2);
        face.addVertex(fv3);
        face.addVertex(fv4);
        
        cyl.addFace(face);
    }
    return cyl;
}
tmp<volScalarField> SpalartAllmarasIDDES::dTilda(const volScalarField& S) const
{
    volScalarField alpha = this->alpha();
    volScalarField expTerm = exp(sqr(alpha));

    volScalarField fHill =
        2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0));

    volScalarField fStep = min(2*pow(expTerm, -9.0), scalar(1));
    volScalarField fHyb = max(1 - fd(S), fStep);
    volScalarField fAmp = 1 - max(ft(S), fl(S));
    volScalarField fRestore = max(fHill - 1, scalar(0))*fAmp;

    // IGNORING ft2 terms
    volScalarField Psi = sqrt
    (
        min
        (
            scalar(100),
            (1 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*fv2())/max(SMALL, fv1())
        )
    );

    return max
    (
        dimensionedScalar("SMALL", dimLength, SMALL),
        fHyb*(1 + fRestore*Psi)*y_
      + (1 - fHyb)*CDES_*Psi*delta()
    );
}
tmp<volScalarField> SpalartAllmaras::STilda
(
    const volScalarField& S,
    const volScalarField& dTilda
) const
{
    return fv3()*S + fv2()*nuTilda_/sqr(kappa_*dTilda);
}
示例#5
0
double vmod(double t)
{
double a1=30,amp1=0,amp2=1,t1=0.03,vlim=0.1,dec=3,tbr=0.2,tpereg=0.3;
 if(TDV) return fv2(t, 10., fv2(t,a1,amp1,amp2,t1) - fv2(0,a1,amp1,amp2,t1), fv2(t,dec,1,vlim,tpereg), tbr);
    else return Vmax;
}
示例#6
0
void Topo3PrimalRender<PFP>::updateData(MAP& mapx, const VertexAttribute<VEC3, MAP>& positions, float ke, float kf)
{
	if (m_attIndex.map() != &mapx)
		m_attIndex  = mapx.template getAttribute<unsigned int, DART, MAP>("dart_index");
	if (!m_attIndex.isValid())
		m_attIndex  = mapx.template addAttribute<unsigned int, DART, MAP>("dart_index");

//	m_nbDarts = 0;
//	for (Dart d = mapx.begin(); d != mapx.end(); mapx.next(d))
//	{
//		m_nbDarts++;
//	}

	m_nbDarts = mapx.getNbDarts();

	// beta2/3
	DartAutoAttribute<VEC3, MAP> fv2(mapx);

	m_vbo2->bind();
	glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW);
	GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
	Geom::Vec3f* colorDartBuf = reinterpret_cast<Geom::Vec3f*>(ColorDartsBuffer);

	if (m_bufferDartPosition!=NULL)
		delete m_bufferDartPosition;
	m_bufferDartPosition = new Geom::Vec3f[2*m_nbDarts];
	Geom::Vec3f* positionDartBuf = reinterpret_cast<Geom::Vec3f*>(m_bufferDartPosition);

	unsigned int posDBI = 0;

	int nbf = 0;
	//traverse each face of each volume
	TraversorF<MAP> traFace(mapx);
	for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next())
	{
		std::vector<VEC3> vecPos;
		vecPos.reserve(16);

		VEC3 centerFace = Algo::Surface::Geometry::faceCentroidELW<PFP>(mapx, d, positions);

		//shrink the face
		float okf = 1.0f - kf;
		Dart dd = d;
		do
		{
			VEC3 P = centerFace*okf + positions[dd]*kf;
			vecPos.push_back(P);
			dd = mapx.phi1(dd);
		} while (dd != d);
		
		unsigned int nb = vecPos.size();
		
		vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop

		// compute position of points to use for drawing topo
		float oke = 1.0f - ke;
		for (unsigned int i = 0; i < nb; ++i)
		{
			VEC3 P = vecPos[i]*ke + vecPos[i+1]*oke;
			VEC3 Q = vecPos[i+1]*ke + vecPos[i]*oke;

//			VEC3 PP = 0.52f*P + 0.48f*Q;
//			VEC3 QQ = 0.52f*Q + 0.48f*P;

            VEC3 PP = 0.56f*P + 0.44f*Q;
            VEC3 QQ = 0.56f*Q + 0.44f*P;

			*positionDartBuf++ = PFP::toVec3f(P);
			*positionDartBuf++ = PFP::toVec3f(PP);
			if (mapx.template isBoundaryMarked<3>(d))
			{
				*colorDartBuf++ = m_boundaryDartsColor;
				*colorDartBuf++ = m_boundaryDartsColor;
			}
			else
			{
				*colorDartBuf++ = m_dartsColor;
				*colorDartBuf++ = m_dartsColor;
			}

			m_attIndex[d] = posDBI;
			posDBI+=2;
			fv2[d] = (P+PP)*0.5f;

			*positionDartBuf++ = PFP::toVec3f(Q);
			*positionDartBuf++ = PFP::toVec3f(QQ);

			Dart dx = mapx.phi3(d);
			if (mapx.template isBoundaryMarked<3>(dx))
			{
				*colorDartBuf++ = m_boundaryDartsColor;
				*colorDartBuf++ = m_boundaryDartsColor;
			}
			else
			{
				*colorDartBuf++ = m_dartsColor;
				*colorDartBuf++ = m_dartsColor;
			}

			m_attIndex[dx] = posDBI;
			posDBI+=2;
			fv2[dx] = (Q+QQ)*0.5f;

			d = mapx.phi1(d);
		}
		nbf++;
	}
	m_vbo2->bind();
	glUnmapBuffer(GL_ARRAY_BUFFER);

	m_vbo0->bind();
	glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), m_bufferDartPosition, GL_STREAM_DRAW);

	// alpha2
	m_vbo1->bind();
	glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW);
	GLvoid* PositionBuffer2 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE);

	Geom::Vec3f* positionF2 = reinterpret_cast<Geom::Vec3f*>(PositionBuffer2);

	m_nbRel2 = 0;

	for (Dart d = mapx.begin(); d != mapx.end(); mapx.next(d))
	{
		Dart e = mapx.phi2(mapx.phi3(d));
		//if (d < e)
		{
			*positionF2++ = PFP::toVec3f(fv2[d]);
			*positionF2++ = PFP::toVec3f(fv2[e]);
			m_nbRel2++;
		}
	}

	m_vbo1->bind();
	glUnmapBuffer(GL_ARRAY_BUFFER);

	glBindBuffer(GL_ARRAY_BUFFER, 0);
}