// chars is arbitrary but should
// be enough
char c[10000];
- input.getline ((char *)&c, 10000);
+ input.getline (&c[0], 10000);
line = c;
if (!scan_line (line, lineno))
status = false;
map<String, Section*, less<String> >::iterator p;
for (p=defaults.subsections.begin(); p!=defaults.subsections.end(); ++p)
- delete (*p).second;
+ delete p->second;
for (p=changed_entries.subsections.begin(); p!=changed_entries.subsections.end(); ++p)
- delete (*p).second;
+ delete p->second;
defaults.subsections.erase (defaults.subsections.begin(), defaults.subsections.end());
changed_entries.subsections.erase (changed_entries.subsections.begin(),
map<String, pair<String,String>, less<String> >::const_iterator ptr;
ptr = pc->entries.find (entry_string);
if (ptr != pc->entries.end())
- return (*ptr).second.first;
+ return ptr->second.first;
// not changed
ptr = pd->entries.find (entry_string);
- return (*ptr).second.first;
+ return ptr->second.first;
};
// first find out the longest entry name
unsigned int longest_entry = 0;
for (ptr = pd->entries.begin(); ptr != pd->entries.end(); ++ptr)
- if ((*ptr).first.length() > longest_entry)
- longest_entry = (*ptr).first.length();
+ if (ptr->first.length() > longest_entry)
+ longest_entry = ptr->first.length();
// print entries one by one
for (ptr = pd->entries.begin(); ptr != pd->entries.end(); ++ptr)
{
// check whether this entry is listed
// in the Changed tree
- if (pc->entries.find((*ptr).first) != pc->entries.end())
+ if (pc->entries.find(ptr->first) != pc->entries.end())
switch (style)
{
case Text:
out << setw(indent_level*2) << ""
- << (*ptr).first
- << setw(longest_entry-(*ptr).first.length()+3) << " = "
- << pc->entries[(*ptr).first].first
+ << ptr->first
+ << setw(longest_entry-ptr->first.length()+3) << " = "
+ << pc->entries[ptr->first].first
<< " <"
- << pd->entries[(*ptr).first].first
+ << pd->entries[ptr->first].first
<< ">"
<< endl;
break;
case LaTeX:
- out << "\\item {\\bf " << (*ptr).first << ":} "
- << pc->entries[(*ptr).first].first
+ out << "\\item {\\bf " << ptr->first << ":} "
+ << pc->entries[ptr->first].first
<< " ({\\it default:} "
- << pd->entries[(*ptr).first].first
+ << pd->entries[ptr->first].first
<< ")"
<< endl;
break;
{
case Text:
out << setw(indent_level*2) << ""
- << (*ptr).first
- << setw(longest_entry-(*ptr).first.length()+2) << "= "
- << (*ptr).second.first << endl;
+ << ptr->first
+ << setw(longest_entry-ptr->first.length()+2) << "= "
+ << ptr->second.first << endl;
break;
case LaTeX:
- out << "\\item {\\bf " << (*ptr).first << ":} "
- << (*ptr).second.first
+ out << "\\item {\\bf " << ptr->first << ":} "
+ << ptr->second.first
<< endl;
break;
default:
{
case Text:
out << setw(indent_level*2) << ""
- << "subsection " << (*ptrss).first << endl;
+ << "subsection " << ptrss->first << endl;
break;
case LaTeX:
out << endl
<< "\\item {\\bf "
- << "Subsection " << (*ptrss).first
+ << "Subsection " << ptrss->first
<< "}" << endl
<< "\\begin{itemize}"
<< endl;
default:
Assert (false, ExcNotImplemented());
};
- enter_subsection ((*ptrss).first);
+ enter_subsection (ptrss->first);
print_parameters_section (out, style, indent_level+1);
leave_subsection ();
switch (style)
const ParameterHandler::Section* ParameterHandler::get_present_defaults_subsection () const {
- Section* sec = (Section*)&defaults; // not nice, but needs to be and
+ Section* sec = const_cast<Section*>(&defaults); // not nice, but needs to be and
// after all: we do not change #sec#
vector<String>::const_iterator SecName = subsection_path.begin();
const ParameterHandler::Section* ParameterHandler::get_present_changed_subsection () const {
- Section* sec = (Section*)&changed_entries; // same as in get_present_default_s...
+ Section* sec = const_cast<Section*>(&changed_entries); // same as in get_present_default_s...
vector<String>::const_iterator SecName = subsection_path.begin();
while (SecName != subsection_path.end())
map<String, Section*, less<String> >::iterator p;
for (p=subsections.begin(); p!=subsections.end(); ++p)
- delete (*p).second;
+ delete p->second;
subsections.erase (subsections.begin(), subsections.end());
if (multiple_choices.size() > 0)
for (vector<Entry>::iterator i=multiple_choices.end()-1;
i >= multiple_choices.begin(); --i)
- if ((*i).different_values.size() == 1)
+ if (i->different_values.size() == 1)
multiple_choices.erase (i);
// finally calculate number of branches
// whether it is a multiple entry
map<String, pair<String,String>, less<String> >::const_iterator e;
for (e = sec.entries.begin(); e != sec.entries.end(); ++e)
- if ((*e).second.first.contains('{'))
+ if (e->second.first.contains('{'))
multiple_choices.push_back (Entry(subsection_path,
- (*e).first,
- (*e).second.first));
+ e->first,
+ e->second.first));
// transverse subsections
map<String, Section*, less<String> >::const_iterator s;
for (s = sec.subsections.begin(); s != sec.subsections.end(); ++s)
{
- enter_subsection ((*s).first);
- init_branches_section (*(*s).second);
+ enter_subsection (s->first);
+ init_branches_section (*s->second);
leave_subsection ();
};
};
{
// temporarily enter the subsection tree
// of this multiple entry
- subsection_path.swap ((*choice).subsection_path);
+ subsection_path.swap (choice->subsection_path);
// set entry
Section* pd = get_present_defaults_subsection ();
- int selection = (run_no/possibilities) % (*choice).different_values.size();
+ int selection = (run_no/possibilities) % choice->different_values.size();
String entry_value;
- if ((*choice).type == variant)
- entry_value = (*choice).different_values[selection];
+ if (choice->type == variant)
+ entry_value = choice->different_values[selection];
else
{
- if (run_no>=(*choice).different_values.size())
+ if (run_no>=choice->different_values.size())
{
cerr << "The given array for entry "
- << pd->entries[(*choice).entry_name].first
+ << pd->entries[choice->entry_name].first
<< " does not conatin enough elements! Taking empty string instead." << endl;
entry_value = "";
}
else
- entry_value = (*choice).different_values[run_no];
+ entry_value = choice->different_values[run_no];
};
// check conformance with regex
- if (!entry_value.matches (Regex(pd->entries[(*choice).entry_name].second)))
+ if (!entry_value.matches (Regex(pd->entries[choice->entry_name].second)))
{
cerr << "In run no. " << run_no+1 << ":" << endl
<< " The entry value" << endl
<< " " << entry_value << endl
<< " for the entry named" << endl
- << " " << (*choice).entry_name << endl
+ << " " << choice->entry_name << endl
<< " does not match the given regular expression" << endl
- << " " << pd->entries[(*choice).entry_name].second << endl
+ << " " << pd->entries[choice->entry_name].second << endl
<< " Taking default value" << endl
- << " " << pd->entries[(*choice).entry_name].first << endl;
+ << " " << pd->entries[choice->entry_name].first << endl;
// select default instead
- entry_value = pd->entries[(*choice).entry_name].first;
+ entry_value = pd->entries[choice->entry_name].first;
};
Section* pc = get_present_changed_subsection ();
- pc->entries[(*choice).entry_name] = make_pair(entry_value, String(""));
+ pc->entries[choice->entry_name] = make_pair(entry_value, String(""));
// get out of subsection again
- subsection_path.swap ((*choice).subsection_path);
+ subsection_path.swap (choice->subsection_path);
// move ahead if it was a variant entry
- if ((*choice).type == variant)
- possibilities *= (*choice).different_values.size();
+ if (choice->type == variant)
+ possibilities *= choice->different_values.size();
};
};
#include <grid/dof.h>
#include <grid/tria_iterator.h>
#include <grid/tria_iterator.templates.h>
+#include <fe/fe.h>
#include <vector>
else
{
for (line_ptr = &lines.back()-1; line_ptr>=lines.begin(); --line_ptr)
- if ((*line_ptr).line == line)
+ if (line_ptr->line == line)
break;
Assert (false, ExcLineInexistant(line));
};
- (*line_ptr).entries.push_back (make_pair(column,value));
+ line_ptr->entries.push_back (make_pair(column,value));
};
vector<ConstraintLine>::iterator line = lines.begin(),
endl = lines.end();
for (; line!=endl; ++line)
- sort ((*line).entries.begin(), (*line).entries.end());
+ sort (line->entries.begin(), line->entries.end());
// sort the lines
sort (lines.begin(), lines.end());
new_line.push_back (row);
else
for (unsigned int row=0; row!=n_rows; ++row)
- if (row == (*next_constraint).line)
+ if (row == next_constraint->line)
{
// this line is constrained
new_line.push_back (-1);
// let c point to the constraint
// of this column
vector<ConstraintLine>::const_iterator c = lines.begin();
- while ((*c).line != (unsigned int)uncondensed.get_column_numbers()[j])
+ while (c->line != (unsigned int)uncondensed.get_column_numbers()[j])
++c;
- for (unsigned int q=0; q!=(*c).entries.size(); ++q)
- condensed.add (new_line[row], new_line[(*c).entries[q].first]);
+ for (unsigned int q=0; q!=c->entries.size(); ++q)
+ condensed.add (new_line[row], new_line[c->entries[q].first]);
}
else
// line must be distributed
// for each entry: distribute
if (new_line[uncondensed.get_column_numbers()[j]] != -1)
// column is not constrained
- for (unsigned int q=0; q!=(*next_constraint).entries.size(); ++q)
- condensed.add (new_line[(*next_constraint).entries[q].first],
+ for (unsigned int q=0; q!=next_constraint->entries.size(); ++q)
+ condensed.add (new_line[next_constraint->entries[q].first],
new_line[uncondensed.get_column_numbers()[j]]);
else
// let c point to the constraint
// of this column
vector<ConstraintLine>::const_iterator c = lines.begin();
- while ((*c).line != (unsigned int)uncondensed.get_column_numbers()[j]) ++c;
+ while (c->line != (unsigned int)uncondensed.get_column_numbers()[j]) ++c;
- for (unsigned int p=0; p!=(*c).entries.size(); ++p)
- for (unsigned int q=0; q!=(*next_constraint).entries.size(); ++q)
- condensed.add (new_line[(*next_constraint).entries[q].first],
- new_line[(*c).entries[p].first]);
+ for (unsigned int p=0; p!=c->entries.size(); ++p)
+ for (unsigned int q=0; q!=next_constraint->entries.size(); ++q)
+ condensed.add (new_line[next_constraint->entries[q].first],
+ new_line[c->entries[p].first]);
};
++next_constraint;
distribute.resize (sparsity.n_rows(), -1);
for (unsigned int c=0; c<lines.size(); ++c)
- distribute[lines[c].line] = (signed int)c;
+ distribute[lines[c].line] = static_cast<signed int>(c);
int n_rows = sparsity.n_rows();
for (int row=0; row<n_rows; ++row)
new_line.push_back (row);
else
for (unsigned int row=0; row!=n_rows; ++row)
- if (row == (*next_constraint).line)
+ if (row == next_constraint->line)
{
// this line is constrained
new_line.push_back (-1);
// let c point to the constraint
// of this column
vector<ConstraintLine>::const_iterator c = lines.begin();
- while ((*c).line != (unsigned int)uncondensed_struct.get_column_numbers()[j]) ++c;
+ while (c->line != (unsigned int)uncondensed_struct.get_column_numbers()[j])
+ ++c;
- for (unsigned int q=0; q!=(*c).entries.size(); ++q)
+ for (unsigned int q=0; q!=c->entries.size(); ++q)
// distribute to rows with
// appropriate weight
- condensed.add (new_line[row], new_line[(*c).entries[q].first],
- uncondensed.global_entry(j) * (*c).entries[q].second);
+ condensed.add (new_line[row], new_line[c->entries[q].first],
+ uncondensed.global_entry(j) * c->entries[q].second);
}
else
// line must be distributed
// for each column: distribute
if (new_line[uncondensed_struct.get_column_numbers()[j]] != -1)
// column is not constrained
- for (unsigned int q=0; q!=(*next_constraint).entries.size(); ++q)
- condensed.add (new_line[(*next_constraint).entries[q].first],
+ for (unsigned int q=0; q!=next_constraint->entries.size(); ++q)
+ condensed.add (new_line[next_constraint->entries[q].first],
new_line[uncondensed_struct.get_column_numbers()[j]],
uncondensed.global_entry(j) *
- (*next_constraint).entries[q].second);
+ next_constraint->entries[q].second);
else
// not only this line but
// let c point to the constraint
// of this column
vector<ConstraintLine>::const_iterator c = lines.begin();
- while ((*c).line != (unsigned int)uncondensed_struct.get_column_numbers()[j]) ++c;
+ while (c->line != (unsigned int)uncondensed_struct.get_column_numbers()[j])
+ ++c;
- for (unsigned int p=0; p!=(*c).entries.size(); ++p)
- for (unsigned int q=0; q!=(*next_constraint).entries.size(); ++q)
- condensed.add (new_line[(*next_constraint).entries[q].first],
- new_line[(*c).entries[p].first],
+ for (unsigned int p=0; p!=c->entries.size(); ++p)
+ for (unsigned int q=0; q!=next_constraint->entries.size(); ++q)
+ condensed.add (new_line[next_constraint->entries[q].first],
+ new_line[c->entries[p].first],
uncondensed.global_entry(j) *
- (*next_constraint).entries[q].second *
- (*c).entries[p].second);
+ next_constraint->entries[q].second *
+ c->entries[p].second);
};
++next_constraint;
distribute.resize (sparsity.n_rows(), -1);
for (unsigned int c=0; c<lines.size(); ++c)
- distribute[lines[c].line] = (signed int)c;
+ distribute[lines[c].line] = static_cast<signed int>(c);
int n_rows = sparsity.n_rows();
for (int row=0; row<n_rows; ++row)
new_line.push_back (row);
else
for (unsigned int row=0; row!=n_rows; ++row)
- if (row == (*next_constraint).line)
+ if (row == next_constraint->line)
{
// this line is constrained
new_line.push_back (-1);
else
// line must be distributed
{
- for (unsigned int q=0; q!=(*next_constraint).entries.size(); ++q)
- condensed(new_line[(*next_constraint).entries[q].first])
+ for (unsigned int q=0; q!=next_constraint->entries.size(); ++q)
+ condensed(new_line[next_constraint->entries[q].first])
+=
- uncondensed(row) * (*next_constraint).entries[q].second;
+ uncondensed(row) * next_constraint->entries[q].second;
++next_constraint;
};
vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
for (unsigned int row=0; row<vec.n(); ++row)
- if (row == (*next_constraint).line)
+ if (row == next_constraint->line)
// line must be distributed
{
- for (unsigned int q=0; q!=(*next_constraint).entries.size(); ++q)
- vec((*next_constraint).entries[q].first)
+ for (unsigned int q=0; q!=next_constraint->entries.size(); ++q)
+ vec(next_constraint->entries[q].first)
+=
- vec(row) * (*next_constraint).entries[q].second;
+ vec(row) * next_constraint->entries[q].second;
// set entry to zero
vec(row) = 0.;
old_line.push_back (row);
else
for (unsigned int row=0; row!=n_rows; ++row)
- if (row == (*next_constraint).line)
+ if (row == next_constraint->line)
{
// this line is constrained
old_line.push_back (-1);
// first set it to zero
uncondensed(line) = 0.;
// then add the different contributions
- for (unsigned int i=0; i<(*next_constraint).entries.size(); ++i)
- uncondensed(line) += (condensed(old_line[(*next_constraint).entries[i].first]) *
- (*next_constraint).entries[i].second);
+ for (unsigned int i=0; i<next_constraint->entries.size(); ++i)
+ uncondensed(line) += (condensed(old_line[next_constraint->entries[i].first]) *
+ next_constraint->entries[i].second);
++next_constraint;
};
};
{
// make entry in line next_constraint.line
// first set it to zero
- vec((*next_constraint).line) = 0.;
+ vec(next_constraint->line) = 0.;
// then add the different contributions
- for (unsigned int i=0; i<(*next_constraint).entries.size(); ++i)
- vec((*next_constraint).line) += (vec((*next_constraint).entries[i].first) *
- (*next_constraint).entries[i].second);
+ for (unsigned int i=0; i<next_constraint->entries.size(); ++i)
+ vec(next_constraint->line) += (vec(next_constraint->entries[i].first) *
+ next_constraint->entries[i].second);
};
};
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
#include <grid/tria.h>
+#include <fe/fe.h>
#include <lac/dsmatrix.h>
#include <map>
#include <algorithm>
template <int dim>
-const FiniteElement<dim> & DoFHandler<dim>::get_selected_fe () const {
+const FiniteElementBase<dim> & DoFHandler<dim>::get_selected_fe () const {
return *selected_fe;
};
template <int dim>
-void DoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &fe) {
+void DoFHandler<dim>::distribute_dofs (const FiniteElementBase<dim> &fe) {
Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
- reserve_space (fe);
if (selected_fe != 0) delete selected_fe;
- selected_fe = new FiniteElement<dim>(fe);
+ selected_fe = new FiniteElementBase<dim>(fe);
+ reserve_space ();
// clear user flags because we will
// need them
active_cell_iterator cell = begin_active(),
endc = end();
for (; cell != endc; ++cell)
- next_free_dof = distribute_dofs_on_cell (cell, fe, next_free_dof);
+ next_free_dof = distribute_dofs_on_cell (cell, next_free_dof);
used_dofs = next_free_dof;
};
int DoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell,
- const FiniteElement<1> &fe,
unsigned int next_free_dof) {
// distribute dofs of vertices
// copy dofs
{
if (v==0)
- for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
- cell->set_vertex_dof_index (0, d, neighbor->vertex_dof_index (1, d));
+ for (unsigned int d=0; d<selected_fe->dofs_per_vertex; ++d)
+ cell->set_vertex_dof_index (0, d,
+ neighbor->vertex_dof_index (1, d));
else
- for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
- cell->set_vertex_dof_index (1, d, neighbor->vertex_dof_index (0, d));
+ for (unsigned int d=0; d<selected_fe->dofs_per_vertex; ++d)
+ cell->set_vertex_dof_index (1, d,
+ neighbor->vertex_dof_index (0, d));
// next neighbor
continue;
};
// otherwise: create dofs newly
- for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
+ for (unsigned int d=0; d<selected_fe->dofs_per_vertex; ++d)
cell->set_vertex_dof_index (v, d, next_free_dof++);
};
// dofs of line
- for (unsigned int d=0; d<fe.dofs_per_line; ++d)
+ for (unsigned int d=0; d<selected_fe->dofs_per_line; ++d)
cell->set_dof_index (d, next_free_dof++);
// note that this cell has been processed
int DoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell,
- const FiniteElement<2> &fe,
unsigned int next_free_dof) {
- if (fe.dofs_per_vertex > 0)
+ if (selected_fe->dofs_per_vertex > 0)
// number dofs on vertices
for (unsigned int vertex=0; vertex<4; ++vertex)
// check whether dofs for this
// vertex have been distributed
// (only check the first dof)
if (cell->vertex_dof_index(vertex, 0) == -1)
- for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
+ for (unsigned int d=0; d<selected_fe->dofs_per_vertex; ++d)
cell->set_vertex_dof_index (vertex, d, next_free_dof++);
// for the four sides
line_iterator line = cell->line(side);
// distribute dofs if necessary
- if ((fe.dofs_per_line > 0) &&
+ if ((selected_fe->dofs_per_line > 0) &&
// check whether line dof is already
// numbered (check only first dof)
(line->dof_index(0) == -1))
// if not: distribute dofs
- for (unsigned int d=0; d<fe.dofs_per_line; ++d)
+ for (unsigned int d=0; d<selected_fe->dofs_per_line; ++d)
line->set_dof_index (d, next_free_dof++);
// note if line is subject to constraints
// dofs of quad
- if (fe.dofs_per_quad > 0)
- for (unsigned int d=0; d<fe.dofs_per_line; ++d)
+ if (selected_fe->dofs_per_quad > 0)
+ for (unsigned int d=0; d<selected_fe->dofs_per_line; ++d)
cell->set_dof_index (d, next_free_dof++);
////
multimap<unsigned int, int, less<unsigned int> >::iterator i;
for (i = dofs_by_coordination.begin(); i!=dofs_by_coordination.end(); ++i)
- new_number[(*i).second] = next_free_number++;
+ new_number[i->second] = next_free_number++;
// after that: copy this round's
// dofs for the next round
-void DoFHandler<1>::reserve_space (const FiniteElement<1> &fe) {
+void DoFHandler<1>::reserve_space () {
+ Assert (selected_fe != 0, ExcNoFESelected());
Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
// delete all levels and set them up
// newly, since vectors are
levels.push_back (new DoFLevel<1>);
levels.back()->line_dofs.resize (tria->levels[i]->lines.lines.size() *
- fe.dofs_per_line,
+ selected_fe->dofs_per_line,
-1);
};
};
-void DoFHandler<2>::reserve_space (const FiniteElement<2> &fe) {
+void DoFHandler<2>::reserve_space () {
+ Assert (selected_fe != 0, ExcNoFESelected());
Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
// delete all levels and set them up
levels.push_back (new DoFLevel<2>);
levels.back()->line_dofs.resize (tria->levels[i]->lines.lines.size() *
- fe.dofs_per_line,
+ selected_fe->dofs_per_line,
-1);
levels.back()->quad_dofs.resize (tria->levels[i]->quads.quads.size() *
- fe.dofs_per_quad,
+ selected_fe->dofs_per_quad,
-1);
};
};
if (lines_at_vertex[line->vertex_index(vertex)][0] == line->index())
if (lines_at_vertex[line->vertex_index(vertex)].size() == 2)
{
- const cell_iterator neighbor ((Triangulation<1>*)this,
+ const cell_iterator neighbor (const_cast<Triangulation<1>*>(this),
0, // level
lines_at_vertex[line->vertex_index(vertex)][1]);
line->set_neighbor (vertex, neighbor);
// present line is not first adjacent
// one -> first adjacent one is neighbor
{
- const cell_iterator neighbor ((Triangulation<1>*)this,
+ const cell_iterator neighbor (const_cast<Triangulation<1>*>(this),
0, // level
lines_at_vertex[line->vertex_index(vertex)][0]);
line->set_neighbor (vertex, neighbor);
for (i=needed_lines.begin(); i!=needed_lines.end(); i++)
{
// touch the vertices of this line
- ++vertex_touch_count[(*i).first.first];
- ++vertex_touch_count[(*i).first.second];
+ ++vertex_touch_count[i->first.first];
+ ++vertex_touch_count[i->first.second];
};
// assert minimum touch count is at
map<pair<int,int>,line_iterator,less<pair<int,int> > >::iterator i;
for (i = needed_lines.begin(); line!=end_line(); ++line, ++i)
{
- line->set (Line((*i).first.first, (*i).first.second));
+ line->set (Line(i->first.first, i->first.second));
line->set_used_flag ();
- (*i).second = line;
+ i->second = line;
};
};
for (; boundary_line!=end_boundary_line; ++boundary_line)
{
line_iterator line;
- pair<int,int> line_vertices(make_pair((*boundary_line).vertices[0],
- (*boundary_line).vertices[1]));
+ pair<int,int> line_vertices(make_pair(boundary_line->vertices[0],
+ boundary_line->vertices[1]));
if (needed_lines.find(line_vertices) != needed_lines.end())
// line found in this direction
line = needed_lines[line_vertices];
Assert (line->boundary_indicator() == 0,
ExcInteriorLineCantBeBoundary());
- line->set_boundary_indicator ((*boundary_line).material_id);
+ line->set_boundary_indicator (boundary_line->material_id);
};
// 3. magic number 0xabcd
out << mn_tria_refine_flags_begin << " " << N << endl;
for (unsigned int i=0; i<N/8+1; ++i)
- out << (unsigned int)flags[i] << " ";
+ out << static_cast<unsigned int>(flags[i]) << " ";
out << endl;
out << mn_tria_refine_flags_end << endl;
// 3. magic number 0xabcf
out << mn_tria_line_user_flags_begin << " " << N << endl;
for (unsigned int i=0; i<N/8+1; ++i)
- out << (unsigned int)flags[i] << " ";
+ out << static_cast<unsigned int>(flags[i]) << " ";
out << endl;
out << mn_tria_line_user_flags_end << endl;
// 3. magic number 0xabcf
out << mn_tria_quad_user_flags_begin << " " << N << endl;
for (unsigned int i=0; i<N/8+1; ++i)
- out << (unsigned int)flags[i] << " ";
+ out << static_cast<unsigned int>(flags[i]) << " ";
out << endl;
out << mn_tria_quad_user_flags_end << endl;
if (levels[level]->lines.lines.size() == 0)
return end_line ();
- return raw_line_iterator ((Triangulation<dim>*)this,
+ return raw_line_iterator (const_cast<Triangulation<dim>*>(this),
level,
0);
};
if (levels[level]->quads.quads.size() == 0)
return end_quad();
- return raw_quad_iterator ((Triangulation<dim>*)this,
+ return raw_quad_iterator (const_cast<Triangulation<dim>*>(this),
level,
0);
};
template <int dim>
typename TriaDimensionInfo<dim>::raw_line_iterator
Triangulation<dim>::end_line () const {
- return raw_line_iterator ((Triangulation<dim>*)this,
+ return raw_line_iterator (const_cast<Triangulation<dim>*>(this),
-1,
-1);
};
template <int dim>
typename TriaDimensionInfo<dim>::raw_quad_iterator
Triangulation<dim>::end_quad () const {
- return raw_quad_iterator ((Triangulation<dim>*)this,
+ return raw_quad_iterator (const_cast<Triangulation<dim>*>(this),
-1,
-1);
};
Assert (levels[level]->lines.lines.size() != 0,
ExcEmptyLevel (level));
- return raw_line_iterator ((Triangulation<dim>*)this,
+ return raw_line_iterator (const_cast<Triangulation<dim>*>(this),
level,
levels[level]->lines.lines.size()-1);
};
Assert (levels[level]->quads.quads.size() != 0,
ExcEmptyLevel (level));
- return raw_quad_iterator ((Triangulation<dim>*)this,
+ return raw_quad_iterator (const_cast<Triangulation<dim>*>(this),
level,
levels[level]->quads.quads.size()-1);
};
for (unsigned vertex=0; vertex<(1<<dim); ++vertex)
++usage_count[cell->vertex_index(vertex)];
- return max ((unsigned int)1<<dim,
- (unsigned int)*(max_element (usage_count.begin(),usage_count.end())));
+ return max (static_cast<unsigned int>(1<<dim),
+ static_cast<unsigned int>(*(max_element (usage_count.begin(),
+ usage_count.end()))));
};
#include <numerics/assembler.h>
#include <grid/tria_iterator.h>
#include <grid/tria_iterator.templates.h>
+#include <fe/fe.h>
#include <lac/dfmatrix.h>
#include <lac/dvector.h>
#include <lac/dsmatrix.h>
dVector &rhs_vector,
const Quadrature<dim> &quadrature,
const FiniteElement<dim> &fe,
- const UpdateFields &update_flags,
+ const UpdateFlags &update_flags,
const Boundary<dim> &boundary) :
dof(dof),
assemble_matrix(assemble_matrix),
template <int dim>
void Assembler<dim>::assemble (const Equation<dim> &equation) {
// re-init fe values for this cell
- fe_values.reinit (Triangulation<dim>::cell_iterator (tria,
- present_level,
- present_index),
+ fe_values.reinit (DoFHandler<dim>::cell_iterator (tria,
+ present_level,
+ present_index),
fe,
boundary);
const unsigned int n_dofs = dof_handler->get_selected_fe().total_dofs;
#include <grid/tria_iterator.h>
#include <basic/data_io.h>
#include <basic/function.h>
+#include <fe/fe.h>
#include <fe/quadrature.h>
#include "../../../mia/control.h"
void ProblemBase<dim>::assemble (const Equation<dim> &equation,
const Quadrature<dim> &quadrature,
const FiniteElement<dim> &fe,
- const UpdateFields &update_flags,
+ const UpdateFlags &update_flags,
const DirichletBC &dirichlet_bc,
const Boundary<dim> &boundary) {
Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
difference.reinit (tria->n_active_cells());
- UpdateFields update_flags = UpdateFields (update_q_points |
- update_jacobians |
- update_JxW_values);
+ UpdateFlags update_flags = UpdateFlags (update_q_points |
+ update_jacobians |
+ update_JxW_values);
if ((norm==H1_seminorm) || (norm==H1_norm))
- update_flags = UpdateFields (update_flags | update_gradients);
+ update_flags = UpdateFlags (update_flags | update_gradients);
FEValues<dim> fe_values(fe, q, update_flags);
// loop over all cells
- // (we need an iterator on the triangulation for
- // fe_values.reinit, but we also need an iterator
- // on the dofhandler; we could generate the first
- // out of the second or vice versa each time
- // we need them, but conversion seems to be slow.
- // therefore, we keep two iterators, hoping that
- // incrementing is faster than conversion...)
DoFHandler<dim>::active_cell_iterator cell = dof_handler->begin_active(),
endc = dof_handler->end();
- Triangulation<dim>::active_cell_iterator tria_cell = dof_handler->get_tria().begin_active();
-
- for (unsigned int index=0; cell != endc; ++cell, ++tria_cell, ++index)
+ for (unsigned int index=0; cell != endc; ++cell, ++index)
{
double diff=0;
// initialize for this cell
- fe_values.reinit (tria_cell, fe, boundary);
+ fe_values.reinit (cell, fe, boundary);
switch (norm)
{
make_boundary_value_list (dirichlet_bc, fe, boundary, boundary_values);
map<int,double>::const_iterator dof, endd;
- const unsigned int n_dofs = (unsigned int)matrix.m();
+ const unsigned int n_dofs = matrix.m();
const dSMatrixStruct &sparsity = matrix.get_sparsity_pattern();
const unsigned int *sparsity_rowstart = sparsity.get_rowstart_indices();
const int *sparsity_colnums = sparsity.get_column_numbers();
// set entries of this line
// to zero
- for (unsigned int j=sparsity_rowstart[(*dof).first];
- j<sparsity_rowstart[(*dof).first+1]; ++j)
- if (sparsity_colnums[j] != (*dof).first)
+ for (unsigned int j=sparsity_rowstart[dof->first];
+ j<sparsity_rowstart[dof->first+1]; ++j)
+ if (sparsity_colnums[j] != dof->first)
// if not main diagonal entry
matrix.global_entry(j) = 0.;
// store the new rhs entry to make
// the gauss step more efficient
double new_rhs;
- if (matrix.diag_element((*dof).first) != 0.0)
- new_rhs = right_hand_side((*dof).first)
- = (*dof).second * matrix.diag_element((*dof).first);
+ if (matrix.diag_element(dof->first) != 0.0)
+ new_rhs = right_hand_side(dof->first)
+ = dof->second * matrix.diag_element(dof->first);
else
{
double first_diagonal_entry = 1;
break;
};
- matrix.set((*dof).first, (*dof).first,
+ matrix.set(dof->first, dof->first,
first_diagonal_entry);
- new_rhs = right_hand_side((*dof).first)
- = (*dof).second * first_diagonal_entry;
+ new_rhs = right_hand_side(dof->first)
+ = dof->second * first_diagonal_entry;
};
// store the only nonzero entry
// of this line for the Gauss
// elimination step
- const double diagonal_entry = matrix.diag_element((*dof).first);
+ const double diagonal_entry = matrix.diag_element(dof->first);
// do the Gauss step
for (unsigned int row=0; row<n_dofs; ++row)
for (unsigned int j=sparsity_rowstart[row];
j<sparsity_rowstart[row+1]; ++j)
- if ((sparsity_colnums[j] == (signed int)(*dof).first) &&
- ((signed int)row != (*dof).first))
+ if ((sparsity_colnums[j] == (signed int)dof->first) &&
+ ((signed int)row != dof->first))
// this line has an entry
// in the regarding column
// but this is not the main
// preset solution vector
- solution((*dof).first) = (*dof).second;
+ solution(dof->first) = dof->second;
};
};
// a Tria-iterator for the fe object
DoFHandler<dim>::active_face_iterator face = dof_handler->begin_active_face(),
endf = dof_handler->end_face();
- Triangulation<dim>::active_face_iterator tface = tria->begin_active_face();
DirichletBC::const_iterator function_ptr;
vector<Point<dim> > dof_locations (face_dofs.size(), Point<dim>());
vector<double> dof_values;
- for (; face!=endf; ++face, ++tface)
+ for (; face!=endf; ++face)
if ((function_ptr = dirichlet_bc.find(face->boundary_indicator())) !=
dirichlet_bc.end())
// face is subject to one of the
face_dofs.erase (face_dofs.begin(), face_dofs.end());
dof_values.erase (dof_values.begin(), dof_values.end());
face->get_dof_indices (face_dofs);
- fe.face_ansatz_points (tface, boundary, dof_locations);
- (*function_ptr).second->value_list (dof_locations, dof_values);
+ fe.get_face_ansatz_points (face, boundary, dof_locations);
+ function_ptr->second->value_list (dof_locations, dof_values);
// enter into list
for (unsigned int i=0; i<face_dofs.size(); ++i)
#include <grid/dof_accessor.h>
#include <grid/tria_iterator.h>
#include <grid/tria.h>
+#include <fe/fe.h>
+
#include <map>
#include <iostream>
#include <iomanip>
Assert (dofs->get_selected_fe().dofs_per_vertex==1,
ExcIncorrectDofsPerVertex());
+ // write preamble
+ if (true)
+ {
+ // block this to have local
+ // variables destroyed after
+ // use
+ time_t time1= time (0);
+ tm *time = localtime(&time1);
+ out << "# This file was generated by the deal.II library." << endl
+ << "# Date = "
+ << time->tm_year+1900 << "/"
+ << time->tm_mon+1 << "/"
+ << time->tm_mday << endl
+ << "# Time = "
+ << time->tm_hour << ":"
+ << setw(2) << time->tm_min << ":"
+ << setw(2) << time->tm_sec << endl
+ << "#" << endl
+ << "# For a description of the UCD format see the AVS Developers guide."
+ << endl
+ << "#" << endl
+ << "# ";
+ switch (dim)
+ {
+ case 1:
+ out << "<x> ";
+ break;
+ case 2:
+ out << "<x> <y> ";
+ break;
+ default:
+ Assert (false, ExcNotImplemented());
+ };
+ for (unsigned int i=0; i!=data.size(); ++i)
+ out << '<'
+ << data[i].name << ':' << data[i].units
+ << "> ";
+ out << endl;
+
+ };
+
+
DoFHandler<dim>::active_cell_iterator cell;
DoFHandler<dim>::active_cell_iterator endc = dofs->end();
break;
- case 3:
+ default:
Assert (false, ExcNotImplemented());
};
};