Exemplo n.º 1
0
/**-------------------------------------------------------------------------------
    Sensors

    @brief
    @param simulation
    @return
---------------------------------------------------------------------------------*/
Sensors::Sensors(Simulation* simulation)
{
	if (Config::Instance().getShowCOG())
	{
		// create center-of-gravity (COG) sensor
		SensorVectors* s = new SensorCOG(simulation);
		boost::shared_ptr<SensorVectors> cog(
			new SensorDecoratorCross(s, Ogre::ColourValue(0, 0, 1), Config::Instance().getDrawingScaleCOG()));
		mSensors.push_back(cog);
	}
	else
	{
		boost::shared_ptr<SensorVectors> cog(new SensorCOG(simulation));
		mSensors.push_back(cog);
	}


	// create center-of-pressure (COP) sensor	
	if (Config::Instance().getShowCOP())
	{
		SensorVectors* s = new SensorCOP(simulation);
		boost::shared_ptr<SensorVectors> cop(
			new SensorDecoratorCross(s, Ogre::ColourValue(0, 1, 0), Config::Instance().getDrawingScaleCOP()));
		mSensors.push_back(cop);
	}
	else
	{
		boost::shared_ptr<SensorVectors> cop(new SensorCOP(simulation));
		mSensors.push_back(cop);
	}

	// create (Zero-moment-point) ZMP sensor	
	if (Config::Instance().getShowZMP())
	{
		SensorVectors* s = new SensorZMP(simulation);
		boost::shared_ptr<SensorVectors> zmp(
			new SensorDecoratorCross(s, Ogre::ColourValue(1, 0, 1), Config::Instance().getDrawingScaleZMP()));
		mSensors.push_back(zmp);
	}
	else
	{
		boost::shared_ptr<SensorVectors> zmp(new SensorZMP(simulation));
		mSensors.push_back(zmp);
	}

	// create (Foot-rotation-index) FRI sensor	
	if (Config::Instance().getShowFRI())
	{
		SensorVectors* s = new SensorFRI(simulation);
		boost::shared_ptr<SensorVectors> fri(
			new SensorDecoratorCross(s, Ogre::ColourValue(0.42, 0.5624, 0.8492), Config::Instance().getDrawingScaleFRI()));
		mSensors.push_back(fri);
	}
	else
	{
		boost::shared_ptr<SensorVectors> fri(new SensorFRI(simulation));
		mSensors.push_back(fri);
	}

}
Exemplo n.º 2
0
 forAll(toF, celli)
 {
     if (adr[celli] != -1)
     {
         cop(toF[celli], fromVf[adr[celli]]);
     }
 }
Exemplo n.º 3
0
CMPIStatus CmpiInstanceMI::driveExecQuery
   (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
    CMPIObjectPath* eCop, char* language ,char* query)
{
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eCop);
   return ((CmpiInstanceMI*)mi->hdl)->execQuery
    (ctx,rslt,cop,language,query).status();
}
Exemplo n.º 4
0
CMPIStatus CmpiAssociationMI::driveReferenceNames
      (CMPIAssociationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
       CMPIObjectPath* eOp, char* resultClass, char* role) {
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eOp);
   return ((CmpiAssociationMI*)mi->hdl)->referenceNames
      (ctx,rslt,cop,
       (const char*)resultClass,(const char*)role).status();
}
Exemplo n.º 5
0
CMPIStatus CmpiInstanceMI::driveEnumInstanceNames
   (CMPIInstanceMI* mi,CMPIContext* eCtx, CMPIResult* eRslt,
    CMPIObjectPath* eCop)
{
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eCop);
   return ((CmpiInstanceMI*)mi->hdl)->enumInstanceNames
      (ctx,rslt,cop).status();
}
Exemplo n.º 6
0
CMPIStatus CmpiInstanceMI::driveGetInstance
   (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
    CMPIObjectPath* eCop, const char** properties)
{
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eCop);
   return ((CmpiInstanceMI*)mi->hdl)->getInstance
      (ctx,rslt,cop,properties).status();
}
Exemplo n.º 7
0
//-------------------------------------------------------------------
// This builds a reference value from a String via the objname class
//-------------------------------------------------------------------
static
CIMValue *
build_reference_value(const String &rep)
{
    // following 2 lines commented out for bugzilla fix 1557
    //objectName oname(rep);
    //AutoPtr<CIMObjectPath> ref( cimmofParser::Instance()->newReference(oname));
    CIMObjectPath cop(rep);
    AutoPtr<CIMValue> v( new CIMValue(cop) );
    return v.release();
}
Exemplo n.º 8
0
CMPIStatus CmpiInstanceMI::driveCreateInstance
   (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
    CMPIObjectPath* eCop, CMPIInstance* eInst)
{
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eCop);
   CmpiInstance inst(eInst);
   return ((CmpiInstanceMI*)mi->hdl)->createInstance
      (ctx,rslt,cop,inst).status();
}
Exemplo n.º 9
0
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    QStringList args = app.arguments().mid(1);
    QString filePath;
    CompilerType compilerType = CompilerTypeGcc;
    while (filePath.isEmpty() && !args.isEmpty()) {
        const QString currentArg = args.takeFirst();
        if (currentArg == QLatin1String("--type")) {
            if (args.isEmpty()) {
                fprintf(stderr, "Error: Option --type needs argument.\n");
                printUsage();
                return EXIT_FAILURE;
            }
            const QString typeString = args.takeFirst();
            if (typeString == QLatin1String("gcc")) {
                compilerType = CompilerTypeGcc;
            } else if (typeString == QLatin1String("clang")) {
                compilerType = CompilerTypeClang;
#ifdef HAS_MSVC_PARSER
            } else if (typeString == QLatin1String("msvc")) {
                compilerType = CompilerTypeMsvc;
#endif
            } else {
                fprintf(stderr, "Invalid compiler type '%s'.\n", qPrintable(typeString));
                printUsage();
                return EXIT_FAILURE;
            }
        } else {
            filePath = currentArg;
        }
    }

    if (filePath.isEmpty()) {
        fprintf(stderr, "Error: No file supplied.\n");
        printUsage();
        return EXIT_FAILURE;
    }

    if (!args.isEmpty())
        qDebug("Ignoring extraneous parameters '%s'.\n", qPrintable(args.join(QLatin1Char(' '))));

    QFile compilerOutputFile(filePath);
    if (!compilerOutputFile.open(QIODevice::ReadOnly)) {
        fprintf(stderr, "Error opening file '%s': %s\n", qPrintable(compilerOutputFile.fileName()),
                qPrintable(compilerOutputFile.errorString()));
        return EXIT_FAILURE;
    }
    CompilerOutputProcessor cop(compilerType, compilerOutputFile);
    QMetaObject::invokeMethod(&cop, "start", Qt::QueuedConnection);
    return app.exec();
}
Exemplo n.º 10
0
void DynamicIndicationProvider::sendIndication(
    int severity,
    String classname,
    String description)
{
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "DynamicIndicationProvider::sendIndications");

    CIMInstance instance(classname);
    instance.addProperty(CIMProperty(
        CIMName("SystemCreationClassName"),
        CIMValue(String("CIM_AlertIndication"))));
    instance.addProperty(CIMProperty(
        CIMName("SystemName"),
        CIMValue(System::getHostName())));
    instance.addProperty(CIMProperty(
        CIMName("AlertType"),
        CIMValue(Uint16(5))));   //Device Alert
    instance.addProperty(CIMProperty(
        CIMName("PerceivedSeverity"),
        CIMValue(severity)));
    instance.addProperty(CIMProperty(
        CIMName("Description"),
        CIMValue(description)));
    instance.addProperty(CIMProperty(
        CIMName("ProbableCause"),
        CIMValue(Uint16(1))));
    instance.addProperty(CIMProperty(
        CIMName("Trending"),
        CIMValue(Uint16(1))));
    instance.addProperty(CIMProperty(
        CIMName("TimeStamp"),
        CIMValue(CIMDateTime::getCurrentDateTime())));

    Array<CIMKeyBinding> keys;

    //you have to set the namespace
    CIMObjectPath cop(
        System::getHostName(), _DynamicIndicationNameSpace, classname, keys);
    instance.setPath(cop);

    Buffer buffer;
    MofWriter::appendInstanceElement(buffer, instance);

    PEG_TRACE_CSTRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, buffer.getData());
    PEG_TRACE_CSTRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
        (const char*)instance.getPath().toString().getCString());

    CIMIndication cimIndication(instance);
    _pHandler->deliver(cimIndication);

    PEG_METHOD_EXIT();
}
Exemplo n.º 11
0
CMPIStatus CmpiAssociationMI::driveAssociators
      (CMPIAssociationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
       CMPIObjectPath* eOp, char* assocClass, char* resultClass,
       char* role, char* resultRole, const char** properties) {
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eOp);
   return ((CmpiAssociationMI*)mi->hdl)->associators
      (ctx,rslt,cop,
       (const char*)assocClass,(const char*)resultClass,
       (const char*)role,(const char*)resultRole,properties).status();
}
Exemplo n.º 12
0
void quizpun2_state::quizpun2(machine_config &config)
{
	quizpun2_base(config);

	cop402_cpu_device &cop(COP402(config, "cop", XTAL(8'000'000) / 2));
	cop.set_addrmap(AS_PROGRAM, &quizpun2_state::quizpun2_cop_map);
	cop.set_config(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false);
	cop.write_d().set(FUNC(quizpun2_state::cop_d_w));
	cop.write_g().set(FUNC(quizpun2_state::cop_g_w));
	cop.read_l().set(FUNC(quizpun2_state::cop_l_r));
	cop.write_l().set(FUNC(quizpun2_state::cop_l_w));
	cop.read_in().set(FUNC(quizpun2_state::cop_in_r));
	cop.read_si().set("eeprom", FUNC(eeprom_serial_93cxx_device::do_read));
	cop.write_so().set("eeprom", FUNC(eeprom_serial_93cxx_device::di_write));
	cop.write_sk().set("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write));
}
Exemplo n.º 13
0
// this has to iterate over the backends and remove it everywhere
// possible with multiple backends that some are empty and some aren't
// so if we delete some and then later discover that some aren't empty
// we need to restore them all
// need to test this corner case probably
// return PLFS_SUCCESS or PLFS_E*
plfs_error_t
ContainerFileSystem::rmdir(struct plfs_physpathinfo *ppip)
{
    plfs_error_t ret = PLFS_SUCCESS;
    // save mode in case we need to restore
    mode_t mode = Container::getmode(ppip->canbpath, ppip->canback);
    UnlinkOp op;
    ret = plfs_backends_op(ppip,op);
    // check if we started deleting non-empty dirs, if so, restore
    if (ret==PLFS_ENOTEMPTY) {
        mlog(PLFS_DRARE, "Started removing a non-empty directory %s. "
             "Will restore.", ppip->canbpath.c_str());
        CreateOp cop(mode);
        cop.ignoreErrno(PLFS_EEXIST);
        plfs_backends_op(ppip,cop); // don't overwrite ret
    }
    return(ret);
}
Exemplo n.º 14
0
 Surface& Surface::operator= (const Surface &other)
 {
     if(&other != this && *this != other)
     {
         if(*this)
         {
             Surface cop(other);
             surf.swap(cop.surf);
         }
         
         setFile(other.getFile());
         
         if(other.isLoaded())
             FileLoadable::load();
         else
             FileLoadable::unload();
     }
     
     return *this;
 }
Exemplo n.º 15
0
void ImageProvider::keyPressEvent(int i) {
    switch (i) {
        case 16777234:
            prev(1);
            break;
        case 16777236:
            next(1);
            break;
        case 91      :
            prev(100);
            break;
        case 93      :
            next(100);
            break;
        case 16777223:
            del();
            break;
        case 32      :
            cop();
            break;
        case 69      :
            exp();
            break;
        case 66      :
            toggleBlur();
            break;
        case 44      :
            loadNewDir(-1);
            break;
        case 46      :
            loadNewDir(1);
            break;
        case 71      :
        case 1055    :
            goTo();
            break;
        default      :
            qDebug() << i;
            break;
    }
}
void flowgraph::copy_from( const flowgraph& f )
{
   copier cop( &f, this );
   visitnodes( cop, const_cast< flowgraph::node* > ( & ( f.b )), &( f.e ));

   ASSERT( cop. moved. size( ) == n );

   // It remains to update the connections:

   for( std::map< const node* , node* > :: const_iterator
           p = cop. moved. begin( );
           p != cop. moved. end( );   
           ++ p )
   {
      cop. copy( p -> first -> pred, p -> second -> pred );
      cop. copy( p -> first -> succ, p -> second -> succ );
   }

   cop. copy( f. b. pred, b. pred );
   cop. copy( f. b. succ, b. succ ); 
}
Exemplo n.º 17
0
// TODO:  We should perhaps try to make this be atomic.
// Currently it is just gonna to try to remove everything
// if it only does a partial job, it will leave something weird
plfs_error_t
ContainerFileSystem::unlink(struct plfs_physpathinfo *ppip)
{
    plfs_error_t ret = PLFS_SUCCESS;
    UnlinkOp op;  // treats file and dirs appropriately

    string unlink_canonical = ppip->canbpath;
    string unlink_canonical_backend = ppip->canback->bmpoint;
    struct plfs_pathback unpb;
    unpb.bpath = unlink_canonical;
    unpb.back = ppip->canback;

    struct stat stbuf;
    if ( (ret = unpb.back->store->Lstat(unlink_canonical.c_str(),
                                        &stbuf)) != 0)  {
        return(ret);
    }
    mode_t mode = Container::getmode(unlink_canonical, ppip->canback);
    // ignore ENOENT since it is possible that the set of files can contain
    // duplicates
    // duplicates are possible bec a backend can be defined in both
    // shadow_backends and backends

    op.ignoreErrno(PLFS_ENOENT);
    ret = plfs_file_operation(ppip, op);
    // if the directory is not empty, need to restore backends to their 
    // previous state
    if (ret == PLFS_ENOTEMPTY) {
        CreateOp cop(mode);
        cop.ignoreErrno(PLFS_EEXIST);
        /* XXX: ignores return value */
        plfs_backends_op(ppip, cop); 
        ContainerFileSystem::chown(ppip, stbuf.st_uid, stbuf.st_gid );
    }
    return(ret);
}
Exemplo n.º 18
0
void BL_SkinDeformer::BGEDeformVerts()
{
	Object *par_arma = m_armobj->GetArmatureObject();
	MDeformVert *dverts = m_bmesh->dvert;
	bDeformGroup *dg;
	int defbase_tot = BLI_countlist(&m_objMesh->defbase);

	if (!dverts)
		return;

	if (m_dfnrToPC == NULL)
	{
		m_dfnrToPC = new bPoseChannel*[defbase_tot];
		int i;
		for (i=0, dg=(bDeformGroup*)m_objMesh->defbase.first;
			dg;
			++i, dg=(bDeformGroup*)dg->next)
		{
			m_dfnrToPC[i] = BKE_pose_channel_find_name(par_arma->pose, dg->name);

			if (m_dfnrToPC[i] && m_dfnrToPC[i]->bone->flag & BONE_NO_DEFORM)
				m_dfnrToPC[i] = NULL;
		}
	}

	MDeformVert *dv= dverts;

	for (int i=0; i<m_bmesh->totvert; ++i, dv++)
	{
		float contrib = 0.f, weight, max_weight=0.f;
		bPoseChannel *pchan=NULL;
		Eigen::Map<Eigen::Vector3f> norm(m_transnors[i]);
		Eigen::Vector4f vec(0, 0, 0, 1);
		Eigen::Matrix4f norm_chan_mat;
		Eigen::Vector4f co(m_transverts[i][0],
							m_transverts[i][1],
							m_transverts[i][2],
							1.f);

		if (!dv->totweight)
			continue;

		MDeformWeight *dw= dv->dw;

		for (unsigned int j= dv->totweight; j != 0; j--, dw++)
		{
			const int index = dw->def_nr;

			if (index < defbase_tot && (pchan=m_dfnrToPC[index]))
			{
				weight = dw->weight;

				if (weight)
				{
					Eigen::Vector4f cop(co);
					Eigen::Matrix4f chan_mat = Eigen::Matrix4f::Map((float*)pchan->chan_mat);

					// Update Vertex Position
					cop = chan_mat*cop;
					vec += (cop - co)*weight;

					// Save the most influential channel so we can use it to update the vertex normal
					if (weight > max_weight)
					{
						max_weight = weight;
						norm_chan_mat = chan_mat;
					}

					contrib += weight;
				}
			}
		}

		
		// Update Vertex Normal
		norm = norm_chan_mat.topLeftCorner<3, 3>()*norm;
				
		if (contrib > 0.0001f)
		{
			vec *= 1.f/contrib;
			co += vec;
		}

		m_transverts[i][0] = co[0];
		m_transverts[i][1] = co[1];
		m_transverts[i][2] = co[2];
	}
	m_copyNormals = true;
}
Exemplo n.º 19
0
void CPath::_generatePathShape()
{
	_pathShapeVertices.clear();
	_pathShapeIndices.clear();
	_pathShapeNormals.clear();
	int pts=shapingCoordinates.size()/2;
	float l=pathContainer->getBezierNormalPathLength();
	if (l==0.0f)
		return;
	int elements=int(l/_shapingElementMaxLength)+1;
	float dl=l/float(elements);
	float pos=0.0f;
	C3Vector upVect;

	for (int i=0;i<elements+1;i++)
	{
		if ( (i==elements)&&(pathContainer->getAttributes()&sim_pathproperty_closed_path) )
			break;
		int index;
		float t;
		pathContainer->getPointOnBezierCurveAtNormalDistance(pos,index,t);
		C4X4Matrix m(pathContainer->_getInterpolatedBezierCurvePoint(index,t));
		if (i==0)
			upVect=m.M.axis[0];
		else
		{
			if (!_shapingFollowFullOrientation)
			{
				if (m.M.axis[2].getAngle(upVect)<1.0f*degToRad)
					upVect=m.M.axis[0]; // This becomes the new up vector
				else
				{
					m.M.axis[1]=(m.M.axis[2]^upVect).getNormalized();
					m.M.axis[0]=(m.M.axis[1]^m.M.axis[2]).getNormalized();;
				}
			}
		}
		for (int j=0;j<int(shapingCoordinates.size())/2;j++)
		{
			C3Vector v(shapingCoordinates[2*j+0]*_shapingScaling,shapingCoordinates[2*j+1]*_shapingScaling,0.0f);
			v=m*v;
			_pathShapeVertices.push_back(v(0));
			_pathShapeVertices.push_back(v(1));
			_pathShapeVertices.push_back(v(2));
		}
		pos+=dl;
	}
	if (!_shapingConvexHull)
	{ // Not using the element-wise convex hull
		for (int i=0;i<elements;i++)
		{
			for (int j=0;j<pts;j++)
			{
				int ind[4]={i*pts+j+0,i*pts+j+1,(i+1)*pts+j+1,(i+1)*pts+j+0};
				if ( (i==elements-1)&&(pathContainer->getAttributes()&sim_pathproperty_closed_path) )
				{
					ind[2]=j+1;
					ind[3]=j+0;
				}
				if (j==pts-1)
				{
					if (!_shapingSectionClosed)
						break;
					ind[0]=i*pts+j;
					ind[1]=i*pts+0;
					ind[2]=(i+1)*pts+0;
					ind[3]=(i+1)*pts+j;
					if ( (i==elements-1)&&(pathContainer->getAttributes()&sim_pathproperty_closed_path) )
					{
						ind[2]=0;
						ind[3]=j;
					}
				}
				_pathShapeIndices.push_back(ind[0]);
				_pathShapeIndices.push_back(ind[1]);
				_pathShapeIndices.push_back(ind[3]);

				_pathShapeIndices.push_back(ind[1]);
				_pathShapeIndices.push_back(ind[2]);
				_pathShapeIndices.push_back(ind[3]);
			}
		}
	}
	else
	{ // Using the element-wise convex hull for generation
		std::vector<float> cop(_pathShapeVertices);
		_pathShapeVertices.clear();
		_pathShapeIndices.clear();
		for (int i=0;i<elements;i++)
		{
			std::vector<float> tmpVert;
			for (int k=0;k<2;k++)
			{
				for (int j=0;j<pts;j++)
				{
					if ( (i==elements-1)&&(k==1)&&(pathContainer->getAttributes()&sim_pathproperty_closed_path) )
					{ // This is the closing part (closed path)
						tmpVert.push_back(cop[3*((0)*pts+j)+0]);
						tmpVert.push_back(cop[3*((0)*pts+j)+1]);
						tmpVert.push_back(cop[3*((0)*pts+j)+2]);
					}
					else
					{
						tmpVert.push_back(cop[3*((i+k)*pts+j)+0]);
						tmpVert.push_back(cop[3*((i+k)*pts+j)+1]);
						tmpVert.push_back(cop[3*((i+k)*pts+j)+2]);
					}
				}
			}
			std::vector<float> vertOut;
			std::vector<int> indOut;
			CMeshRoutines::getConvexHull(&tmpVert,NULL,&vertOut,&indOut);
			// We need to remove the extremities (we want open tubes)
			std::vector<int> map;
			for (int j=0;j<int(vertOut.size())/3;j++)
			{ // We first find the mapping between input and output vertices:
				map.push_back(-1);
				for (int k=0;k<int(tmpVert.size())/3;k++)
				{
					if ( (vertOut[3*j+0]==tmpVert[3*k+0])&&(vertOut[3*j+1]==tmpVert[3*k+1])&&(vertOut[3*j+2]==tmpVert[3*k+2]) )
					{
						map[j]=k;
						break;
					}
				}
			}
			for (int j=0;j<int(indOut.size())/3;j++)
			{ 
				if ( ( (map[indOut[3*j+0]]<pts)&&(map[indOut[3*j+1]]<pts)&&(map[indOut[3*j+2]]<pts) )||
					( (map[indOut[3*j+0]]>=pts)&&(map[indOut[3*j+1]]>=pts)&&(map[indOut[3*j+2]]>=pts) ) )
				{ // We make it artificially degenerate:
					indOut[3*j+0]=0;
					indOut[3*j+1]=0;
				}
			}
			// We remove the degenerate triangles:
			CMeshManip::checkVerticesIndicesNormalsTexCoords(vertOut,indOut,NULL,NULL,true,0.00001f,true);
			// we merge the individual elements
			CMeshManip::mergeWith(&_pathShapeVertices,&_pathShapeIndices,NULL,&vertOut,&indOut,NULL);
		}
		// We make a final check of the resulting shape:
		CMeshManip::checkVerticesIndicesNormalsTexCoords(_pathShapeVertices,_pathShapeIndices,NULL,NULL,true,0.00001f,true);
	}
	CMeshManip::getNormals(&_pathShapeVertices,&_pathShapeIndices,&_pathShapeNormals);
}
Exemplo n.º 20
0
int main(int argc, char** argv)
{
	if(argc != 6)
	{
		std::cerr << "usage: ./fastq_trimer trim_5p_len trim_3p_len is_rc[0|1] input_file output_file" << std::endl;
		return 0;
	}
	int trim5_len = std::stoi(argv[1]); //3 len barcode
	int trim3_len = std::stoi(argv[2]); //30 len adapter
	int is_rc = std::stoi(argv[3]); // is reverse complement
	std::string infn (argv[4]); //input file name
	std::string outfn (argv[5]); //output file name

	std::cout << "trim5_len: " << trim5_len << " trim3_len: " << trim3_len << " is_rc: " << is_rc << std::endl;
	std::ifstream in(infn);
	std::ofstream out(outfn);

	std::string fastq("");
	bool is_N(false);
	std::string line;

	int fastq_count = 0;

	while(!in.eof())
	{
		//fastq 1st line
		std::getline(in, line);
		if(line == "")
			break;
		if(fastq_count == 0)
			fastq += line;
		else
			fastq += "\n"+line;

		//fastq 2st line
		std::getline(in, line);
		line = line.substr(trim5_len, line.size() - trim5_len - trim3_len);
		if(is_rc)
		{
			is_N = cop(line);
			std::reverse(line.begin(), line.end());
		}
		fastq += "\n"+line;

		//fastq 3st line
		std::getline(in, line);
		fastq += "\n"+line;

		//fastq 4st line
		std::getline(in, line);
		line = line.substr(trim5_len, line.size() - trim5_len - trim3_len);
		if(is_rc)
		{
			std::reverse(line.begin(), line.end());
		}
		fastq += "\n"+line;

		if(!is_N)
		{
			out << fastq;
			is_N = false;
			fastq = "";
		}
		++fastq_count;
	}
	std::cout << "fastq count: " << fastq_count << std::endl;
	in.close();
	out.close();
	return 0;
}
 forAll(map, i)
 {
     cop(lhs[map[i]], rhs[i]);
 }
Exemplo n.º 22
0
 forAll(nbr, i)
 {
     label cellI = nbr[i];
     cop(result[cellI], ssf[i]);
 }