[Trilinos-Users] [EXTERNAL] Teuchos::ParameterList error

Andrey Prokopenko aprokop at sandia.gov
Mon May 12 14:46:27 MDT 2014


Hi Kwangwoo,

I cannot seem to reproduce the problem. I ran optimized build with 
Trilinos 11.1 and 11.9.
I've attached the code I ran (which is a slightly modified version of 
yours).

-Andrey

On Thu 08 May 2014 02:50:51 AM MDT, 홍광우 wrote:
> Dear Trilinos developers and users,
>
>
> Hello, I have a problem when I use Teuchos::ParameterList. I'm
> with Trilinos version 11.4.3.
>
>
> The problem is like this. For example,
>
>
> ===============================================================
>
> int main(){
>
>     Teuchos::ParameterList* parameters = new Teuchos::ParametersList();
>
>
>     Class* class = new Class(parameters);
>
> }
>
>
> Class::Class(Teuchos::ParameterList* parameters){
>
>
>     parameters->sublist("sublist").set("p1", 1);
>
>
>     cout << *parameters << endl; ------------ (1)
>
>     cout << parameters->sublist("sublist").get<int>("p1") << endl;
> ------------ (2)
>
> }
>
> ===============================================================
>
>
> When I cout (1), the result is
>
>
> ====================
>
> sublist ->
>
>  p1 = 1  [unused]
>
> ====================
>
>
> However, when I cout (2), the error occurs as the following.
>
>
> =================================================
>
> terminate called after throwing an instance of
> 'Teuchos::StringIndexedOrderedValueObjectContainerBase::InvalidOrdinalIndexError'
>
>   what():
>  /usr/local/include/Teuchos_StringIndexedOrderedValueObjectContainer.hpp:534:
>
>
> Throw number = 1
>
>
> Throw test that evaluated to true: !key_and_obj.isActive()
>
>
> Error, the ordinal index 0 is invalid because the object has been deleted!
>
> =================================================
>
>
> Does anyone know what the problem is? Please help me.
>
>
> Sincerely,
>
>
> Kwangwoo Hong
>
>
> Kwangwoo Hong
>
> Ph.D Candidate
>
> Department of Chemistry, KAIST
>
> +82-42-350-2855
>
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> https://software.sandia.gov/mailman/listinfo/trilinos-users
-------------- next part --------------
#include <Teuchos_ParameterList.hpp>
#include <iostream>

struct CC {
    CC(Teuchos::ParameterList* parameters) {
        parameters->sublist("sublist").set("p1", 1);

        std::cout << "[1]: " << *parameters << std::endl;
        std::cout << "[2]: " << parameters->sublist("sublist").get<int>("p1") << std::endl;
    }
};

int main() {
    Teuchos::ParameterList* parameters = new Teuchos::ParameterList();

    CC* c = new CC(parameters);

    return 0;
}


More information about the Trilinos-Users mailing list