Пример #1
0
void for_node(Token *tk)
{// for statement
	int *back, *gap;
	tk->stype = For;
	next(tk);
	if (!(tk->id == '(')) PANIC("expected left parenthesis after for", tk->line);
	next(tk);				// the first argument
	expr(tk);
	if (!empty()) assembly(pop());
	back = ps.pc;			// set the jump back position
	next(tk);				// the second argument
	expr(tk);
	assembly(pop());
	*ps.pc++ = BZ;			// set the test position
	gap = ps.pc++;
	next(tk);				// the third argument
	expr(tk);
	bool last = true;
	Node third;
	if (!empty())
		third = pop();		// pop out the last argument
	else last = false;
	if (!(tk->id == ')'))
		PANIC("expected right parenthesis in for statement", tk->line);
	tk->stype = 0;
	next(tk);
	if (tk->id == '{') block(tk);
	else stmt(tk);
	if (last) assembly(third);
	*ps.pc++ = JMP;
	*ps.pc = -(ps.pc - back);
	++ps.pc;
	*gap = (ps.pc - gap);
}
Пример #2
0
void
SubProblem::reinitNeighborFaceRef(const Elem * neighbor_elem,
                                  unsigned int neighbor_side,
                                  BoundaryID bnd_id,
                                  Real tolerance,
                                  const std::vector<Point> * const pts,
                                  const std::vector<Real> * const weights,
                                  THREAD_ID tid)
{
  // - Set our _current_neighbor_elem for proper dof index getting in the moose variables
  // - Reinitialize all of our FE objects so we have current phi, dphi, etc. data
  // Note that our number of shape functions will reflect the number of shapes associated with the
  // interior element while the number of quadrature points will be determined by the passed pts
  // parameter (which presumably will have a number of pts reflective of a facial quadrature rule)
  assembly(tid).reinitNeighborFaceRef(neighbor_elem, neighbor_side, tolerance, pts, weights);

  // Actually get the dof indices in the moose variables
  systemBaseNonlinear().prepareNeighbor(tid);
  systemBaseAuxiliary().prepareNeighbor(tid);

  // With the dof indices set in the moose variables, now let's properly size
  // our local residuals/Jacobians
  assembly(tid).prepareNeighbor();

  // Let's finally compute our variable values!
  systemBaseNonlinear().reinitNeighborFace(neighbor_elem, neighbor_side, bnd_id, tid);
  systemBaseAuxiliary().reinitNeighborFace(neighbor_elem, neighbor_side, bnd_id, tid);
}
Пример #3
0
void if_node(Token *tk)
{// if statement
	int *gap;
	next(tk);
	if (tk->id != '(') PANIC("expected left parenthesis after if", tk->line);
	tk->stype = Arg;
	next(tk);
	expr(tk);
	if (tk->id != ')')
		PANIC("expected right parenthesis in if statement", tk->line);
	tk->stype = 0;
	assembly(pop());
	*ps.pc++ = BZ;
	gap = ps.pc++;
	next(tk);
	if (tk->id == '{') block(tk);
	else stmt(tk);
    if (peek(tk) == Else) {
		next(tk);
		*ps.pc++ = JMP;
		*gap = (ps.pc - gap + 1);
		gap = ps.pc++;
		next(tk);
		if (tk->id == If) {
			if_node(tk);
		} else {
			if (tk->id == '{') block(tk);
			else stmt(tk);
		}
	}
	*gap = (ps.pc - gap);
}
Пример #4
0
void AssemblyCollectionItem::slot_create()
{
    const string assembly_name =
        get_entity_name_dialog(
            treeWidget(),
            "Create Assembly",
            "Assembly Name:",
            make_unique_name("assembly", m_parent.assemblies()));

    // todo: schedule creation of assembly when rendering.
    if (!assembly_name.empty())
    {
        auto_release_ptr<Assembly> assembly(
            AssemblyFactory().create(assembly_name.c_str(), ParamArray()));

        AssemblyItem* assembly_item =
            static_cast<AssemblyItem*>(m_parent_item->add_item(assembly.get()));

        m_parent.assemblies().insert(assembly);

        const string assembly_instance_name =
            make_unique_name(
                assembly_name + "_inst",
                m_parent.assembly_instances());

        assembly_item->instantiate(assembly_instance_name);

        m_editor_context.m_project_builder.slot_notify_project_modification();
    }
}
Пример #5
0
int main(int argc, char *argv[])
{
	assembly();
	Compiler::Assembler::runAssemblerUnitTests();
	Compiler::AbstractSyntaxTree::runASTUnitTests();
	return 0;
}
Пример #6
0
// we first define an assembly which contains the world assembly. This "uberMaster" contains the global transformation.
void defineMasterAssembly(renderer::Project* project)
{
    MMatrix conversionMatrix;
    conversionMatrix.setToIdentity();
    World* world = getWorldPtr();
    if (world != 0)
    {
        RenderGlobals* rg = world->mRenderGlobals.get();
        if (rg != 0)
            conversionMatrix = rg->globalConversionMatrix;
    }
    if (getSceneFromProject(project)->assemblies().get_by_name("world") == 0)
    {
        foundation::auto_release_ptr<renderer::Assembly> assembly(renderer::AssemblyFactory().create("world", renderer::ParamArray()));
        getSceneFromProject(project)->assemblies().insert(assembly);
        foundation::Matrix4d appMatrix;
        MMatrix transformMatrix;
        transformMatrix.setToIdentity();
        transformMatrix *= conversionMatrix;
        foundation::auto_release_ptr<renderer::AssemblyInstance> assemblyInstance = renderer::AssemblyInstanceFactory::create("world_Inst", renderer::ParamArray(), "world");
        MMatrixToAMatrix(transformMatrix, appMatrix);
        assemblyInstance->transform_sequence().set_transform(0.0, foundation::Transformd::from_local_to_parent(appMatrix));
        getSceneFromProject(project)->assembly_instances().insert(assemblyInstance);
    }
}
Пример #7
0
TreeScreen::TreeScreen(QWidget *parent) : QWidget(parent)
{
    setupActions();
    setupUI();
    setupModels();
    setupSignals();
    assembly();
}
EditorMultiLineInputDialog::EditorMultiLineInputDialog(QWidget *parent) : QDialog(parent)
{
  sizeCoefficient=1.0;

  setupUi();
  setupSignals();
  assembly();
}
EditorTablePropertiesForm::EditorTablePropertiesForm()
{
  directSetAlign=false;

  setupUi();
  setupSignals();
  assembly();
}
Пример #10
0
EditorFindDialog::EditorFindDialog(QWidget *parent) : QDialog(parent)
{
 setup_ui();
 setup_signals();
 assembly();

 showEvent(new QShowEvent());
}
FindTableWidget::FindTableWidget(QWidget *parent) : QWidget(parent)
{
    setupUI();
    setupModels();
    setupSignals();
    assembly();

    clearAll();
}
Пример #12
0
EnterPassword::EnterPassword(int imode, QWidget *parent) : QDialog(parent)
{
 mode=imode;
 password="";
 previousPassword="";
 cancelDelay=0;
 isPasswordTyped=false;

 setupUI();
 setupSignals();
 assembly();
}
Пример #13
0
//----------------//
// The simulation //
//----------------//
void *sim(void *parameters)
{
    // LOCAL COPY OF THE PARAMETERS
    //-----------------------------
    Params p0;
    memcpy(&p0, parameters, sizeof(Params));


    // GSL'S TAUS GENERATOR
    //---------------------
    gsl_rng *rng = gsl_rng_alloc(gsl_rng_taus2);


    // INITIALIZE THE GSL GENERATOR WITH /dev/urandom
    //-----------------------------------------------
    const unsigned long seed = devurandom_get_uint();
    //const unsigned long seed = 1138773677;
    p0.rng = rng;
    gsl_rng_set(rng, seed); // Seed with time


    // PRINT THE SEED
    //---------------
    printf("<seed>%lu</seed>\n", seed);


    // CHOOSE THE SP TYPE MODE
    //------------------------
    if (EAM_SP_TYPE_MODE)
    {
        p0.sp_type = (gsl_rng_uniform(p0.rng) < 0.5) ? 1 : 2;
    }
    else
    {
        p0.sp_type = 0;
    }

    // RUN THE ASSEMBLY
    //-----------------
    assembly(&p0, seed);
 

    // PRINT THE SEED
    //---------------
    printf("<seed>%lu</seed>\n", seed);


    // FREE THE MEMORY
    //----------------
    gsl_rng_free(rng);
    return NULL;
}
Пример #14
0
void
SubProblem::reinitLowerDElemRef(const Elem * elem,
                                const std::vector<Point> * const pts,
                                const std::vector<Real> * const weights,
                                THREAD_ID tid)
{
  // - Set our _current_lower_d_elem for proper dof index getting in the moose variables
  // - Reinitialize all of our lower-d FE objects so we have current phi, dphi, etc. data
  assembly(tid).reinitLowerDElemRef(elem, pts, weights);

  // Actually get the dof indices in the moose variables
  systemBaseNonlinear().prepareLowerD(tid);
  systemBaseAuxiliary().prepareLowerD(tid);

  // With the dof indices set in the moose variables, now let's properly size
  // our local residuals/Jacobians
  assembly(tid).prepareLowerD();

  // Let's finally compute our variable values!
  systemBaseNonlinear().reinitLowerD(tid);
  systemBaseAuxiliary().reinitLowerD(tid);
}
Пример #15
0
EditorImageProperties::EditorImageProperties(QWidget *parent) : QDialog(parent)
{
 imageRealWidth=0;
 imageRealHeight=0;

 // Флаг, используемый для запрещения цикличного взаимного изменения
 // высоты и ширины
 isRelateSizeSetted=false;

 setup_ui();
 setup_signals();
 assembly();
}
Пример #16
0
void stmt(Token *tk)
{// statement
	make_empty();
	if 		(tk->id == If) 	  if_node(tk);
	else if (tk->id == While) while_node(tk);
	else if (tk->id == For)	  for_node(tk);
	else if (tk->id == Int)   int_node(tk);
	else if (tk->id == Ret)   return_node(tk);
	else if (tk->id == Prtf)  printf_node(tk);
	else if (tk->id == Stru)  struct_dec(tk);
	else if (tk->id == ';')   next(tk);
	else if (tk->id == '}')   return ;
	else { expr(tk); assembly(pop()); }
}
Пример #17
0
RecordTableScreen::RecordTableScreen(QWidget *parent) : QWidget(parent)
{
  // Инициализируется контроллер списка записей
  recordTableController=new RecordTableController(this);
  recordTableController->setObjectName("recordTableController");

  setupActions();

  recordTableController->init();


  setupUI();
 
  setupSignals();
  assembly();
}
Пример #18
0
auto_release_ptr<Project> DefaultProjectFactory::create()
{
    // Create a project.
    auto_release_ptr<Project> project(ProjectFactory::create("default"));

    // Add default configurations to the project.
    project->add_default_configurations();

    // Create a scene.
    auto_release_ptr<Scene> scene(SceneFactory::create());

    // Create an assembly.
    auto_release_ptr<Assembly> assembly(AssemblyFactory().create("assembly"));

    // Create an instance of the assembly and insert it into the scene.
    scene->assembly_instances().insert(
        AssemblyInstanceFactory::create(
            "assembly_inst",
            ParamArray(),
            "assembly"));

    // Insert the assembly into the scene.
    scene->assemblies().insert(assembly);

    // Create a pinhole camera and attach it to the scene.
    scene->set_camera(
        PinholeCameraFactory().create(
            "camera",
            ParamArray()
                .insert("film_dimensions", "0.01024 0.00576")
                .insert("focal_length", "0.035")));

    // Create a frame (quarter 2K resolution) and attach it to the project.
    project->set_frame(
        FrameFactory::create(
            "beauty",
            ParamArray()
                .insert("camera", scene->get_camera()->get_name())
                .insert("resolution", "1024 576")));

    // Attach the scene to the project.
    project->set_scene(scene);

    // Return the newly created project.
    return project;
}
Пример #19
0
void drawScene()
{
    GLfloat x,y,z;
        
    glColor3f(1.0f,1.0f,1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    glPushMatrix();
    keySpecialOperations();/*
    if(keyStates['w'])
    {
         fprintf(stdout,"* cameraz=%f\nreferencez=%f\n",cameraz,referencez);
    }*/
    //gluLookAt(-5*TRACK_WIDTH-13.5,12,18,-TRACK_WIDTH-13.5,2,-1,0,1,0);
    gluLookAt(camerax,cameray,cameraz,referencex,referencey,referencez,upx,upy,upz);
    // tack draw
    trackStraight(-(TRACK_WIDTH/2.0f),(TRACK_WIDTH/2.0f),-(6*TorusRadius),0);
    trackStraight(-(TRACK_WIDTH/2.0f),(TRACK_WIDTH/2.0f),0,3*CAR_LENGTH);
    bumpdraw(-(TRACK_WIDTH/2.0f)-1.5,CAR_LENGTH,1);
    BumpyTrack(-(TRACK_WIDTH/2.0f),(TRACK_WIDTH/2.0f),3*CAR_LENGTH,6*CAR_LENGTH,(TorusRadius/2.0f));
    trackStraight(-(TRACK_WIDTH/2.0f),(TRACK_WIDTH/2.0f),6*CAR_LENGTH,9*CAR_LENGTH);
    bumpdraw((TRACK_WIDTH/2.0f),6*CAR_LENGTH,0);
    for(GLint i=0;i<=3*GRASS_WIDTH;i+=GRASS_WIDTH)
    {
          grass(-(TRACK_WIDTH/2.0f)-i,(TRACK_WIDTH/2.0f)-i,-(6*TorusRadius),0);
          grass(-(TRACK_WIDTH/2.0f)-i,(TRACK_WIDTH/2.0f)-i,1,3*CAR_LENGTH);
          grass(-(TRACK_WIDTH/2.0f)-i,(TRACK_WIDTH/2.0f)-i,3*CAR_LENGTH+1,6*CAR_LENGTH);
          grass(-(TRACK_WIDTH/2.0f)-i,(TRACK_WIDTH/2.0f)-i,6*CAR_LENGTH+1,9*CAR_LENGTH-1);
    }
    turnleft(-(TRACK_WIDTH/2.0f)-1,6*CAR_LENGTH,1);
    trackTurnLeft(-(TRACK_WIDTH/2.0f),(TRACK_WIDTH/2.0f),9*CAR_LENGTH,13*CAR_LENGTH,0,180.0f);
    trackStraight(-5*TRACK_WIDTH-2.25,-4*TRACK_WIDTH-2.25,6*CAR_LENGTH,9*CAR_LENGTH);
    BumpyTrack(-5*TRACK_WIDTH-2.25,-4*TRACK_WIDTH-2.25,3*CAR_LENGTH,6*CAR_LENGTH,(TorusRadius/2.0f));
    trackStraight(-5*TRACK_WIDTH-2.25,-4*TRACK_WIDTH-2.25,0,3*CAR_LENGTH);
    trackStraight(-5*TRACK_WIDTH-2.25,-4*TRACK_WIDTH-2.25,-(6*TorusRadius),0);
    trackTurnLeft(-(TRACK_WIDTH/2.0f),(TRACK_WIDTH/2.0f),-1.2*CAR_LENGTH,2.8*CAR_LENGTH,180.0f,355.5f);
    //trackTurnRight(-(int)(TRACK_WIDTH/2.0f)-1,(int)(TRACK_WIDTH/2.0f),8*CAR_LENGTH,12*CAR_LENGTH,180.0f);
    glTranslatef(0.0f,TorusRadius-(TorusRadius/2.75),0.0f);
    glScalef(0.5f,0.5f,0.5f);
    assembly();
    glScalef(2.0f,2.0f,2.0f);
    glTranslatef(0.0f,-TorusRadius+(TorusRadius/2.75),0.0f);
    glFlush();
    glPopMatrix();   
}
Пример #20
0
void return_node(Token *tk)
{// return statement
	next(tk);
	Node node;
	node.id = Ret;
	node.rtag = 0;
	if(tk->id == ';') {
		node.ltag = 0;
	} else {
		expr(tk);
		Node l = pop();
		if (l.id) {
			node.ltag = 1;
			node.left.n = (Node *)malloc(sizeof(Node));
			*(node.left.n) = l;
		} else {
			node.ltag = 2;
			node.left.l = (Leaf *)malloc(sizeof(Leaf));
			*(node.left.l) = *(l.left.l);
		}
	}
	assembly(node);
}
Пример #21
0
void while_node(Token *tk)
{// while statement
	int *back, *gap;
	back = ps.pc;
	next(tk);
	if (!(tk->id == '(')) PANIC("expected left parenthesis after while", tk->line);
	tk->stype = Arg;
	next(tk);
	expr(tk);
	if (!(tk->id == ')'))
		PANIC("expected right parenthesis in while statement", tk->line);
	tk->stype = 0;
	assembly(pop());
	*ps.pc++ = BZ;
	gap = ps.pc++;
	next(tk);
	if (tk->id == '{') block(tk);
	else stmt(tk);
	*ps.pc++ = JMP;
	*ps.pc = -(ps.pc - back);
	++ps.pc;
	*gap = (ps.pc - gap);
}
Пример #22
0
renderer::Assembly* createAssembly(const MayaObject* obj)
{
    MayaObject* assemblyObject = getAssemblyMayaObject(obj);

    boost::shared_ptr<AppleseedRenderer> appleRenderer = boost::static_pointer_cast<AppleseedRenderer>(getWorldPtr()->mRenderer);
    renderer::Assembly* master = getMasterAssemblyFromProject(appleRenderer->getProjectPtr());
    if (obj->mobject.hasFn(MFn::kLight) && !obj->mobject.hasFn(MFn::kAreaLight))
        return master;

    if (assemblyObject == 0)
        return master;

    MString assemblyName = getAssemblyName(assemblyObject);

    if (assemblyName == "world")
        return master;

    foundation::auto_release_ptr<renderer::Assembly> assembly(
        renderer::AssemblyFactory().create(assemblyName.asChar(), renderer::ParamArray()));
    renderer::Assembly* ass = assembly.get();
    master->assemblies().insert(assembly);

    return ass;
}
MultiLayerNet *MultiLayerFactory::allocMemory(MultiLayerNet *bpNewNet) {

    NeuVec *prevLayer;
    NeuVec *curLayer;
    uint i, j;

    //---------------
    // Creating first Layer
    //---------------
    NeuVec *firstLayer = new NeuVec();
    uint firstNeuroCount = nnInfo.neuronsPerLayer[0];


    for(j = 0; j < firstNeuroCount; ++j)
        firstLayer->append(new Neuron);

    prevLayer = firstLayer;
    //---------------

    NeuVec inToSend = *firstLayer;

    for(i = 1; i < nnInfo.layersCount; ++i){
        curLayer = new NeuNets::NeuVec();
        uint neuroCount = nnInfo.neuronsPerLayer[i];

        for(j = 0; j < neuroCount; ++j)
            curLayer->append(new Neuron);

        assembly(*prevLayer, *curLayer, i);
        prevLayer = curLayer;
    }
    NeuVec outToSend = *curLayer;
    bpNewNet = new MultiLayerNet(FuncDisp::func(nnInfo.funcName) , inToSend, outToSend, nnInfo.layersCount);
    bpNewNet->setName(nnInfo.netName);
    return bpNewNet;
}
Пример #24
0
int 
main (int argc, char * argv[])
{
  int                   i, trim_len_fw, trim_len_rev;
  //struct reads_info  ** ri_left;
  //struct reads_info  ** ri_right;
//  int                   cnt_reads_left;
//  int                   cnt_reads_right;
  int                   read_size;
  char                * out[4];
  FILE                * fd[4];
  int                   ass;
  double                uncalled_forward, uncalled_reverse;
  struct user_args      sw;
  struct emp_freq * ef;
  struct block_t fwd_block;
  struct block_t rev_block;
  char                  two_piece;
  int elms;

  if (!decode_switches (argc, argv, &sw))
   {
     /* TODO: Validate reads names */
     usage ();
     return (EXIT_FAILURE);
   }

  ef = (struct emp_freq *)malloc (sizeof(struct emp_freq));
  ef->freqa = ef->freqc = ef->freqg = ef->freqt = ef->total = ef->pa = ef->pc = ef->pg = ef->pt = ef->q = 0.25;

  init_scores(sw->phred_base, ef);
  /* read the two fastq files containing the left-end and right-end reads */
  //ri_left  = read_fastq(sw.fastq_left,  &cnt_reads_left);
  //ri_right = read_fastq(sw.fastq_right, &cnt_reads_right);

  //if (!validate_input (cnt_reads_left, cnt_reads_right))
  // {
  //   return (EXIT_FAILURE);
  // }

  // read_size = strlen (ri_left[0]->data);

  /* TODO: THIS IS WRONG!!!! TO GET EMPIRICAL FREQUENCIES WE NEED TO READ THE WHOLE FILE :-( */
  //ef = get_emp_freq (cnt_reads_right, read_size, fwd_block.reads, rev_block.reads);

  /* reverse the right ends */

  /* allocate memory for the assembled results */
  /*
  ai = (struct asm_info *) malloc (cnt_reads_left * sizeof(struct asm_info));
  for (i = 0; i < cnt_reads_left; ++i)
   {
     ai[i].data          = (char *) malloc ((2 * read_size + 1) * sizeof(char));
     ai[i].quality_score = (char *) malloc ((2 * read_size + 1) * sizeof(char));
   }
  */
  

  init_fastq_reader (sw.fastq_left, sw.fastq_right, sw.memory, &fwd_block, &rev_block);

  /* construct output file names */
  out[0] = makefilename (sw.outfile, ".assembled.fastq");
  out[1] = makefilename (sw.outfile, ".unassembled.forward.fastq");
  out[2] = makefilename (sw.outfile, ".unassembled.reverse.fastq");
  out[3] = makefilename (sw.outfile, ".discarded.fastq");

  fd[0] = fopen (out[0], "w");
  fd[1] = fopen (out[1], "w");
  fd[2] = fopen (out[2], "w");
  fd[3] = fopen (out[3], "w");


  while (1)
   {
     elms = get_next_reads (&fwd_block, &rev_block);
     if (!elms) break;
     read_size = strlen (fwd_block.reads[0]->data);
//     printf ("%d elms (Seq)\n", elms);
     
     //#pragma omp parallel shared(fwd_block.reads, rev_block.reads, ai) private(i, ass, uncalled, kassian_result) 
     #pragma omp parallel private(i, ass) 
     {
       /* flags[i] = 1 (assembled)  0 (discarded) 2 (unassembled) */
       #pragma omp for schedule (guided)
       for (i = 0; i < elms; ++ i)
        {
          mstrrev (rev_block.reads[i]->data);
          mstrcpl (rev_block.reads[i]->data);
          mstrrev (rev_block.reads[i]->qscore);
          if (sw.emp_freqs == 0)
           {
             ass = assembly (fwd_block.reads[i], rev_block.reads[i], &sw);
             *(fwd_block.reads[i]->qscore - 1) = ass;
           }
          else
          {
             ass = assembly_ef (fwd_block.reads[i], rev_block.reads[i], ef, &sw);
             *(fwd_block.reads[i]->qscore - 1) = ass;
           }
        }
     }

     for ( i = 0; i < elms; ++ i)
      {
        two_piece = *(fwd_block.reads[i]->data - 1);
        *(fwd_block.reads[i]->data - 1) = 0;

        if (*(fwd_block.reads[i]->qscore - 1) == 1)   /* assembled */
         {
           *(fwd_block.reads[i]->qscore - 1) = 0;
           fprintf (fd[0], "%s\n", fwd_block.reads[i]->header);
           if (!two_piece)
            {
              fprintf (fd[0], "%s\n", fwd_block.reads[i]->data);
            }
           else
            {
              fprintf (fd[0], "%s",   fwd_block.reads[i]->data);
              fprintf (fd[0], "%s\n", rev_block.reads[i]->data);
            }
           fprintf (fd[0], "+\n");

           if (!two_piece)
            {
              fprintf (fd[0], "%s\n", fwd_block.reads[i]->qscore);
            }
           else
            {
              fprintf (fd[0], "%s",   fwd_block.reads[i]->qscore);
              fprintf (fd[0], "%s\n", rev_block.reads[i]->qscore);
            }
         }
        else                                            /* not assembled */
         {
           *(fwd_block.reads[i]->qscore - 1) = 0;
           trim_len_fw  = trim (fwd_block.reads[i], &sw, read_size, &uncalled_forward);
           trim_len_rev = trim_cpl (rev_block.reads[i], &sw, read_size, &uncalled_reverse);
           if (trim_len_fw < sw.min_trim_len || trim_len_rev < sw.min_trim_len || uncalled_forward >= sw.max_uncalled || uncalled_reverse >= sw.max_uncalled)
            { /* discarded reads*/
              /* Maybe consider printing the untrimmed sequences */
              fprintf (fd[3], "%s\n", fwd_block.reads[i]->header);
              fprintf (fd[3], "%s\n+\n%s\n", fwd_block.reads[i]->data,  fwd_block.reads[i]->qscore);
              fprintf (fd[3], "%s\n", rev_block.reads[i]->header);
              fprintf (fd[3], "%s\n+\n%s\n", rev_block.reads[i]->data, rev_block.reads[i]->qscore); /* printing the reverse compliment of the original sequence */
            }
           else   /* unassembled reads*/
            {
              fprintf (fd[1], "%s\n", fwd_block.reads[i]->header);
              fprintf (fd[2], "%s\n", rev_block.reads[i]->header);
              fprintf (fd[1], "%s\n+\n%s\n", fwd_block.reads[i]->data,  fwd_block.reads[i]->qscore);
              fprintf (fd[2], "%s\n+\n%s\n", rev_block.reads[i]->data, rev_block.reads[i]->qscore); /* printing the reverse compliment of the original sequence */
            }
         }
      }


   }
  
  free (ef);
  free (out[0]);
  free (out[1]);
  free (out[2]);
  free (out[3]);

  destroy_reader ();

  /* TODO: Fix those file closings */
  fclose (fd[0]);
  fclose (fd[1]);
  fclose (fd[2]);
  fclose (fd[3]);
  
  return (0);
}
Пример #25
0
ConsoleEmulator::ConsoleEmulator(QWidget *parent) : QWidget(parent)
{
 setupUI();
 setupSignals();
 assembly();
}
EditorMultiLineInputDialog::EditorMultiLineInputDialog(QWidget *parent) : QDialog(parent)
{
 setup_ui();
 setup_signals();
 assembly();
}
Пример #27
0
void
SubProblem::reinitMortarElem(const Elem * elem, THREAD_ID tid)
{
  assembly(tid).reinitMortarElem(elem);
}
Пример #28
0
asf::auto_release_ptr<asr::Project> build_project()
{
    // Create an empty project.
    asf::auto_release_ptr<asr::Project> project(asr::ProjectFactory::create("test project"));
    project->search_paths().push_back("data");

    // Add default configurations to the project.
    project->add_default_configurations();

    // Set the number of samples. This is the main quality parameter: the higher the
    // number of samples, the smoother the image but the longer the rendering time.
    project->configurations()
        .get_by_name("final")->get_parameters()
            .insert_path("uniform_pixel_renderer.samples", "25");

    // Create a scene.
    asf::auto_release_ptr<asr::Scene> scene(asr::SceneFactory::create());

    // Create an assembly.
    asf::auto_release_ptr<asr::Assembly> assembly(
        asr::AssemblyFactory().create(
            "assembly",
            asr::ParamArray()));

    //------------------------------------------------------------------------
    // Materials
    //------------------------------------------------------------------------

    // Create a color called "gray" and insert it into the assembly.
    static const float GrayReflectance[] = { 0.5f, 0.5f, 0.5f };
    assembly->colors().insert(
        asr::ColorEntityFactory::create(
            "gray",
            asr::ParamArray()
                .insert("color_space", "srgb"),
            asr::ColorValueArray(3, GrayReflectance)));

    // Create a BRDF called "diffuse_gray_brdf" and insert it into the assembly.
    assembly->bsdfs().insert(
        asr::LambertianBRDFFactory().create(
            "diffuse_gray_brdf",
            asr::ParamArray()
                .insert("reflectance", "gray")));

    // Create a physical surface shader and insert it into the assembly.
    assembly->surface_shaders().insert(
        asr::PhysicalSurfaceShaderFactory().create(
            "physical_surface_shader",
            asr::ParamArray()));

    // Create a material called "gray_material" and insert it into the assembly.
    assembly->materials().insert(
        asr::GenericMaterialFactory().create(
            "gray_material",
            asr::ParamArray()
                .insert("surface_shader", "physical_surface_shader")
                .insert("bsdf", "diffuse_gray_brdf")));

    //------------------------------------------------------------------------
    // Geometry
    //------------------------------------------------------------------------

    // Load the scene geometry from disk.
    asr::MeshObjectArray objects;
    asr::MeshObjectReader::read(
        project->search_paths(),
        "cube",
        asr::ParamArray()
            .insert("filename", "scene.obj"),
        objects);

    // Insert all the objects into the assembly.
    for (size_t i = 0; i < objects.size(); ++i)
    {
        // Insert this object into the scene.
        asr::MeshObject* object = objects[i];
        assembly->objects().insert(asf::auto_release_ptr<asr::Object>(object));

        // Create an instance of this object and insert it into the assembly.
        const std::string instance_name = std::string(object->get_name()) + "_inst";
        assembly->object_instances().insert(
            asr::ObjectInstanceFactory::create(
                instance_name.c_str(),
                asr::ParamArray(),
                object->get_name(),
                asf::Transformd::identity(),
                asf::StringDictionary()
                    .insert("default", "gray_material")
                    .insert("default2", "gray_material")));
    }

    //------------------------------------------------------------------------
    // Light
    //------------------------------------------------------------------------

    // Create a color called "light_intensity" and insert it into the assembly.
    static const float LightRadiance[] = { 1.0f, 1.0f, 1.0f };
    assembly->colors().insert(
        asr::ColorEntityFactory::create(
            "light_intensity",
            asr::ParamArray()
                .insert("color_space", "srgb")
                .insert("multiplier", "30.0"),
            asr::ColorValueArray(3, LightRadiance)));

    // Create a point light called "light" and insert it into the assembly.
    asf::auto_release_ptr<asr::Light> light(
        asr::PointLightFactory().create(
            "light",
            asr::ParamArray()
                .insert("intensity", "light_intensity")));
    light->set_transform(
        asf::Transformd::from_local_to_parent(
            asf::Matrix4d::make_translation(asf::Vector3d(0.6, 2.0, 1.0))));
    assembly->lights().insert(light);

    //------------------------------------------------------------------------
    // Assembly instance
    //------------------------------------------------------------------------

    // Create an instance of the assembly and insert it into the scene.
    asf::auto_release_ptr<asr::AssemblyInstance> assembly_instance(
        asr::AssemblyInstanceFactory::create(
            "assembly_inst",
            asr::ParamArray(),
            "assembly"));
    assembly_instance
        ->transform_sequence()
            .set_transform(
                0.0,
                asf::Transformd::identity());
    scene->assembly_instances().insert(assembly_instance);

    // Insert the assembly into the scene.
    scene->assemblies().insert(assembly);

    //------------------------------------------------------------------------
    // Environment
    //------------------------------------------------------------------------

    // Create a color called "sky_radiance" and insert it into the scene.
    static const float SkyRadiance[] = { 0.75f, 0.80f, 1.0f };
    scene->colors().insert(
        asr::ColorEntityFactory::create(
            "sky_radiance",
            asr::ParamArray()
                .insert("color_space", "srgb")
                .insert("multiplier", "0.5"),
            asr::ColorValueArray(3, SkyRadiance)));

    // Create an environment EDF called "sky_edf" and insert it into the scene.
    scene->environment_edfs().insert(
        asr::ConstantEnvironmentEDFFactory().create(
            "sky_edf",
            asr::ParamArray()
                .insert("radiance", "sky_radiance")));

    // Create an environment shader called "sky_shader" and insert it into the scene.
    scene->environment_shaders().insert(
        asr::EDFEnvironmentShaderFactory().create(
            "sky_shader",
            asr::ParamArray()
                .insert("environment_edf", "sky_edf")));

    // Create an environment called "sky" and bind it to the scene.
    scene->set_environment(
        asr::EnvironmentFactory::create(
            "sky",
            asr::ParamArray()
                .insert("environment_edf", "sky_edf")
                .insert("environment_shader", "sky_shader")));

    //------------------------------------------------------------------------
    // Camera
    //------------------------------------------------------------------------

    // Create a pinhole camera with film dimensions 0.980 x 0.735 in (24.892 x 18.669 mm).
    asf::auto_release_ptr<asr::Camera> camera(
        asr::PinholeCameraFactory().create(
            "camera",
            asr::ParamArray()
                .insert("film_dimensions", "0.024892 0.018669")
                .insert("focal_length", "0.035")));

    // Place and orient the camera. By default cameras are located in (0.0, 0.0, 0.0)
    // and are looking toward Z- (0.0, 0.0, -1.0).
    camera->transform_sequence().set_transform(
        0.0,
        asf::Transformd::from_local_to_parent(
            asf::Matrix4d::make_rotation(asf::Vector3d(1.0, 0.0, 0.0), asf::deg_to_rad(-20.0)) *
            asf::Matrix4d::make_translation(asf::Vector3d(0.0, 0.8, 11.0))));

    // Bind the camera to the scene.
    scene->set_camera(camera);

    //------------------------------------------------------------------------
    // Frame
    //------------------------------------------------------------------------

    // Create a frame and bind it to the project.
    project->set_frame(
        asr::FrameFactory::create(
            "beauty",
            asr::ParamArray()
                .insert("camera", scene->get_camera()->get_name())
                .insert("resolution", "640 480")
                .insert("color_space", "srgb")));

    // Bind the scene to the project.
    project->set_scene(scene);

    return project;
}
Пример #29
0
AppConfigPage_Misc::AppConfigPage_Misc(QWidget *parent) : ConfigPage(parent)
{
  setupUi();
  setupSignals();
  assembly();
}
Пример #30
0
 // read ps and ss from a given file
 assembly file_sse_pool::read(const std::string &__filename) { return read(__filename, assembly()); }