Example #1
0
void generate_matrix_F2()
{
	matrix_F2 = malloc(o2*sizeof(int*));

	int i, j, k;

	for(i = 0; i < o2; i++)
	{
		matrix_F2[i] = malloc(D2*sizeof(int));
	}

	for(i = 0; i < o2; i++)
	{
		for(j = 0; j < D2; j++)
		{
			matrix_F2[i][j] = 0;

			for(k = 0; k < D1; k++)
			{
				matrix_F2[i][j] = addTable(matrix_F2[i][j], mulTable(matrix_Q21[i][k], matrix_A_inverse_T[k][j]));
			}
			for(k = 0; k < D21; k++)
			{
				matrix_F2[i][j] = addTable(matrix_F2[i][j],mulTable( matrix_Q22[i][k],matrix_A_inverse_T[D1+k][j]));
			}
		}
	}
}
Example #2
0
void generate_matrix_Q22()
{
	matrix_Q22 = malloc(o2*sizeof(int*));

	int i, j;

	for(i = 0; i < o2; i++)
	{
		matrix_Q22[i] = malloc(D21*sizeof(int));
	}

	int** temp = malloc(o2*sizeof(int*));

	for(i = 0; i < o2; i++)
	{
		temp[i] = malloc(D21*sizeof(int));
	}

	for(i = 0; i < o2; i++)
	{
		for(j = 0; j < D21; j++)
		{
			temp[i][j] = 0;

			for(k = 0; k < o1; k++)
			{
				temp[i][j] = addTable(temp[i][j], mulTable(matrix_MS[o1+i][k], matrix_Q12[k][j]));
			}
		}
	}

	for(i = 0; i < o2; i++)
	{
		for(j = 0; j < D21; j++)
		{
			temp[i][j] = addTable(temp[i][j], matrix_B2[i][j]);
		}
	}

	for(i = 0; i < o2; i++)
	{
		for(j = 0; j < D21; j++)
		{
			matrix_Q22[i][j] = 0;

			for(k = 0; k < o2; k++)
			{
				matrix_Q22[i][j] = addTable(matrix_Q22[i][j], mulTable(matrix_MS22_inverse[i][k], temp[k][j]));
			}
		}
	}
}
ADUpdatePackage::ADUpdatePackage(const QString &table, const QStringList &fields, const QStringList &values) : ADSqlPackageBase()
{
	QDomElement root = createElement("Update");
	
	appendChild( root );
	addTable( table, fields, values);
}
Example #4
0
int  MemTable::addTable(TableConfig* config) {
    if (_id_config == NULL) {
        TT_WARN_LOG("tinytable has not init");
        return -1;
    }
    SingleTable* table = new(std::nothrow) SingleTable();
    if (NULL == table) {
        TT_WARN_LOG("create table null");
        return -1;
    }
    // init table
    if (!table->init(config)) {
        TT_WARN_LOG("init table error");
        delete table;
        table = NULL;
        return -1;
    }
    int ret = addTable(table);
    if (0 != ret) {
        TT_WARN_LOG("add table error");
        delete table;
        table = NULL;
    }
    return ret;
}
Example #5
0
ParticleSet::ParticleSet(const ParticleSet& p)
  : UseBoundBox(p.UseBoundBox), UseSphereUpdate(p.UseSphereUpdate),IsGrouped(p.IsGrouped)
  , ThreadID(0), mySpecies(p.getSpeciesSet()),SK(0), ParentTag(p.tag())
{
  initBase();
  initParticleSet();
  assign(p); //obly the base is copied, assumes that other properties are not assignable
  //need explicit copy:
  Mass=p.Mass;
  Z=p.Z;
  ostringstream o;
  o<<p.getName()<<ObjectTag;
  this->setName(o.str());
  app_log() << "  Copying a particle set " << p.getName() << " to " << this->getName() << " groups=" << groups() << endl;
  PropertyList.Names=p.PropertyList.Names;
  PropertyList.Values=p.PropertyList.Values;
  PropertyHistory=p.PropertyHistory;
  Collectables=p.Collectables;
  //construct the distance tables with the same order
  //first is always for this-this paier
  for (int i=1; i<p.DistTables.size(); ++i)
    addTable(p.DistTables[i]->origin());
  if(p.SK)
  {
    R.InUnit=p.R.InUnit;
    createSK();
    SK->DoUpdate=p.SK->DoUpdate;
  }
  if (p.Sphere.size())
    resizeSphere(p.Sphere.size());
  add_p_timer(myTimers);
  myTwist=p.myTwist;
}
void PrintingWindow::executePrintJob()
{
    //Intial setup
    configurePageSettings();

    //Add Text
    ThePainter.begin(&ThePrinter);
    ThePainter.setFont(QFont("Arial",12));
    QString stringHolder = Date.toString("MM.dd.yyyy");
    ThePainter.drawText(10,10,stringHolder);
    stringHolder = ProfileName.toUpper();
    ThePainter.drawText(10,28,stringHolder);

    //Add material to page
    addTable();

    ThePainter.end();

    //Bring up Print Dialog to select the proper printer
    QPrintDialog dialog(&ThePrinter, this);
            dialog.setWindowTitle(tr("Print Document"));
            if (dialog.exec() != QDialog::Accepted) {
                return;
            }
}
Example #7
0
static unsigned long
colourPixel(Display *disp, int depth, Colormap cmap,
	    Table t, int r, int g, int b)
{ unsigned long pixel;
  unsigned long direct = (r << 16) + (g << 8) + b;
  XColor c;

  if ( (pixel = memberTable(t, direct)) != NOPIXEL )
    return pixel;

  ncolours++;

  c.red   = r * 257;
  c.green = g * 257;
  c.blue  = b * 257;
  if ( !XAllocColor(disp, cmap, &c) )
  { if ( !allocNearestColour(disp, cmap, depth, DEFAULT, &c) )
    { Cprintf("PNM: failed to alloc pixel %d/%d/%d\n", r, g, b);
      c.pixel = 0;
      nfailed++;
    }
  }

  addTable(t, direct, c.pixel);

  DEBUG(NAME_ppm, Cprintf("PNM: Colour %d %d %d on pixel %d\n",
			  r, g, b, c.pixel));
  return c.pixel;
}
Example #8
0
/**
 * @brief Add multiple tables to Streamer.
 *
 * @param tables
 */
void Streamer::addTables( vector<Id> tables )
{
    if( tables.size() == 0 )
        return;
    for( vector<Id>::const_iterator it = tables.begin(); it != tables.end(); it++)
        addTable( *it );
}
Example #9
0
void QTableManager::NewTable()
    {
        // creo la tabella
    QPointF value = this->mapToScene(QCursor::pos());

    QgraphicsItemTable* table = addTable(new QString("NuovaTab"),value.x(),value.y(),250,100);
    table->addAttribute("id",0);
}
//////////////////////////////////////////////////////////////////////////////
// Prepare a table object and add it to the graph.
void MVJoinGraph::addTable(Lng32           tableIndex, 
			   Lng32           usedObjectsIndex, 
			   const NATable *naTable)
{
  MVJoinTable *newNode = new(heap_) 
    MVJoinTable(tableIndex, usedObjectsIndex, nofTables_, naTable, heap_);
  addTable(newNode);
}	
Example #11
0
bool BlogDatabase::create(const QString &fileName)
{
    if (Database::create(fileName)) {
        // Create new table for the blog events if it does not exist.
        // No problem if the table already exists.
        QString query = QString(str::SqlCreateMyBlogTable)
                                .arg(str::MyBlogTableName);
        addTable(query);

        // Create the user info table and add user data.
        addTable(str::SqlCreateMyBlogUserTable);

        return true;
    } else {
        return false;
    }
}
Example #12
0
ReportCluster::ReportCluster(const string &projectPath, const string &clusterTableFilename, const string &inputSpectraTableFilename)
{
  // The cluster consensus spectra on top of page. Set the filter column to cluster index column
  ReportTableBase *c = new ReportTableClusterConsensus(projectPath, clusterTableFilename, TABLE_CLUSTER_FILTER_COL_CLUSTER);
  // Define the specific view (spectra on top)
  c->defineView2();
  // no borders and no header
  c->noBorders(); c->noHeaders();
  // Add the table to the report
  addTable(c);

  // The input spectra list. By default, it's filtered at cluster consensus column
  ReportTableBase *c2 = new ReportTableInputSpectra(projectPath, inputSpectraTableFilename);
  // Define the specific view (spectra on top)
  c2->defineView2();
  // Add the table to the report
  addTable(c2);
}
void
KexiRelationsView::slotAddTable()
{
    if (d->tableCombo->currentIndex() == -1)
        return;
    const QString tname = d->tableCombo->itemText(d->tableCombo->currentIndex());
    KDbTableSchema *t = d->conn->tableSchema(tname);
    addTable(t);
}
Example #14
0
void TS_addTable(const char *name, const char * valueType)
{
  if (!TS_tableExists(name)) {
    addTable(name, valueType);
  }
  else {
    ATwarning("addTable: table %s already exists.\n", name);
  }
}  
Example #15
0
int  MemTable::addTable(const char* name, int column, char* types, std::set<short>& primary, std::string* names, int id) {
    TableConfig config(name, column, types, NULL, names, id);
    config.primary_keys = primary;
    int ret = addTable(&config);
    if (ret != 0) {
        TT_WARN_LOG("add config table name %s column %d error", name, column);
    }
    return ret;
}
CInsertPackage::CInsertPackage(const QString &table, const QStringList &fields, const QStringList &values) : CSqlPackageBase()
{
	QDomElement root = createElement("Insert");
	
	appendChild( root );
	
	addTable(table, fields, values);
	
}
CalculationResultForGame& CalculationResultForGame::operator=(const CalculationResultForGame& other)
{
	m_textValues = other.m_textValues;
	m_comment = other.m_comment;
	m_internalValue = other.m_internalValue;
	unsigned int tablesCount = other.m_tables.size();
	for(unsigned int i = 0; i < tablesCount; ++i)
		addTable(other.tableAt(i));
	return *this;
}
Example #18
0
void generate_matrix_MFT()
{
	int* temp = malloc((n+1)*sizeof(int));
	matrix_MFT = malloc(m*sizeof(int**));
	int i, j;

	for(i = 0; i < m; i++)
	{
		matrix_MFT[i] = malloc((n+1)*sizeof(int*));
		for(j = 0; j < n+1; j++)
		{
			matrix_MFT[i][j] = malloc((n+1)*sizeof(int));
		}
	}

	int l, k, q, r;

	for(i = 0; i < m; i++)
	{
		for(l = 0; l < n+1; l++)
		{
			for(k = 0; k < n+1; k++)
			{
				temp[k] = 0;

				for(p = 0; p < n+1; p++)
				{
					temp[m] = addTable(temp[m], mulTable(matrix_MT[p][l], matrix_MQ[i][p][k]));
				}
			}

			for(q = 0; q < n+1; q++)
			{
				matrix_MFT[i][l][q] = 0;

				for(r= 0; r < n+1; r++)
				{
					matrix_MFT[i][l][q]=addTable(matrix_MFT[i][l][q], mulTable(temp[r], matrix_MT[r][q]));
				}
			}
		}
	}
}
Example #19
0
void generate_matrix_Q11_Q21()
{
	matrix_Q11 = malloc(o1*sizeof(int*));
	int i, j, k;

	for(i = 0; i < o1; i++)
	{
		matrix_Q11[i] = malloc(D1*sizeof(D1));
	}

	matrix_Q21 = malloc(o2*sizeof(int*));

	for(i = 0; i < o2; i++)
	{
		matrix_Q21[i] = malloc(D1*sizeof(int));
	}

	for(i = 0; i < o1; i++)
	{
		for(j = 0; j < D1; j++)
		{
			matrix_Q11[i][j] = 0;

			for(k = 0; k < m; k++)
			{
				matrix_Q11[i][j] = addTable(matrix_Q11[i][j], mulTable(matrix_MS_inverse[i][k], matrix_B1[k][j]));
			}
		}
	}

	for(i = 0; i < o2; i++)
	{
		for(j = 0; j < D2; j++)
		{
			matrix_Q21[i][j] = 0;

			for(k = 0; k < m; k++)
			{
				matrix_Q21[i][j] = addTable(matrix_Q21[i][j], mulTable(matrix_MS_inverse[o1+i][k], matrix_B1[k][j]));
			}
		}
	}	
}
Example #20
0
void SemOS2MergeMsgTable( FullStringTable *currtable, ResMemFlags flags )
/***********************************************************************/
{
    FullStringTable     *table;

    table = findTable( CurrResFile.ErrorTable );
    if( table == NULL ) {
        setStringTableFlags( currtable, flags, SemOS2DefaultCodepage() );
        addTable( &CurrResFile.ErrorTable, currtable );
    } else {
        semMergeStringTables( table, currtable, flags, SemOS2DefaultCodepage() );
    }
}
ADUpdatePackage::ADUpdatePackage(const QStringList &tables, const QList<QStringList> &fields, const QList<QStringList> &values) : ADSqlPackageBase()
{
	QDomElement root = createElement("Update");
	
	appendChild( root );
	
	int count = 0;
	foreach(QString table, tables )
	{
		addTable(table, fields[count], values[count]);
		
		++count;
	}
Example #22
0
void SemOS2MergeStrTable( FullStringTable *currtable,
                                    ResMemFlags flags, uint_32 codepage )
/***********************************************************************/
{
    FullStringTable     *table;

    table = findTable( CurrResFile.StringTable );
    if( table == NULL ) {
        setStringTableFlags( currtable, flags, codepage );
        addTable( &CurrResFile.StringTable, currtable );
    } else {
        semMergeStringTables( table, currtable, flags, codepage );
    }
}
Example #23
0
void MainWindow::setSchema( Schema * schema )
{
	if( mSchema && mSchema != schema ) delete mSchema;
	if( !schema ) schema = new Schema();

	mSchema = schema;
	mModel->clear();

	// Add the top-level tables, they will add their children
	foreach( TableSchema * t, mSchema->tables() )
		if( !t->parent() )
			addTable( t );
	expandChildTables( QModelIndex() );
	mChanges = false;
}
Example #24
0
void generate_matrix_MPK()
{
	matrix_MPK = malloc(m*sizeof(int*));
	int i, j, k;

	for(j = 0; i < m; j++)
	{
		matrix_MPK[j] = malloc(D*sizeof(int));
	}

	for(i = 0; i < m; i++)
	{
		for(j = 0; j < D; j++)
		{
			matrix_MPK[i][j] = 0;

			for(k = 0; k < m; k++)
			{
				matrix_MPK[i][j]=addTable(matrix_MPK[i][j],mulTable(matrix_MS[i][k],matrix_MFK[k][j]));
			}
		}
		matrix_MPK[i][D-1]=addTable(matrix_MPK[i][D-1],matrix_MS[i][m]);
	}
}
Example #25
0
bool TableManager::addNewTable(MYSQL *mysql_conn,const char *tableName)
{
	Table *table = new Table();
	if(!table)
	{
		return false;
	}
	strncpy(table->name,tableName,sizeof(table->name));
	table->reloadAllFileds(mysql_conn,tableName);
	if(!addTable(table))
	{
		DELETE(table);
		return false;
	}
	return true;
}
Example #26
0
void generate_matrix_MFT_UT()
{
	int k, i, j;

	for(k = 0; k < m; k++)
	{
		for(i = 0; i < n+1; i++)
		{
			for(j = i+1; j < n+1; j++)
			{
				matrix_MFT[k][i][j]=addTable(matrix_MFT[k][i][j],matrix_MFT[k][j][i]);
				matrix_MFT[k][j][i]=0;
			}
		}
	}
}
Example #27
0
int  MemTable::addTable(const char* xml_path, const char* xml_file) {
    if (_id_config == NULL) {
        TT_WARN_LOG("tinytable has not init");
        return -1;
    }
    TableConfig config;
    // load config
    if (!ProtoToConfig::loadTableXmlConfig(xml_path, xml_file, &config, _id_config)) {
        TT_WARN_LOG("load table(%s/%s) error", xml_path, xml_file);
        return -1;
    }
    int ret = addTable(&config);
    if (0 != ret) {
        TT_WARN_LOG("add table (%s/%s) error", xml_path, xml_file);
    }
    return ret;
}
Example #28
0
void loadTable(SS_Table table)
{
  char *name = SS_getTableName(table);
  char *valueType = SS_getTableValueType(table);
  SS_Rows rows = SS_getTableRows(table);

  if (!TS_tableExists(name)) {
    addTable(name, valueType);
  }

  for (; !SS_isRowsEmpty(rows); rows = SS_getRowsTail(rows)) {
    SS_Row row = SS_getRowsHead(rows);
    ATerm key = SS_getRowKey(row);
    ATerm value = SS_getRowValue(row);

    TS_putValue(name, key, value);
  }
}
Example #29
0
void generate_matrix_Q12()
{
	matrix_Q12 = malloc(o1*sizeof(int*));

	int i, j, k;

	for(i = 0; i < o1; i++)
	{
		for(j = 0; j < D21; j++)
		{
			matrix_Q12[i][j] = 0;

			for(k = 0; k < D1; k++)
			{
				matrix_Q12[i][j] = addTable(matrix_Q12[i][j], mulTable(matrix_F1[i][k], matrix_A[D1+j][k]));
			}
		}
	}
}
Example #30
0
/*
 Complete the query parsing by joining the table results
*/
void Database::completeQueryParsing(Query_parser* parser) {
	vector<Table*> tables;
	vector<string> tableNames = parser->tables;
	for (int k = 0; k < tableNames.size(); k++) {
		

		Table* t = createPartialTable(parser, tableNames[k]);
		if(debug)
		{
			cout<<t->printSelf()<<endl;
		}
		if (tableNames.size() > 1)
			addTable(t, t->getTableName());
		tables.push_back(queryParsing(parser, tableNames[k], t));
		
	}
	Table* newTable = findTable(parser->new_table_name);
	if (newTable == NULL) {
		createTable(parser->new_table_name);
		newTable = findTable(parser->new_table_name);
	}
	if(debug)
	{
		cout<<"new table is "<<endl;
		cout<<newTable->printSelf()<<endl;
	}
	if (tables.size() == 1) {
		this->deleteTable(parser->new_table_name);
		this->addTable(tables[0], parser->new_table_name);
	} else {
		combineTables(tables, parser, newTable);
	}

	if (tables.size() > 1) {
		for (int k = 0; k < tables.size(); k++) {
			deleteTable(tables[k]->getTableName());
		}
	}
}