42#include "rheolef/space.h"
43#include "rheolef/basis_get.h"
52static const std::string& symbol (
size_t i) {
return symbol_table[i]; }
53static size_t insert (
const std::string& str) {
54 size_t i = symbol_table.size();
55 symbol_table.push_back (str);
81tree_dump (
const tree_type& x, std::ostream& out,
size_t level = 0)
84 out << x.basis_geo.basis;
85 out <<
"{" << x.basis_geo.geo <<
"}";
88 if (x.spec !=
"mixed") {
out << x.spec; }
89 if (x.spec !=
"mixed" || level != 0) {
out <<
"("; }
90 std::list<tree_type>::const_iterator iter = x.hier.begin(), last = x.hier.end();
91 while (iter != last) {
92 tree_dump (*iter, out, level+1);
94 if (iter != last) {
out <<
"*"; }
96 if (x.spec !=
"mixed" || level != 0) {
out <<
")"; }
107typedef int (*parse_type)(void);
112space_constitution_get_pass_1_2 (
123 std::istream& is = ids.
is();
124 communicator comm = ids.
comm();
128 if (my_proc == io_proc) {
129 std::getline (ids.
is(), str);
132#ifdef _RHEOLEF_HAVE_MPI
133 mpi::broadcast (mpi::communicator(), str, io_proc);
138 std::istringstream istrstr;
140 input.yyrestart(istrstr);
141 symbol_table.clear();
144 if (parse() != 0 || n_error != 0) {
145 is.setstate (std::ios::badbit);
146 delete_macro (result_ptr); result_ptr = 0;
147 error_macro (
"internal error in space_constitution io (pass 2)");
149 symbol_table.clear();
155template<
class T,
class M>
157space_constitution<T,M>
158build_from_tree (
const tree_type& x) {
160 geo_basic<T,M> omega (x.basis_geo.geo);
162 std::string approx = x.basis_geo.basis + sopt.stamp();
163 return space_constitution<T,M>(omega, approx);
165 if (x.spec ==
"vector" || x.spec ==
"tensor") {
167 const tree_type& subtree = *(x.hier.begin());
169 geo_basic<T,M> omega (subtree.basis_geo.geo);
171 std::string approx = subtree.basis_geo.basis + sopt.stamp();
172 space_constitution<T,M>
basis (omega, approx);
173 space_constitution<T,M> constit;
174 constit.set_hierarchy(
true);
175 size_t d = omega.dimension();
178 constit.get_hierarchy().resize (n_comp);
179 for (
size_t i_comp = 0; i_comp < n_comp; i_comp++) {
180 constit.get_hierarchy().operator[] (i_comp) =
basis;
183 constit.data().initialize();
186 space_constitution<T,M> constit;
187 constit.set_hierarchy(
true);
188 size_t n_comp = x.hier.size();
189 constit.get_hierarchy().resize(n_comp);
190 std::list<tree_type>::const_iterator iter = x.hier.begin();
191 for (
size_t i_comp = 0; i_comp < n_comp; i_comp++, ++iter) {
192 const tree_type& xi = *iter;
193 constit.get_hierarchy().operator[] (i_comp) = build_from_tree<T,M> (xi);
195 constit.data().initialize();
field::size_type size_type
see the basis page for the full documentation
see the geo page for the full documentation
std::allocator< int >::size_type size_type
idiststream: see the diststream page for the full documentation
const communicator & comm() const
static size_type io_proc()
static std::vector< std::string > symbol_table
static family_index_option_type _current_fio
static tree_type * result_ptr
std::list< tree_type > list_type
#define assert_macro(ok_condition, message)
#define error_macro(message)
valued_type valued_tag(const std::string &name)
size_type n_component(valued_type valued_tag, size_type d, coordinate_type sys_coord)
This file is part of Rheolef.
space_constant::valued_type valued_tag() const
basis_geo_t(std::string b="", std::string g="")
tree_type(const std::string &basis, const std::string &geo)
tree_type(const std::string &s, const std::list< tree_type > &h)
std::list< tree_type > hier