History quick by default.

This commit is contained in:
Federico Ponchio 2005-02-19 17:14:02 +00:00
parent eed1577b2e
commit e9932cfb95
3 changed files with 72 additions and 7 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.7 2005/02/19 16:22:45 ponchio
Minor changes (visited and Cell)
Revision 1.6 2005/02/17 16:40:35 ponchio Revision 1.6 2005/02/17 16:40:35 ponchio
Optimized BuildLevels. Optimized BuildLevels.
@ -94,7 +97,7 @@ bool History::LoadQuick(unsigned int _size, char *mem) {
assert(n_nodes() * sizeof(Node) + assert(n_nodes() * sizeof(Node) +
(n_in_links() + n_out_links()) * sizeof(Link) + (n_in_links() + n_out_links()) * sizeof(Link) +
n_frags() * sizeof(unsigned int) + n_frags() * sizeof(unsigned int) +
5 * sizeof(int) == size); 5 * sizeof(int) == _size);
size = _size; size = _size;
return LoadPointers(); return LoadPointers();
} }
@ -177,6 +180,11 @@ char *History::SaveQuick(unsigned int &_size) {
link.frag_begin = (unsigned int *)(link.frag_begin - frags); link.frag_begin = (unsigned int *)(link.frag_begin - frags);
} }
assert(n_nodes() * sizeof(Node) +
(n_in_links() + n_out_links()) * sizeof(Link) +
n_frags() * sizeof(unsigned int) +
5 * sizeof(int) == size);
_size = size; _size = size;
char *tmp = buffer; char *tmp = buffer;
buffer = NULL; buffer = NULL;

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.16 2005/02/19 10:45:04 ponchio
Patch generalized and small fixes.
Revision 1.15 2005/02/14 15:17:36 ponchio Revision 1.15 2005/02/14 15:17:36 ponchio
Cleaning up. Cleaning up.
@ -611,6 +614,8 @@ void FifthStep(const string &crudefile, const string &output,
nexus.history.updates.push_back(update); nexus.history.updates.push_back(update);
ReverseHistory(nexus.history.updates); ReverseHistory(nexus.history.updates);
if(!nexus.history.IsQuick())
nexus.history.UpdatesToQuick();
// TestBorders(nexus); // TestBorders(nexus);
nexus.Close(); nexus.Close();

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.20 2005/02/19 10:45:04 ponchio
Patch generalized and small fixes.
Revision 1.19 2005/02/18 13:04:13 ponchio Revision 1.19 2005/02/18 13:04:13 ponchio
Added patch reordering. Added patch reordering.
@ -87,6 +90,7 @@ int main(int argc, char *argv[]) {
string plysource; string plysource;
bool info = false; bool info = false;
bool verbose = false; bool verbose = false;
bool dump_history = false;
unsigned int ram_size = 128000000; unsigned int ram_size = 128000000;
unsigned int chunk_size = 0; unsigned int chunk_size = 0;
@ -113,10 +117,11 @@ int main(int argc, char *argv[]) {
bool zsort = false; bool zsort = false;
int option; int option;
while((option = getopt(argc, argv, "ilo:a:r:zxsv:n:k:t:b:c:")) != EOF) { while((option = getopt(argc, argv, "ilho:a:r:zxsv:n:k:t:b:c:")) != EOF) {
switch(option) { switch(option) {
case 'i': info = true; break; case 'i': info = true; break;
case 'l': verbose = true; break; case 'l': verbose = true; break;
case 'h': dump_history = true; break;
case 'o': output = optarg; break; case 'o': output = optarg; break;
case 'a': { case 'a': {
if(strstr(optarg, "strips")) { if(strstr(optarg, "strips")) {
@ -244,7 +249,8 @@ int main(int argc, char *argv[]) {
if(optind != argc - 1) { if(optind != argc - 1) {
cerr << "Usage: " << argv[0] << " <nexus file> [options]\n" cerr << "Usage: " << argv[0] << " <nexus file> [options]\n"
<< " -i : display some info about nexus file\n" << " -i : display some info about nexus file\n"
<< " -l : list nodes\n" << " -l : list nodes\n"
<< " -h : list history\n"
<< " -o <file>: output filename (default is adding 00 to nexus)\n" << " -o <file>: output filename (default is adding 00 to nexus)\n"
<< " -a <what>: Add [colors|normals|strips|textures|data|borders]\n" << " -a <what>: Add [colors|normals|strips|textures|data|borders]\n"
<< " -r <what>: As add...\n" << " -r <what>: As add...\n"
@ -334,6 +340,47 @@ int main(int argc, char *argv[]) {
<< "\n\tAverage distance: " << meandist << "\n\tAverage distance: " << meandist
<< "\n\tChunk size " << nexus.chunk_size << endl; << "\n\tChunk size " << nexus.chunk_size << endl;
if(dump_history) {
if(nexus.history.IsQuick()) {
cerr << "Quick format\n";
for(unsigned int i = 0; i < nexus.history.n_nodes(); i++) {
cerr << "Node: " << i << " out: ";
History::History::Node node = nexus.history.nodes[i];
for(History::Node::iterator l = node.out_begin(); l != node.out_end(); l++) {
cerr << ".";
History::Link &link = *l;
for(History::Link::iterator p = link.begin(); p != link.end(); p++) {
cerr << *p << " ";
}
}
cerr << " in: ";
for(History::Node::iterator j = node.in_begin(); j != node.in_end(); j++) {
cerr << ".";
History::Link &link = *j;
for(History::Link::iterator p = link.begin(); p != link.end(); p++) {
cerr << *p << " ";
}
}
cerr << endl;
}
} else {
cerr << "Update format\n";
for(unsigned int i = 0; i < nexus.history.updates.size(); i++) {
History::Update &update = nexus.history.updates[i];
cerr << "Created: ";
for(unsigned int k = 0; k < update.created.size(); k++) {
cerr << update.created[k] << " ";
}
cerr << "\nErased: ";
for(unsigned int k = 0; k < update.erased.size(); k++) {
cerr << update.erased[k] << " ";
}
cerr << "\n\n";
}
}
}
if(verbose) { if(verbose) {
for(unsigned int i = 0; i < nexus.size(); i++) { for(unsigned int i = 0; i < nexus.size(); i++) {
Entry &entry = nexus[i]; Entry &entry = nexus[i];
@ -417,14 +464,19 @@ int main(int argc, char *argv[]) {
ZSort(nexus, forward, backward); ZSort(nexus, forward, backward);
//Fixing history //Fixing history
unsigned int h_size; if(!nexus.history.IsQuick())
char *buffer = nexus.history.Save(h_size); nexus.history.UpdatesToQuick();
out.history.Load(h_size, buffer);
unsigned int hsize;
char *buffer = nexus.history.Save(hsize);
out.history.Load(hsize, buffer);
if(zsort) { if(zsort) {
if(out.history.IsQuick()) { if(out.history.IsQuick()) {
for(unsigned int i = 0; i < out.history.n_frags(); i++) for(unsigned int i = 0; i < out.history.n_frags(); i++)
out.history.frags[i].patch = backward[out.history.frags[i].patch]; out.history.frags[i] = backward[out.history.frags[i]];
} else { } else {
for(unsigned int i = 0; i < out.history.updates.size(); i++) { for(unsigned int i = 0; i < out.history.updates.size(); i++) {
History::Update &update = out.history.updates[i]; History::Update &update = out.history.updates[i];