Hi , What is the easiest way to create an array or vector of densesubvectors 
and densesubmatrices. I've been using vectors of pointers. but it is highly 
unreliable and often fails with ugly error messages and core dumps.  Thanks, 
Subramanya 
(PS.) This is what I've been doing and what seemed to work, but is now refusing 
to.  
  DenseVector<Number> Fe;  std::vector<DenseSubVector<Number>* > Fesub;  
Fesub.resize(n_phases);  for (unsigned int i=0;i<n_phases; i++)     {      
Fesub[i] = new DenseSubVector<Number>(Fe);          }

followed by for each element 
   Fe.resize(dof_indices.size());      for (unsigned int i=0; i< n_phases; i++) 
        Fesub[i]->reposition(variable_numbers[i]*n_dofs, n_dofs); 
finally,  for (unsigned int i=0; i<n_dofs; i++)             for (unsigned int 
j=0; j<n_phases; j++)           Fesub[j]->el(i)+= 1.0;

This has generally worked, but now I get this backtrace in gdb
0  0x00007ffff1a2cf77 in __GI_raise (sig=sig@entry=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:56#1  0x00007ffff1a305e8 in __GI_abort 
() at abort.c:90#2  0x00007ffff1a6a4fb in __libc_message 
(do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff1b7e240 "*** Error in `%s': 
%s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:199#3  
0x00007ffff1a76996 in malloc_printerr (ptr=0xb99550, str=0x7ffff1b7e3e0 
"free(): invalid next size (fast)", action=3) at malloc.c:4923#4  _int_free 
(av=<optimized out>, p=0xb99540, have_lock=0) at malloc.c:3779#5  
0x000000000044d940 in __gnu_cxx::new_allocator<double>::deallocate 
(this=0x7fffffffccf0, __p=0xb99550) at 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/new_allocator.h:110#6
  0x000000000044d89e in std::_Vector_base<double, std::allocator<double> 
>::_M_deallocate (this=0x7fffffffccf0, __p=0xb99550, __n=3)    at 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:174#7
  0x000000000044d82c in std::_
 Vector_base<double, std::allocator<double> >::~_Vector_base 
(this=0x7fffffffccf0) at 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:160#8
  0x00000000004584c2 in std::vector<double, std::allocator<double> >::~vector 
(this=0x7fffffffccf0) at 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:416#9
  0x0000000000442a15 in std::vector<double, std::allocator<double> >::~vector 
(this=0x7fffffffccf0) at 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:415#10
 0x000000000043b34f in compute_curvatures (es=...) at chlinear.C:1351#11 
0x000000000042ded6 in main (argc=1, argv=0x7fffffffe028) at chlinear.C:465

                                          
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to