Files
mfem/general/text.hpp
T
Veselin Dobrev 224851268e Restore backward compatibility for reading and writing NURBS meshes and
solutions. Restore the NURBS meshes in the data directory to use their
original format.

Add a new FiniteElementSpace format for writing variable-order spaces,
currently implemented for NURBS spaces only. Move the reading of FE
space input in a new method: FiniteElementSpace::Load. Add new default
constructor for FiniteElementSpace that should be used with the Load
method.

Add a bunch of const qualifiers in NURBSExtension and NURBSPatchMap.

Extended the method Mesh::DegreeElevate to make it easier to work with
variable-order NURBS meshes.

In class Array, add copy constructors and copy assignment operators.

Add a number of FIXME comments.
2017-11-21 14:35:05 -08:00

80 lines
1.8 KiB
C++

// Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
// the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
// reserved. See file COPYRIGHT for details.
//
// This file is part of the MFEM library. For more information and source code
// availability see http://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the GNU Lesser General Public License (as published by the Free
// Software Foundation) version 2.1 dated February 1999.
#ifndef MFEM_TEXT
#define MFEM_TEXT
#include <istream>
#include <iomanip>
#include <sstream>
#include <string>
#include <limits>
#include <algorithm>
namespace mfem
{
// Utilities for text parsing
inline void skip_comment_lines(std::istream &is, const char comment_char)
{
while (1)
{
is >> std::ws;
if (is.peek() != comment_char)
{
break;
}
is.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
}
// Check for, and remove, a trailing '\r'.
inline void filter_dos(std::string &line)
{
if (!line.empty() && *line.rbegin() == '\r')
{
line.resize(line.size()-1);
}
}
// Convert an integer to a string
inline std::string to_string(int i)
{
std::stringstream ss;
ss << i;
// trim leading spaces
std::string out_str = ss.str();
out_str = out_str.substr(out_str.find_first_not_of(" \t"));
return out_str;
}
// Convert an integer to a 0-padded string with the given number of 'digits'
inline std::string to_padded_string(int i, int digits)
{
std::ostringstream oss;
oss << std::setw(digits) << std::setfill('0') << i;
return oss.str();
}
// Convert a string to an int
inline int to_int(const std::string& str)
{
int i;
std::stringstream(str) >> i;
return i;
}
}
#endif