int main(int argc, char *argv[]) { field_t **field; field = importField(); solvingSudoku(field); outputField(field); freeField(field); return 0; }
void outputMessage ( FudgeMsg message, unsigned int indent ) { fudge_i32 index, numfields; FudgeField * fields; /* Get the number of fields in the message and allocate enough space to hold them. Bail out if the message has no fields. */ if ( ! ( numfields = FudgeMsg_numFields ( message ) ) ) return; if ( ! ( fields = ( FudgeField * ) malloc ( numfields * sizeof ( FudgeField ) ) ) ) fatalError ( "Unable to allocate memory for field array" ); /* Retrieve all of fields in the message and output them in turn */ numfields = FudgeMsg_getFields ( fields, numfields, message ); for ( index = 0; index < numfields; ++index ) outputField ( &( fields [ index ] ), indent + 1 ); /* While the field contents are owned by the message, the array used to hold them is the property of the local scope. */ free ( fields ); }
void writeGrdecl(const std::string& filename) { // Output new versions of SPECGRID, COORD, ZCORN, ACTNUM, PERMX, PORO, SATNUM. std::ofstream out(filename.c_str()); if (!out) { std::cerr << "Could not open file " << filename << "\n"; throw std::runtime_error("Could not open output file."); } out << "SPECGRID\n" << new_dims_[0] << ' ' << new_dims_[1] << ' ' << new_dims_[2] << " 1 F\n/\n\n"; out.precision(15); out.setf(std::ios::scientific); outputField(out, new_COORD_, "COORD", /* nl = */ 3); outputField(out, new_ZCORN_, "ZCORN", /* nl = */ 4); outputField(out, new_ACTNUM_, "ACTNUM"); outputField(out, new_PORO_, "PORO", 4); if (hasNTG()) {outputField(out, new_NTG_, "NTG", 4);} if (hasSWCR()) {outputField(out, new_SWCR_, "SWCR", 4);} if (hasSOWCR()) {outputField(out, new_SOWCR_, "SOWCR", 4);} outputField(out, new_PERMX_, "PERMX", 4); outputField(out, new_PERMY_, "PERMY", 4); outputField(out, new_PERMZ_, "PERMZ", 4); outputField(out, new_SATNUM_, "SATNUM"); }