Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/solvers/sat/dimacs_cnf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ Author: Daniel Kroening, [email protected]

#include "dimacs_cnf.h"

#include <util/magic.h>

#include <iostream>
#include <sstream>

dimacs_cnft::dimacs_cnft():break_lines(false)
{
Expand Down Expand Up @@ -60,9 +63,23 @@ static void write_dimacs_clause(

void dimacs_cnft::write_clauses(std::ostream &out)
{
std::size_t count = 0;
std::stringstream output_block;
for(clausest::const_iterator it=clauses.begin();
it!=clauses.end(); it++)
write_dimacs_clause(*it, out, break_lines);
{
write_dimacs_clause(*it, output_block, break_lines);

// print the block once in a while
if(++count % CNF_DUMP_BLOCK_SIZE == 0)
{
out << output_block.str();
output_block.str("");
}
}

// make sure the final block is printed as well
out << output_block.str();
}

void dimacs_cnf_dumpt::lcnf(const bvt &bv)
Expand Down
1 change: 1 addition & 0 deletions src/util/magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <cstddef>

const std::size_t CNF_DUMP_BLOCK_SIZE = 4096;
const std::size_t MAX_FLATTENED_ARRAY_SIZE=1000;
const std::size_t STRING_REFINEMENT_MAX_CHAR_WIDTH = 16;

Expand Down