use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.
the class MeshThicken method saveRegions.
public void saveRegions(File file) {
try {
PrintWriter pw = new IndentingPrintWriter(new PrintWriter(new BufferedWriter(new FileWriter(file))));
pw.println("[ ");
IndentingPrintWriter.addIndentation(pw, 2);
for (Region region : myRegions) {
region.write(pw);
}
IndentingPrintWriter.addIndentation(pw, -2);
pw.println("]");
pw.close();
myRegionFile = file;
} catch (Exception e) {
e.printStackTrace();
}
}
use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.
the class MatlabSolver method write.
public void write(String filename) {
System.out.println("writing data to file...");
try {
String fullpath = filename;
System.out.println("write data to " + fullpath);
IndentingPrintWriter pw = new IndentingPrintWriter(new FileWriter(fullpath));
writeArray(pw, "I", rowIdxs);
writeArray(pw, "J", colIdxs);
writeArray(pw, "S", vals);
writeArray(pw, "x", myX);
writeArray(pw, "b", myB);
pw.close();
System.out.println("... done writing " + filename);
} catch (Exception e) {
System.out.println("Unable to open datafile for writing.");
e.printStackTrace();
}
}
use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.
the class Main method saveProbesFile.
/**
* to save the probes file
*
* @param file probe information file
* @throws IOException if an I/O error occurred
*/
public boolean saveProbesFile(File file) throws IOException {
if (getWorkspace() == null) {
return false;
}
IndentingPrintWriter pw = ArtisynthIO.newIndentingPrintWriter(file);
getWorkspace().writeProbes(pw, null);
myProbeFile = file;
return true;
}
use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.
the class Main method saveModelFile.
public void saveModelFile(File file, String fmtStr) throws IOException {
RootModel root = getRootModel();
if (root != null) {
IndentingPrintWriter pw = ArtisynthIO.newIndentingPrintWriter(file);
if (!root.getClass().isAssignableFrom(RootModel.class)) {
pw.println(ClassAliases.getAliasOrName(root.getClass()));
}
root.write(pw, new NumberFormat(fmtStr), root);
pw.close();
}
}
use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.
the class FemModel3d method writeSurfaceMesh.
public void writeSurfaceMesh(String fileName) {
IndentingPrintWriter pw = null;
try {
pw = ArtisynthIO.newIndentingPrintWriter(fileName);
writeSurfaceMesh(pw);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (pw != null) {
pw.close();
}
}
}
Aggregations