예제 #1
0
static duk_ret_t SignalWrapper_IAsset_Loaded_Emit(duk_context* ctx)
{
    SignalWrapper_IAsset_Loaded* wrapper = GetThisValueObject<SignalWrapper_IAsset_Loaded>(ctx, SignalWrapper_IAsset_Loaded_ID);
    if (!wrapper->owner_) return 0;
    SharedPtr<IAsset> param0(GetWeakObject<IAsset>(ctx, 0));
    wrapper->signal_->Emit(param0);
    return 0;
}
예제 #2
0
파일: editfast.c 프로젝트: pap71/vergifac
void interp()
{
  int cbi,nlu,k,j,svnuli;
  int x0,y0,xf,yf,dtxy;
  double wep=0.8;
  char typdoc[]=".doc0\0";
  char *pze;
if ( strcmp( ze,"ad1") == 0)    {
     if (param0() ==-1) return;
	 cairotext();	cairo_show_text(cr,senf.add1);
							    }
else if ( strcmp( ze,"ad2") == 0)	{
    if (param0() ==-1) return;	 
	cairotext();	cairo_show_text(cr,senf.add2);
								    }
else if ( strcmp( ze,"ad3") == 0)	{
    if (param0() ==-1) return;	
	cairotext();	cairo_show_text(cr,senf.add3);
								    }
else if ( strcmp( ze,"pays") == 0)	{
    if (param0() ==-1) return;	
	cairotext();	cairo_show_text(cr,senf.pays);
								    }
else if ( strcmp( ze,"codpos") == 0)	{
	if (param0() ==-1) return;
	cairotext();	cairo_show_text(cr,senf.codpos);
									    }
else if ( strcmp( ze,"ad4") == 0)   {
     if (param0() ==-1) return;	
	 cairotext();	cairo_show_text(cr,senf.add4);
								    }
else if ( strcmp( ze,"datdoc") == 0)    {
    if (param0() ==-1) return;	 
	cairotext();	cairo_show_text(cr,senf.datfac);
									    }
else if ( strcmp( ze,"numdoc") == 0)	{
    if (param0() ==-1) return;	
	cairotext();	cairo_show_text(cr,senf.numfac);
									    }
else if ( strcmp( ze,"typdoc") == 0)	{
    if (param0() ==-1) return;
    cbi = gtk_combo_box_get_active(GTK_COMBO_BOX(cbtypdoc));
    typdoc[4]= '0' + cbi;
    j=wheretabcode(typdoc);
    if ( j >= 0)	{
	  // text = gtk_combo_box_get_active_text((GtkComboBox*)cbtypdoc);
	  //printf("typ = %d %s\n", cbi,text);
	  cairotext();
	  cairo_show_text(cr, ligcod[j].lib);
					}
      // g_free(text);
    }
else if ( strcmp( ze,"entvar") == 0)   {
    if (param0() ==-1) return;
    if (fgets(ze,256,fis) == NULL)	return;
    ++nuli;
    nlu = strlen(ze);
    --nlu;
    if ( nlu > 0 && ze[nlu-1] < 20)	{
	  ze[nlu-1] = '\0';// CR+LF 0d 0a fin de ligne windows
	  --nlu;
									}
    ze[nlu] = '\0';
    cairotext();
    cairo_show_text(cr, ze);
									    }
else if ( strcmp( ze,"textml") == 0)	{
    if (param0() ==-1) return;
    if ( (k = cherpara( "dtxy=")) != -1)  dtxy = atoi(tabmot[++k].pmot);
    else dtxy = 12;		// dtxy = espacement entre lignes
    svnuli=nuli;
 while ( (pze = fgets(ze,256,fis)) != NULL)	{
  ++nuli;
  if ( strncmp( ze,"fintextml",9) == 0) break;
  nlu = strlen(ze);
  --nlu;
  if ( nlu > 0 && ze[nlu-1] < 20)	{
      ze[nlu-1] = '\0';// CR+LF 0d 0a fin de ligne windows
      --nlu;
								    }
  ze[nlu] = '\0';
  cairotext();
  cairo_show_text(cr, ze);
  par0.y += dtxy;
											} // fin while
  if ( pze == NULL)	{
	  gchar *zm = g_strdup_printf ("Ligne %d commande 'textml' (texte multilignes)\nn'a pas de fin (commande 'fintextml')",svnuli);
	  /* sprintf(zm,"Ligne %d commande 'textml' (texte multilignes)\nn'a pas de fin (commande 'fintextml')",svnuli); */
	  messavar(zm);
	  g_free (zm);
					}
								    }  // fin 'textml'
else if ( strcmp( ze,"line") == 0)    {
      x0 = y0 = 0;
      if ( (k = cherpara( "x=")) != -1)   x0 = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "y=")) != -1)   y0 = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "xf=")) != -1)   xf = atoi(tabmot[++k].pmot);
      else xf = x0;
      if ( (k = cherpara( "yf=")) != -1)   yf = atoi(tabmot[++k].pmot);
      else yf = y0;
      if ( (k = cherpara( "w=")) != -1)   wep = g_strtod(tabmot[++k].pmot,NULL);
      cairo_set_line_width (cr, wep);
      cairo_move_to(cr, x0,y0);
      cairo_line_to(cr, xf,yf);
      cairo_stroke(cr);
								    }
else if ( strcmp( ze,"rect") == 0)    {
      x0 = y0 = xf = yf = 100;
      if ( (k = cherpara( "x=")) != -1)   x0 = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "y=")) != -1)   y0 = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "xl=")) != -1)   xf = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "yh=")) != -1)   yf = atoi(tabmot[++k].pmot);
      // else yf = y0;
      if ( (k = cherpara( "w=")) != -1)   wep = g_strtod(tabmot[++k].pmot,NULL);
      cairo_set_line_width (cr, wep);
      cairo_rectangle(cr, x0, y0, xf, yf);
      //  cairo_move_to(cr, x0,y0);
      //  cairo_line_to(cr, xf,yf);
      cairo_stroke(cr);
 								   }
else if ( strcmp( ze,"ydeb") == 0) 	   {
      if ( (k = cherpara( "dy=")) != -1)   dy = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "y=")) != -1)   ydeb = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "yfin=")) != -1)   yfin = atoi(tabmot[++k].pmot);
									    }
else if ( strcmp( ze,"ydebsuiv") == 0) 	   {
      if ( (k = cherpara( "dy=")) != -1)   dy = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "y=")) != -1)   ydeb = atoi(tabmot[++k].pmot);
      if ( (k = cherpara( "yfin=")) != -1)   yfin = atoi(tabmot[++k].pmot);
										    }
else if ( strcmp( ze,"libprod") == 0)  paramlf(CSFlibprod);
else if ( strcmp( ze,"quant") == 0)  paramlf(CSFquant);
else if ( strcmp( ze,"unit") == 0)  paramlf(CSFunit);
else if ( strcmp( ze,"ctax") == 0)  paramlf(CSFctax);
else if ( strcmp( ze,"pu") == 0)  paramlf(CSFpu);
else if ( strcmp( ze,"val") == 0)  paramlf(CSFval);
else if ( strcmp( ze,"libvar") == 0)  paramlf(CSFlibvar);
else if ( strcmp( ze,"libtot") == 0)  paramlf(CSFlibtot);
else if ( strcmp( ze,"valtot") == 0)  paramlf(CSFvaltot);
else if ( strcmp( ze,"stot") == 0)  paramlf(CSFstot);
else if ( strcmp( ze,"codprod") == 0)  paramlf(CSFcodprod);
else    {
      gchar *zm = g_strdup_printf ("Fichier Mise en Page\nCode de ligne inconnu '%s' ligne %d",ze,nuli);
      /* sprintf(zm,"Fichier Mise en Page\nCode de ligne inconnu '%s' ligne %d",ze,nuli); */
      messavar(zm);
      g_free (zm);
	    }
}
예제 #3
0
int test_FEI_Impl::test1()
{
  if (numProcs_ > 1) {
    return(0);
  }
#ifdef HAVE_FEI_AZTECOO
  testData* testdata = new testData(localProc_, numProcs_);

  fei::SharedPtr<LinearSystemCore> linSys(new fei_trilinos::Aztec_LinSysCore(comm_));
  fei::SharedPtr<LibraryWrapper> wrapper(new LibraryWrapper(linSys));
  fei::SharedPtr<fei::FEI_Impl> fei(new fei::FEI_Impl(wrapper, comm_, 0));

  std::string param0("name test1");
  FEI_OSTRINGSTREAM osstr;
  osstr << "debugOutput ";
  if (path_.empty()) osstr << ".";
  else osstr << path_;

  std::string param1 = osstr.str();

  int numParams = 2;
  char** params = new char*[numParams];
  params[0] = const_cast<char*>(param0.c_str());
  params[1] = const_cast<char*>(param1.c_str());

  //call the parameters function a couple of times to test the fei's internal
  //method for merging string lists when parameters is called more than once.
  CHK_ERR( fei->parameters(1, &params[0]) );
  CHK_ERR( fei->parameters(1, &params[1]) );
  CHK_ERR( fei->parameters(2, params) );

  delete [] params;

  CHK_ERR( fei->setIDLists(1, &(testdata->ids[0]),
			   1, &(testdata->ids[0])) );

  CHK_ERR( fei->initFields(testdata->fieldIDs.size(),
				&(testdata->fieldSizes[0]),
				&(testdata->fieldIDs[0])) );

  int numNodesPerElem = testdata->ids.size();
  std::vector<int> numFieldsPerNode(numNodesPerElem, 1);
  std::vector<int*>nodalFieldIDs(numNodesPerElem, &(testdata->fieldIDs[0]));

  CHK_ERR( fei->initElemBlock(0, //blockID
				   1, //numElements
				   numNodesPerElem,
				   &numFieldsPerNode[0],
				   &nodalFieldIDs[0],
				   0, //numElemDofFieldsPerElement
				   NULL, //elemDofFieldIDs
				   0)); //interleaveStrategy

  CHK_ERR( fei->initElem(0, //blockID
			      0, //elemID
			      &(testdata->ids[0])) );

  std::vector<int*> sharingProcs2D(testdata->sharedIDs.size());
  int offset = 0;
  for(int i=0; i<(int)testdata->numSharingProcsPerID.size(); ++i) {
    sharingProcs2D[i] = &(testdata->sharingProcs[offset]);
    offset += testdata->numSharingProcsPerID[i];
  }

  if (testdata->sharedIDs.size() > 0) {
    CHK_ERR( fei->initSharedNodes(testdata->sharedIDs.size(),
				     &(testdata->sharedIDs[0]),
				     &(testdata->numSharingProcsPerID[0]),
				     &sharingProcs2D[0]) );
  }

  CHK_ERR( fei->initComplete() );

  std::vector<double> rhsData(testdata->ids.size(), 1.0);

  double one = 1.0;
  CHK_ERR( fei->setMatScalars(1, &(testdata->ids[0]), &one) );
  CHK_ERR( fei->setRHSScalars(1, &(testdata->ids[0]), &one) );

  CHK_ERR( fei->setCurrentMatrix(testdata->ids[0]) );
  CHK_ERR( fei->setCurrentRHS(testdata->ids[0]) );

  CHK_ERR( fei->putIntoRHS(FEI_NODE, testdata->fieldIDs[0],
			   testdata->ids.size(),
			   &(testdata->ids[0]),
			   &rhsData[0]) );

  int numBCNodes = 2;
  GlobalID* BCNodeIDs = &(testdata->ids[0]);
  int BCFieldID = testdata->fieldIDs[0];
  double* values = new double[numBCNodes];
  int* offsetsIntoField = new int[numBCNodes];
  for(int ii=0; ii<numBCNodes; ++ii) {
    values[ii] = 1.0;
    offsetsIntoField[ii] = 0;
  }

  CHK_ERR( fei->loadNodeBCs(numBCNodes, BCNodeIDs, BCFieldID,
			    offsetsIntoField, values) );

  delete [] offsetsIntoField;
  delete [] values;

  CHK_ERR( fei->loadComplete() );

  int numActiveNodes = 0;
  CHK_ERR( fei->getNumLocalNodes(numActiveNodes) );
  if (numActiveNodes != (int)testdata->ids.size()) {
    ERReturn(-1);
  }

  GlobalID* localNodes = new GlobalID[numActiveNodes];
  CHK_ERR( fei->getLocalNodeIDList(numActiveNodes, localNodes, numActiveNodes) );

  int totalFieldSize = 0;
  for(int ii=0; ii<(int)testdata->fieldSizes.size(); ++ii) {
    totalFieldSize += testdata->fieldSizes[ii];
  }

  double* soln = new double[numActiveNodes*totalFieldSize];
  int* offsets = new int[numActiveNodes+1];

  CHK_ERR( fei->getNodalSolution(numActiveNodes, localNodes,
				 offsets, soln) );
  delete [] offsets;
  delete [] soln;
  delete [] localNodes;

  CHK_ERR( fei->resetInitialGuess() );

  int fieldSize = 0;
  CHK_ERR( fei->getFieldSize(testdata->fieldIDs[0], fieldSize) );

  double initTime, loadTime, solveTime, solnReturnTime;
  CHK_ERR( fei->cumulative_cpu_times(initTime, loadTime, solveTime,
				      solnReturnTime) );

  delete testdata;
#endif
  return(0);
}