I have faced some problems in my code, and need your help.
1. I see that the user can pass parameters into equation_systems, so they
can be retrieved in other functions. But when I want to pass a vector or
matrix, it won't work:
std::vector<Number> & EDA =
equation_systems.parameters.set<std::vector<Number> > ("ElemDensity");
const unsigned int NElem = mesh.n_elem();
EDA.resize(NElem);
for (unsigned int i = 0; i < NElem; i++) {
EDA[i] = 1.0;
std::cout << EDA[i] << std::endl;
}
Where am I wrong? How can I achieve my purpose?
2. I'm modeling a problem with multiple loadcases. I should solve the
system, save the solution; then change to another loadcase, solve the
system, and save again. All the saved solutions will be used later. But I
don't know how to save the solution in a vector? Will the following code
work?
equation_systems.parameters.set<std::string> ("loadcase") = "11";
system.solve();
std::vector<Number> U11 = system.solution;
system.matrix->zero();
system.rhs->zero();
system.solution->zero();
equation_systems.parameters.set<std::string> ("loadcase") = "22";
system.solve();
std::vector<Number> U22 = system.solution;
system.matrix->zero();
system.rhs->zero();
system.solution->zero();
where the system is a LinearImplicitSystem.
I'll be really appreciated for your answer, thanks at all!
--
Cai Yuanwu 蔡园武
Dept. of Engineering Mechanics,
Dalian University of Technology,
Dalian 116024, China
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users