Object-Oriented Transformations for Extracting Aspects In the migration of object-oriented systems towards the aspect technology, after locating fragments of code presenting a crosscutting behavior and before extracting such code to aspects, transformations may be needed in the base program. Such transformations aim to associate crosscutting code to points of the base program that can be captured using the pointcut descriptor model of aspect-oriented languages. In this paper, we present a catalog of object-oriented transformations and demonstrate the importance of such transformations by reporting on a case study involving four systems that have been aspectized using AspectJ. In the last ten years, aspects have emerged as the main programming paradigm for the modularization of crosscutting concerns. As a consequence, several works have been developed in two areas that are critical when migrating to this new technology: aspect mining [6, 19, 34] and aspect-oriented refactoring [21, 16, 24, 25] . The purpose of aspect mining techniques is to identify crosscutting concerns in legacy, non-aspect-oriented code. Once they are located in the target program, aspectoriented refactorings can be applied to modularize such concerns into equivalent aspects. As usual in refactoring tasks, the purpose is to improve the internal structure and the design of a given system, while preserving its behavior [13] .. However, often it is not possible to directly extract to aspects concerns suggested by aspect mining tools [24, 2, 3] . The reason is that aspect-oriented languages only support the introduction of crosscutting behavior in join points, i.e. well-defined points of the execution of object-oriented systems. For example, in AspectJ join points include methods calls and execution, read and write to fields, exception handlers execution, class initialization etc. However, in legacy systems we should not expect that crosscutting code is located precisely before, around or after join points, as required by AspectJ. Thus, after the mining of crosscutting concerns and before the beginning of the refactoring task, programmers usually need to transform the base program in order to associate crosscutting statements with parts of the program that can be captured by the pointcuts of an aspect-oriented language [2, 3] .. Most of the works in the area of aspect-oriented refactoring frequently mention the need of such enabling object-oriented transformations. However, they usually do not provide detailed information about the spectrum of the possible transformations and the frequency that such transformations are required when migrating real-world systems to aspects. For example, in one of the first papers about aspect-oriented refactoring, Monteiro recognizes that "it is sometimes necessary to refactor the base code in order to expose the necessary join points to AspectJ" [23] . However, even in Monteiro more recent papers, this necessity is not investigated in details [24, 25] . In a paper from 2001, Murphy et al. affirm that a concern can be easier modularized "if advance work to prepare the software system is undertaken" [26] . However, the recommended preparation only includes encapsulating concerns in entire methods and classes and moving groups of crosscutting statements to the beginning and ends of methods. When proposing a tool and a refactoring methodology for decomposing legacy applications into a set of features, Liu, Batory and Lengauer mention that rearranging the order of statements may be needed before tangling features can be extracted [22] . However, they have not quantified the frequency that such reorderings are required. Instead, they only mention that "several iterations of this step may be necessary to achieve an acceptable refactoring". Binkley and colleagues have developed the AOP-Migrator tool, an Eclipse plug-in that automates a set of aspect-oriented refactorings [3] . They recognize that "OO transformations represent an important cost in the migration process" towards aspect-oriented systems and present wrap-up statistics on the use of such transformations in the refactoring of four medium-sized Java programs. However, since their emphasis was on the presentation of the refactorings automated by AOP-Migrator, the authors have not devoted too much effort in describing and giving examples about object-oriented transformations.. This paper documents an in-depth investigation about transformations that must be applied to the base code of object-oriented systems, after the identification of crosscutting concerns and before the encapsulation of such concerns in aspects. The contributions of the paper are twofold. First, it describes a collection of object-to-object transformations used to enable the extraction of crosscutting statements to aspects. Similar to catalogs of object-oriented refactorings, the description is illustrated by examples taken from real-world aspect-oriented systems. Second, the paper details results about the use and the importance of such transformations in object-oriented systems that have been migrated to aspects. Such results demonstrate that the transformations investigated in the paper are critical to turn legacy systems ready to aspect-oriented refactorings. For example, the ratio between the number of applied transformations to the number of join points advised by aspects has ranged from 0.15 to 1.33 in the systems considered in our study. We have also concluded that it is very complex to automate the proposed transformations, even if supposing that concerns have been previously located by an aspect mining tool.. The remaining of the paper is organized as follows. We start out describing the identified transformations and giving examples of their use in four Java systems (Section 2). Next, Section 3 quantifies the use of the proposed transformations in such systems and correlates this use with the kind of crosscutting concern being aspectized. In Section 4 we discuss related work and Section 5 presents the conclusions. Finally, Appendix A presents a formal description of the transformations used in the paper. In this paper, we have documented 24 transformations that can be applied to object-oriented code in order to enable join points that can be captured by the pointcut language supported by AspectJ. Basically, such transformations include statement reorderings and method extractions. We have also quantified the use of these transformations in four legacy Java systems that have been the target of aspect-oriented refactorings. This experience allowed us to conclude that OO transformations are critical in aspect-oriented refactoring processes, particularly when they involve the modularization of homogeneous concerns. Despite their importance, OO transformations can not be easily automated, since they require complex, system-wide data and control dependency analysis.. In the future, we intend to work in new case studies. We also intend to design and implement a tool that supports mapping crosscutting concerns to code, similar to systems such as ConcernMapper [28] and Concern Manipulation Environment (CME) [7] . This tool should also indicate if the mapped crosscutting concerns can be extracted to aspects (without any transformation) or not. The idea is to provide information about the amount of transformation that must be applied to a system before starting its aspectization. Related work can be arranged in four groups: object-oriented refactoring tools, aspect-oriented refactoring tools, catalogs of aspect-oriented refactorings and experiences in refactoring legacy applications.. Object-oriented refactoring tools: Because most refactorings require nontrivial manipulation of the codebase, program transformation systems can be used to automate refactoring application [27, 31] . Early work in this area was done by Darlington and Burstall, concerning transformations to improve the performance of functional programs [5] . More recent systems include Stratego [30] , TXL [11] and JunGL [29] . Stratego is a transformation system based on the paradigm of rewriting rules and strategies to control the process of transforming the program code. TXL is a another transformation language based on term rewriting and first order functional programming. JunGL is a domain-specific language that relies on predicates and path queries embedded within an ML-based language. As mentioned in Section 3, statement reordering transformations are usually more complex than common OO refactorings, since they depend on system-wide data and control flow information, which are not provided by the mentioned transformation systems.. Aspect-oriented refactoring tools: The study of the object-oriented transformations described in this paper has been motivated by an experience with the AOP-Migrator tool, an Eclipse plug-in that automates six refactorings commonly used to support migration from OOP to AOP [2, 3] . The experience has showed that in most cases the supported refactorings can not be directly applied, since they require preconditions that are usually not present in legacy code. This has motivated us to work on a catalog of enabling OO transformations and to investigate in details the use of such transformations in four Java applications, including two systems -JAccounting and JHotDrawthat have been aspectized with the support of AOP-Migrator. Liu, Batory and Lengauer describe a refactoring methodology to decompose a monolithic program into a set of features. The methodology is supported by a tool that uses the AHEAD feature-oriented programming system to modularize features. Despite using another separation of concern technology, the authors also observed that transformations are needed when the code of two or more features is tangled in the same method. Anbalagan and Xie have proposed an automated approach for mining aspects and inferring pointcuts from legacy Java applications [1] . When the identified crosscutting concern is in the middle of a method, the tool that automates their approach relies on the statements before and after the concern to automatically infer a pointcut expression. However, as observed by the authors, it is possible that the statement before and after the concern may be repeated more than once in the method body or that such statements can not be captured by the pointcut language of AspectJ. In such situations, the tool fails to infer the pointcuts since it does not include support to OO transformations. Concluding, the three mentioned tools reinforce the argument of Section 3 that although critical to the success of aspect extraction OO transformations can not be fully automated.. Aspect-oriented refactoring catalogs: Monteiro and Fernandes have described a set of refactorings for extracting crosscutting concerns, restructuring the internals of aspects and dealing with inheritance hierarchies of aspects [23, 24, 25] . Another well-known catalog of aspect-oriented refactorings was proposed by Laddad [21] . Hannemann, Murphy and Kiczales describe a role-based approach for aspect-oriented refactoring, where developers should map abstract roles to concrete program elements. Cole and Borba describe a set of aspect-oriented programming laws that are useful for deriving refactorings for AspectJ [8] . They recognize that the presented laws require subtle preconditions whose definition was the most challenging task of their research. As described in Section 1, neither of the previous catalogs are accompanied by an in-depth investigation about OO transformations.. Refactoring experiences: Colyer and Clement have described an experience on using AspectJ to refactor both homogeneous and heterogeneous concerns in a industrial middleware productline platform [9] . Still in the middleware domain, Zhang and Jacobsen have reported the use of AspectJ to modularize crosscutting concerns from a CORBA-based middleware [33] . Surprisingly, both works do not mention the need of OO transformations. More recently, Castor and colleagues have conducted a study about the aspectization of exception handling code [12] . Particularly, they report the difficulty in the modularization of try-catch blocks when they are tangled in the middle of methods (which demands the use of Transformation 21 described in this paper) and when the exception handler needs to access local variables from the base code (which demands the use of Transformation 24). Yuen and Robilliard suggest the existence of an important gap between aspect mining and aspect refactoring tools due to subtle variations in the implementation of crosscutting concerns in legacy systems [32] . For example, they observed that transaction management does not present a consistent behavior in the system used as case study in their research, which suggest the need of statement reorderings and possibly ad hoc transformations (as was the case of transaction handling in JAccounting described in Sections 2 and 3).

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O O B O O O B O O O O O O O O O O B I O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


An Architecture for Generic Extensions We examine what is necessary to allow generic libraries to be used naturally in a multi-language, potentially distributed environment. Language-neutral library interfaces usually do not support the full range of programming idioms that are available when a library is used natively. We investigate how to structure the language bindings of the neutral interface to achieve a better expressibility and code reuse. We furthermore address how language-neutral interfaces can be extended with import bindings to recover the desired programming idioms. We also address the question of how these extensions can be organized to minimize the performance overhead that arises from using objects in manners not anticipated by the original library designers. Our approach is to treat a library as a software component and to view the problem as one of component extension. We use C++ as an example of a mature language, with libraries using a variety of patterns, and use the Standard Template Library as an example of a complex library for which efficiency is important. By viewing the library extension problem as one of component organization, we enhance software composibility, hierarchy maintenance and architecture independence. Library extension is an important problem in software design. In its simplest form, the designer of a class library must consider how to organize its class hierarchy so that there are base classes that library clients may usefully specialize. More interesting questions arise when the designers of a library wish to provide support for extension along multiple, independent dimensions of the library's behavior. In this situation, there are questions of how the extended library's hierarchy relates to the original library's hierarchy, how objects from independent extensions may be used and how the extensions interact.. This paper examines the question of library extension in a heterogeneous environment. We consider the situation where software libraries are made available as components in a multi-language, potentially distributed environment. In this setting, the programmer finds it difficult and rather unsafe to compose libraries based on low level language-interoperability solutions, such as jni or "extern C" with remote procedure calls. Therefore, components are usually constructed and accessed through some framework such as corba [17] , dcom [9] or the .net framework [8] . In each case, the framework provides a language-neutral interface to a constructed component. These interfaces are typically simplified versions of the implementation language interface to the same modules because of restrictions imposed by the component framework. Restrictions are inevitable: Each framework supports some set of common features provided by the target languages at the time the framework was defined. However, programming languages and our understanding of software architecture evolves over time, so mature component frameworks will lack support for newer language features and programming styles that have become commonplace in the interim. If a library's interface is significantly diminished by exporting it through some component architecture, then it may not be used in all of the usual ways that those experienced with the library would expect. Programmers will have to learn a new interface and, in effect, learn to program with a new library.. We have previously described the Generic Interface Definition Language framework, gidl [11] , a corba idl extension with support for parametric polymorphism and (operator) overloading, which allows interoperability of generic libraries in a multi-language environment. gidl is designed to be a generic component architecture extension. Here "generic" has two meanings: First gidl encapsulates a common model for parametric polymorphism that accommodates a wide spectrum of requirements for specific semantics and binding times of the supported languages: C++, Java, and Aldor [22] . Second, the gidl framework can be easily adapted to work on top of various idl-based component systems in use today such as corba, dcom, jni [20] . This paper explores the question of how to structure the gidl C++ language bindings to achieve two high-level goals: The first goal is to design the extension framework as a component that can easily be plugged-in on top of different underlying architectures, and together with other extensions. The second goal is to enable the gidl software components to reproduce as much of their original native language interfaces as possible, and to do so without introducing significant overhead. This allows programmers familiar with the library to use it as designed. In these contexts, we identify the language mechanisms and programming techniques that foster a better code structure in terms of interface clarity, type safety, ease of use, and performance.. While our earlier work [11] presented the high-level ideas employed in implementing the gidl extension mechanism, this paper takes a different perspective, in some way similar to that of Odersky and Zenger [14] . They argue that one reason for inadequate advancement in the area of component systems is the fact that mainstream languages lack the ability to abstract over the required services. They identify three language abstractions, namely "selftype annotations, abstract type members, and traits" that enable the design of firstclass value components (components that use neither static data nor hard references to the required modules).. We look at the gidl extension as a component that can be employed on top of other underlying architectures and which can be, in turn, further extended. Consequently, we identify the following as desirable properties of the extension:. • The extension interface should be type-precise and it should allow reasoning about the type safety of the extension. The type-safety result for the whole framework would thus be derived from the ones of the extensions and of the underlying architecture.. • The extension should be split into first-class value components. In the gidl case for example, one component should encapsulate the underlying architecture (ua) specifics and be statically generated. The other one should generically implement the extension mechanism. This would allow gidl to be plugged in with various uas without modifying the compiler.. • The extension should preserve the look and feel of the underlying architecture, or at least not complicate its use.. • The extension overhead should be within reasonable limits, and there should be good indication that compiler techniques may further diminish it.. We have found that the curiously recurring template pattern [2] (crtp), member types 2 [3, 5] , and C++ simulated Scala-traits enable a better code structure in the sense described above. This is in agreement with observations of Odersky and Zenger [14] . We also note that at a very high-level this combination of techniques resembles an object-oriented encoding of the generalized algebraic data types [23] .. The second part of this paper reports on an experiment where we have used gidl to export part of the C++ Standard Template Library (stl) [10, 19] functionality to a multi-language, distributed use. In this, we had two objectives.. The first objective was to determine to what degree the interface translation could preserve the "look and feel" of the original library. Ideally, the stl and its gidl-exported programs should differ only in the types used. This allows the stl programmers to easily learn to use the gidl interface to write for example distributed applications. More importantly, this opens the door to a richer composition between gidl and stl objects. For example some gidl iterators are themselves valid stl iterators and thus they can be manipulated by the stl containers and algorithms. In this context we investigate the issues that prevent the translation from conforming with the library semantics, the techniques to amend them, and the trade-offs between translation ease-of-use and performance.. The second objective was to determine whether the interface translation could avoid introducing excessive overhead. We show how this can be achieved through the use of various helper classes that allow the usual stl idioms to be used, while avoiding unnecessary copying of aggregate objects. We show empirical arguments to support our intuition that the gidl extension design introduces very little overhead, if any.. The rest of the paper is organized as follows. Section 2 surveys the main programming techniques used in our implementation, and gives a high-level review of the gidl framework. Section 3 presents at a high-level the rationale of our design and the technique we used to implement our extension framework, and outlines the issues to be addressed when translating the stl library to a heterogeneous environment. Section 4 describes the design of the gidl bindings for the C++ language. Section 5 describes the "black-box" type translation of the stl library to a multi-language, distributed environment via gidl and discusses certain usability/efficiency trade-offs. Finally Section 6 presents some concluding remarks. We have examined a number of issues in the extension of generic libraries in heterogeneous environments. We have found certain programming language concepts and techniques to be particularly useful in extending libraries in this context: the crtp idiom, member/associative types and Scala-like traits. Generic libraries that are exported through a language-neutral interface may no longer support all of their usual programming patterns. We have shown how particular language bindings can be extended to allow efficient, natural use of complex generic libraries. We have chosen the stl library as an example because it is atypically complex, with several orthogonal aspects that a successful component architecture must deal with. The techniques we have used are not specific to the stl library, and therefore may be adapted to other generic libraries. This is a first step in automating the export of generic libraries to a multi-language setting. We begin with a brief survey of the programming techniques we have used in our cross-platform mappings, and illustrate their use through specific examples. We then give an overview of the gidl framework and the semantics of its model for parametric polymorphism. A more detailed account of may be found elsewhere [11] .

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


REVISITING THE THERMODYNAMICS OF HARDENING PLASTICITY FOR UNSATURATED SOILS ABSTRACT: A thermodynamically consistent extension of the constitutive equations of saturated soils to unsaturated conditions is often worked out through the use of a unique 'effective' interstitial pressure, accounting equivalently for the pressures of the saturating fluids acting separately on the internal solid walls of the pore network. The natural candidate for this effective interstitial pressure is the space averaged interstitial pressure. In contrast experimental observations have revealed that, at least, a pair of stress state variables was needed for a suitable framework to describe stress-strain-strength behaviour of unsaturated soils. The thermodynamics analysis presented here shows that the most general approach to the behaviour of unsaturated soils actually requires three stress state variables: the suction, which is required to describe the invasion of the soil by the liquid water phase through the retention curve; two effective stresses, which are required to describe the soil deformation at water saturation held constant. However a simple assumption related to the plastic flow rule leads to the final need of only a Bishop-like effective stress to formulate the stress-strain constitutive equation describing the soil deformation, while the retention properties still involve the suction and possibly the deformation. Commonly accepted models for unsaturated soils, that is the Barcelona Basic Model and any approach based on the use of an effective averaged interstitial pressure, appear as special extreme cases of the thermodynamic formulation proposed here.KEYWORDS: constitutive relations; partial saturation; plasticity; pore pressures; suction; theoretical analysis.One of the early applications of the mathematical theory of plasticity to soil mechanics goes back to the pioneering work of Roscoe and his co-workers on the general concept of critical state (Roscoe et al., 1958; Roscoe et al., 1963) , which, for saturated soils, ultimately resulted in the elaboration of the celebrated Cam-Clay model involving Terzaghi's effective stress. An extension of the Cam-Clay model to unsaturated conditions has been further proposed by Alonso et al. (1990) . Within a simple elastoplastic formalism this extension has pointed out the need of two stress state variables instead of a unique effective stress in order to account for experimental observations on the mechanical behaviour of unsaturated soils. As a consequence, this model has launched the bases of many models further developed for unsaturated soils and addressing additional aspects, such as the effects of the Lode angle (Sun et al., 2000) , of water content (Wheeler, 1996; Vaunat et al., 2000) , of anisotropy (Cui & Delage, 1996; Ghorbel & Leroueil, 2006) and of the degree of saturation (Jommi et al., 1994; Bolzon et al., 1996; Dangla et al., 1997; Lewis and Schrefler, 1998; Gallipoli et al., 2003; Sheng et al., 2004; Pereira et al., 2005; Sun et al., 2007; Wheeler et al., 2003) . In turn advances performed on the last point have reintroduced a strong debate about the possible relevancy of the effective stress concept to capture the mechanical behaviour of unsaturated soils, an issue dated back to the 1960s. One of the early applications of the mathematical theory of plasticity to soil mechanics goes back to the pioneering work of Roscoe and his co-workers on the general concept of critical state (Roscoe et al., 1958; Roscoe et al., 1963) , which, for saturated soils, ultimately resulted in the elaboration of the celebrated Cam-Clay model involving Terzaghi's effective stress. An extension of the Cam-Clay model to unsaturated conditions has been further proposed by Alonso et al. (1990) . Within a simple elastoplastic formalism this extension has pointed out the need of two stress state variables instead of a unique effective stress in order to account for experimental observations on the mechanical behaviour of unsaturated soils. As a consequence, this model has launched the bases of many models further developed for unsaturated soils and addressing additional aspects, such as the effects of the Lode angle (Sun et al., 2000) , of water content (Wheeler, 1996; Vaunat et al., 2000) , of anisotropy (Cui & Delage, 1996; Ghorbel & Leroueil, 2006) and of the degree of saturation (Jommi et al., 1994; Bolzon et al., 1996; Dangla et al., 1997; Lewis and Schrefler, 1998; Gallipoli et al., 2003; Sheng et al., 2004; Pereira et al., 2005; Sun et al., 2007; Wheeler et al., 2003) . In turn advances performed on the last point have reintroduced a strong debate about the possible relevancy of the effective stress concept to capture the mechanical behaviour of unsaturated soils, an issue dated back to the 1960s.. Please cite this article as: Coussy O, Pereira J. M., Revisiting the thermodynamics of hardening plasticity for unsaturated soils. Computers and Geotechnics, 37:207-215, doi:10.1016/j.compgeo.2009.09.003 The concept of effective stress for unsaturated soils takes its roots in the work by Bishop (1959) that extended the concept of Terzaghi's effective stress by replacing the water pressure by the weighted average of air and water pressures according to: (u a -u w )] δ ij where σ ij B and σ ij are the Bishop's and total stress tensors, respectively, while u a is the air pressure, u w the water pressure and χ a weighting parameter. The dependence of this weighting parameter χ upon the degree of saturation of water S r has been stated in the early work of Bishop and co-workers (Bishop, 1959; Bishop & Blight, 1963) . Historically, no definitive statement about how this parameter depends on S r has been made for more than 20 years after Bishop's proposal. Lewis & Schrefler (1982) followed by Bear et al. (1984) , cited by Bear & Bachmat (1990) , used the natural candidate χ (S r ) = S r as a special case for the weighting factor (deduced from volume average of the pressures of the fluids saturating the porous space). Some other proposals have been made. For instance, Khalili & Khabbaz (1998) identified χ as a function of the suction from experiments performed on the shear strength of a large set of soils. This work has been used later on by Loret & Khalili (2002) .. Even though the choice of χ (S r ) = S r is natural and largely used, the status of the weighting function χ, as well as the choice of its relevant argument, remain unclear. The formulation of the constitutive equations of saturated soils using Terzaghi's effective stress relies on the incompressibility of the solid grains. Hereafter, this grain incompressibility being a starting point, it will be shown how thermodynamics can bring answers to the question of using an effective stress regarding the constitutive equations of unsaturated soils. It will be in particular revealed that significant assumptions related to the flow rule are actually needed to validate the natural choice χ (S r ) = S r .. Another attractive approach to explore the concept of effective stress for unsaturated porous media is provided by averaging methods. For elastic porous solids, using homogenization techniques, Chateau & Dormieux (2002) have shown the relevancy of adoption χ (S r ) = S r if the strain localization tensor is the same for all pores, which turns out to assume the isodeformation of all pores. Without having recourse to these sophisticated methods, the consequences of this iso-deformation assumption will be revisited in this paper in the context of plasticity directly at the macroscopic scale. An alternative to homogenization procedures is the so-called hybrid-mixture theory. The latter establishes balance equations at the microscopic scale and performs a change of scale through averaging techniques (Hassanizadeh & Gray, 1980; Murad et al., 1995; Lewis & Schrefler, 1998) . Such averaging methods offer the advantage to provide a direct interpretation of the macroscopic variables in terms of their microscopic counterparts. Particularly, if volume average is considered, an equivalent interstitial pressure equal to the product of the degree of saturation by suction comes out from the analysis. However the constitutive laws are then usually developed at the averaged scale from considerations based upon the entropy inequality which, as an inequality, cannot offer a definitive answer. Recently, Gray & Schrefler (2007) have replaced in a thermodynamic context the use of Bishop's stress in its original form in identifying the parameter χ to the fraction of the solid phase surface area in contact with the wetting phase. The actual question is to determine whenever the choice χ (S r ) = S r is relevant. As recalled above micromechanics shows that the choice is relevant providing all of the pores undergo the same dilation whenever the same pressures apply to their solid walls. For elasticity and plasticity, restricting to macromechanics this paper will explore as far this choice is relevant. Regarding observations, the experimental evidence of the concept of an effective stress for unsaturated soils has often been questioned. One among the most employed arguments on the Please cite this article as: Coussy O, Pereira J. M., Revisiting the thermodynamics of hardening plasticity for unsaturated soils. Computers and Geotechnics, 37:207-215, doi:10.1016/j.compgeo.2009.09.003 limitations of this concept is that it cannot account for the collapse occurring along wetting paths under constant stress (e.g. Jennings & Burland, 1962; Matyas & Radakrishna, 1968) . This well-known phenomenon is characterised by plastic compression, possibly preceded by elastic swelling during the soaking of an unsaturated soil sample under constant stress. This recurrent criticism to the various expressions of the effective stress appearing from time to time in the literature lies on the fact that such a stress cannot reproduce alone the response of the material and, thus, departs from the historical definition given by Terzaghi (1936) : "All the measurable effects of a change of stress, such as compression, distortion and a change in the shearing resistance are exclusively due to changes in effective stress… every investigation of the stability of a saturated body of earth requires the knowledge of both the total and the neutral stresses". However, as indicated by Jommi (2000) , such a condition has been never met, even for saturated materials. Gens (1995) referred to the more adequate definition that any change in total stress and neutral pressures that causes the same change in effective stress traduces into the same response of the material. In most of all the mentioned previous approaches, the key variable controlling the behaviour of unsaturated soils is the suction. Its variations directly control the fluid invasion process through the water retention curve, which is eventually associated with the surface energy balance. The suction variations also control indirectly the mechanical behaviour through the variation of the strength and of the locked energy they induce. In the familiar capillary case, although the suction can be defined as the difference between the pressures of the non-wetting and wetting phases, the various roles of the pressure difference must be well separated from that of the suction. For instance, in the case of non-connected fluid phases occupying always the same part of the porous volume, there is no invasion process by a non-wetting fluid so that the suction has no meaning, whereas the difference between the pressures of the fluids still governs the deformation of the material, with an appropriate choice of the stress variables. In the case of connected phases, this specific mechanical role of the pressures difference still remains, irrespective of that of suction previously defined which, in turn, will also affect the mechanical behaviour, as for instance the strength. A parallel can be made here between the role played by the suction upon the mechanical behaviour and the analogous role of chemical effects appearing in some reactive porous media (Coussy & Ulm, 1996) . Indeed, chemomechanical couplings can induce variations of strength due to the chemical reactions taking place within the material, resulting in a chemical hardening similar to the capillary hardening we just evoked. Same comments apply to the influence of chemical reactions, similar to that of suction variations, upon the hardening locked energy. At the light of these various roles played by the pressure difference, in this paper we will revisit most of the points previously described in the modelling of unsaturated soils behaviour within an elastoplastic framework. Controlling variables are first looked for by analyzing the strain work related to unsaturated materials. By means of the analysis of the strain work, a special care is devoted to the identification of the different physical processes governing the deformation and the pore invasion by fluids. The concept of effective stress is then derived through adequate dependencies in thermodynamics potentials. Finally, an illustration of the framework is presented, where the Barcelona Basic Model (BBM) for unsaturated soils is analysed and found to be thermodynamically consistent. It comes out from this analysis that any approach based on the use of an averaged interstitial pressure are eventually two special cases of a more general thermodynamic approach recently proposed (Coussy, 2007) for the formulation of the constitutive equations of unsaturated soils. An unsaturated soil is constituted of a solid skeleton formed of particles in contact, through interfaces having their own energy, with a gas phase and a liquid phase. The thermodynamics of this solid skeleton can be addressed by considering successively three systems. The first system is the soil itself, as just depicted. This is an open system exchanging gas and liquid mass with the surroundings. The second system is obtained by removing from the soil system the bulk gas and liquid phases, whose thermodynamics is separately known. Since this system does not include any more the fluid phases, this system is formed of only the solid particles and the interfaces. That the bulk fluid phases have been removed does not mean that the system is no more subjected to the pore pressures. This system is actually a closed system which is loaded by the total external stress and the pore pressures still exerting through the interfaces on the system. In the following this system is called the apparent solid skeleton. Indeed, this is an apparent solid skeleton since the interfaces have their own energy. As a result they have also to be removed to define the actual solid skeleton whose constitutive equations are those we are looking for. We call it the solid skeleton in the following. In short three systems are considered: the soil (solid skeleton + interfaces + bulk fluid phases), the apparent solid skeleton (solid skeleton + interfaces), and finally the solid skeleton. In this paper, the rate equations of elastoplasticity for saturated soils have been extended to unsaturated conditions using a framework that preserved the basic laws of thermodynamics. Advance in the construction of the framework relies on the setting of several key results: − The energy balance of the apparent solid skeleton can be split into one part due only to deformation and another part due only to pore invasion by the saturating fluids by considering as controlling variables the Lagrangian porosity (current volume of pores divided by the initial volume of porous material) and Lagrangian degree of saturation (volume, in the initial configuration, of the pores that are currently filled by water divided by the initial volume of pores). − From the expression of the strain work, three stress variables (total stress, air pressure and water pressure) can be shown a priori to control the process of deformation, whereas the process of invasion is found to be controlled by the difference between air pressure and water pressure. − The number of stress-dimension controlling variables can be reduced by assuming constraints on internal deformation. The net stress and Terzaghi's effective stress emerge as two work-conjugate variables if solid incompressibility is assumed. If pore iso-deformation is moreover assumed, the Bishop's stress (with factor χ identified to the Lagrangian degree of saturation, S r ) is recovered as a unique effective stress thermodynamically conjugated to the soil deformation. This last restriction can finally be relaxed by keeping χ as a smooth function of S r in the expression of Bishop's stress. This function is specific to the material under concern and relies in particular assumptions upon its microstructure. − Elastoplastic frameworks developed for saturated soils can be extended to unsaturated conditions by setting an additional dependency of the free energy on the degree of saturation, only. In order to cope with hardening laws typical of soils in a well-posed thermodynamic framework, the free energy is split into three parts: 1) the recoverable elastic energy stored in the solid skeleton; 2) the additional locked energy stored in the solid skeleton during an irreversible mechanical process; 3) the fluid-solid interface energy. Use of Clausius-Duhem inequality allows for an unsaturated formulation where the extended Bishop's stress is the counterpart of Terzaghi's stress in the saturated formulation, even if suction (or degree of saturation) still appears in the arguments of the hardening parameter or in the definition of the water retention properties of the material. A simple illustration of the framework is finally provided by recovering the equations of the Barcelona Basic Model. As the net stress is a limit case of the extended Bishop's stress, such a formulation allows for proving the thermodynamic consistency of the basic model as well as all the models that can be derived from it by taking a smooth function of S r as proposed in this paper. It is believed that such a framework provides the basis for further extension of more achieved models to unsaturated conditions. APPENDIX The water retention curve may present hysteresis effects leading to dissipation during dryingwetting cycles. In order to address these effects, let us start from Eq. The first term in brackets is the dissipation related to the solid skeleton and has been addressed in the present paper. The second term in brackets is the dissipation related to capillary hysteresis. It requires a separate treatment which is illustrated in Fig. 4 and has been addressed in Coussy (2004) .

O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I B I B B I B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Comparing Constraint-Based Motion Editing Methods Tools for assisting with editing human motion have become one of the most active research areas in the field of computer animation. Not surprisingly, the area has demonstrated some stunning successes in both research and practice. This paper explores the range of constraint-based techniques used to alter motions while preserving specific spatial features. We examine a variety of methods, defining a taxonomy of these methods that is categorized by the mechanism employed to enforce temporal constraints. We pay particular attention to a less explored category of techniques that we term per-frame inverse kinematics plus filtering, and we show how these methods may provide an easier to implement while retaining the benefits of other approaches. The proliferation of different techniques for creating motion for computer animation, coupled with the needs to best utilize these artistic assets, has made motion editing a rapidly developing area of research and development. The past few years have witnessed an explosion of new techniques for various motion editing tasks, as well as the deployment of commercial tools. Unfortunately, while each new technique almost always provides impressive new results, there has been little done to examine the differences between and capabilities of various approaches. In this paper, we explore the relationships between a number of state-of-the-art motion editing methods. Specifically, we provide a unifying view of several constraint-based techniques. These methods provide explicit support for maintaining specific geometric features of motions. Our goal is to examine the range of techniques for insights-comparing and contrasting the methods to understand the problems for which each is appropriate, and to give us insights as to unexplored regions of the design space.. Our discussion is organized as follows. We begin by defining our terms and laying a groundwork to introduce motion editing methods. We then present a taxonomy of recent approaches, describing each within a common set of terminology to aid in comparison. Section 4 focuses on a particularly unexplored category of approach, showing how a simpler variant of an existing technique can provide useful results. We have implemented the PFIK+F approach within our Timelines animation testbed. Our spacetime constraints solver, described in [13] , is applied to each frame individually to serve as the IK solution. By implementing this approach in our existing framework we are able to apply it to the same problems that we have been exploring with other approaches.. We have applied our PFIK+F solver to a range of problems, including retargeting motions to new characters, constraint editing, and path editing. In the first and last type of problem, a change is made across the entire motion and a new solution is found to existing constraints. In a constraint editing problem, the constraints are manipulated interactively by the user.. When our spacetime solver is applied in batch mode, its performance is slower than when used interactively. This is because we make additional performance concessions (as described in [12] ) for interactivity. More significantly, in batch mode, we lose "differentialness" [11] . That is, during dragging there are only small changes made between each solution. Therefore, the previous solution is a good starting point in the search for the next. Interestingly, our PFIK+F solver does not gain major advantage from differentialness. While a good starting point might make each individual IK solution slightly faster, 4 the total number of iterations is the same.. We discuss a few representative experiments chosen to highlight some of the differences in the results of the two solvers. Timings reported in this section are run on a Dell Precision 610 workstation with a 550 Mhz Pentium III Xeon Processor and 512 M of RAM.

O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


CHARACTERISTIC OF MUTUALLY COUPLED TWO-LAYER CNN AND ITS STABILITY This paper presents some interesting image processing applications with the mutually coupled two-layer Cellular Neural Networks (CNNs). We found that the two-layer CNNs are very useful compared to single layer CNNs in some applications such as center point detection, skeletonization, and so on. We also focus our discussions on both their transients and operations. In addition, the stability of the two-layer CNNs with mutually coupled symmetric templates is also discussed based on those of decoupling CNN technique. Since the Cellular Neural Networks (CNNs) model was invented, 1 due to the desirable feature such that their cells are analog process units computing in real time and arranged in two or more dimensional grid points with the same local coupling manner, the CNNs have been rapidly developed as various high-speed parallel signal-processing platforms. They have been successfully used for image processing 2-10 and as a model of physical phenomena. In this paper, we have presented mutually coupled two-layer cellular neural networks, and discussed the applications and stability. Although the two examples of center point detection and skeletonization can be solved by single layer CNN, the applications of the proposed new method in this paper to these problems is very efficient compared to those in other CNNs. Moreover, we have also found a special example of the mutually coupled two-layer CNN -dividing object into halves which cannot be solved by the single layer CNNs. Through our simulation examples, the two-layer CNNs show a real potential of the structure. We have also analyzed the stability for the two-layer CNNs with mutually coupled symmetric templates, and obtained the necessary conditions using decoupling technique.

O O O O B I O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I B O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O B I I O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O


Augmenting human memory using personal lifelogs Memory is a key human facility to support life activities, including social interactions, life management and problem solving. Unfortunately, our memory is not perfect. Normal individuals will have occasional memory problems which can be frustrating, while those with memory impairments can often experience a greatly reduced quality of life. Augmenting memory has the potential to make normal individuals more effective, and those with significant memory problems to have a higher general quality of life. Current technologies are now making it possible to automatically capture and store daily life experiences over an extended period, potentially even over a lifetime. This type of data collection, often referred to as a personal life log (PLL), can include data such as continuously captured pictures or videos from a first person perspective, scanned copies of archival material such as books, electronic documents read or created, and emails and SMS messages sent and received, along with context data of time of capture and access and location via GPS sensors. PLLs offer the potential for memory augmentation. Existing work on PLLs has focused on the technologies of data capture and retrieval, but little work has been done to explore how these captured data and retrieval techniques can be applied to actual use by normal people in supporting their memory. In this paper, we explore the needs for augmenting human memory from normal people based on the psychology literature on mechanisms about memory problems, and discuss the possible functions that PLLs can provide to support these memory augmentation needs. Based on this, we also suggest guidelines for data for capture, retrieval needs and computer-based interface design. Finally we introduce our work-in-process prototype PLL search system in the iCLIPS project to give an example of augmenting human memory with PLLs and computer based interfaces. Memory is a key human facility inextricably integrated in our ability to function as humans. Our functioning as humans is dependent to a very significant extent on our ability to recall information relevant to our current context, be it a casual chat with a friend, remembering where you put something, the time of the next train or some complex theory you need to solve a problem in the laboratory. Our effectiveness at performing many tasks relies on our efficiency and accuracy in reliably recalling the relevant information. Unfortunately humans are frequently unable to reliably recall the correct information when needed. People with significant memory problems (e.g. amnesic patients) usually face considerable difficulty in functioning as happy integrated members of society. Other people, although having much less noticeable memory problems compared with the amnesic patients, may also experience some degree of difficulties in learning and retrieving information from their memory for various reasons. In this paper, we use the phrase normal people to refer to individuals with normal memory and normal lifestyles, as opposed to amnesic or mentally impaired patients. The desirability of a reliable and effective memory means that augmenting memory is a potentially valuable technology for many classes of people.. Normal individuals might use a memory augmentation tool to look up partially remembered details from events from their life in many private, social or work situations. The augmented memory application itself might proactively monitor their context and bring to their attention information from their previous life experiences which may be of assistance or interest to their current situation. Details from these experiences could be integrated into personal narratives for use either in self reflection or to enable experiences to be shared with friends [1] . Sufficiently powerful augmented memories could not just support their users, but actually extend the user's capabilities to enable them to perform new tasks or existing tasks more efficiently or faster.. In order to provide augmented memory applications however we need some means to capture, store and then access personal information from a person's life experiences to form an augmented memory. The emerging area of digital life logging is beginning to provide the technologies needed to support these applications. Personal lifelogs (PLLs) aim to digitally record and store many features of an individual's life experiences. These can include details of visual and audio experiences, documents created or read, the user's location, etc. While lifelog technologies fall short of genuinely mimicking the complexities and processes of human memory, they are already offering the promise of life enhancing human augmentation, especially for episodic memory impaired patients, that is people who have problems remembering their daily experiences [2] .. Existing studies in lifelogs have concentrated primarily on the physical capture and storage of data. One of the major activities in this area which has explored this topic in detail relates to Gordon Bell's experiences of digitizing his life described in [3] . Bell explores the topic of "e-memories" and "Total Recall" technologies related through this own experiences of digitizing his life. While his work provides significant insights into the potential and issues or digital memories, it focuses very much on the technologies of capture and storage, and potential applications. Our work in the iCLIPS project in the Centre for Digital Video Processing (CDVP) at Dublin City University 1 is exploring capture and search of personal information archives looking not just at data capture, but also the development of effective content indexing and search, and importantly in relation to this paper, that we are looking at the processes of human memory, the form and impact of memory failures and how these might be overcome using search of PLLs. In our work, we are concentrating on memory failures typically encountered by normal people, and using these to guide the development of a prototype interface to access a PLL as an augmented memory.. The remainder of this paper is organised as follows. In section 2 we examine PLLs and related works on digital memory aid tools in a little more detail, Section 3 then looks at theoretical models of memory from the psychology literature, reviews some existing empirical studies regarding normal people's memory problems and memory supports needs in their daily life, and discuss the possible function that PLLs may be able to provide for augmenting human memory In section 4 we postulate the guidelines for developing PLLs systems to augment human memory, giving suggestions on computer based interface designing, types of data to be capture, and retrieval techniques required. And finally section 5 we introduce the iCLIPS project and our prototype application. While all of the above studies successfully discovered some daily memory problems, the non-monitored self-reporting approach is limited in that the people can only report their needs for memory support when they are aware of a difficulty in retrieving a memory. While it is true that people may only seek help for specific parts of their memory when they realize that they have problem in recollecting these pieces of information from their memory, they are not always very clear as to what they actually want to retrieve until they bring back the piece of memory. For example, sometimes people just want to review (mentally) some past episodes for fun or because of nostalgia. They usually look at some photos or objects which are related to past events, and which bring them more vivid memories of past experiences. Due to the richness of data, lifelogs can provide more details about the past than any physical mementos can do.. In short, lifelogs are a good resource for supporting retrospective memory problems, including those we have gradually forgotten, distorted, or we missed while encoding. Consolidating memory of useful information cam also can also be used to provide digital copies of episodes (e.g. when we need to give a video record of a meeting to some one who failed to attend), or provide memory cues to trigger a person's organic memory about the original information, experiences, emotion, or even thoughts. Lifelogs might also be able to improve a subject's memory capability by training them to elaborate or associate pieces of information.. Indeed, supporting people's memory is not only a matter of finding the missing or mistaken parts of memory for them but also improving their long term memory capabilities. It has been argued that the better memory is often related to the ability to associate things, and make decisions of which information to retrieve. For example, older people usually have less elaborated memory [20] .. In the study by [21] , psychologists found a tendency for people with highly elaborated daily schemas to recall more activities from last week better than people with poorly elaborated schemas. Therefore, memory-supporting tools may be able to assist people to associate things in order to elaborate and consolidate their memories, and which can facilitate retrieval by strengthening the links between memories and the cues that life logs systems can provide, and potentially enhancing their efficiency at performing various tasks. There have been a number of studies on developing memorysupporting applications. But most of current research claiming to use PLL data in supporting human memory is limited to presenting streams of captured episodes (e.g. video or audio records of certain episode) to the user, to have them "reexperience" the past, to look up required information or "reencode" information encountered during that period and consolidate memory of it (e.g. [2, 5, 6] ). While these applications appear to have promising results in clinical psychology studies with severe amnesic patients, that is, people who suffer from serious memory disorders (e.g. [2] ), such applications may not be equally useful for people who have normal memory abilities. For example, in the study of [2] , the subject (patient) can hardly recall anything that happened to her even after one day's delay. Therefore, a simple review and consolidation of past events can be very helpful for them to maintain necessary episodic memory. A patient's lifestyle can be very different from that of normal working people, in that they have enough time to review their experiences day by day. Therefore the "rehearsal" type memory aid (e.g. [5, 6] ) is less likely to be favoured by normal people, unless it contains some important information which is difficult to remember or if there is some specific information they can't recall. For example, it is not unusual that we need to find an object or a document but don't remember where it is, or we meet someone we saw before but can't recall the person's name. Ubiquitous Memories [7] is a tool designed to automatically retrieve video clips which were captured when an object was previously presented. The developers also argue it to be a tool to help people find physical objects. VAM [8] was designed to automatically retrieve personal information such as the name of a currently encountered person by automatically detecting the face of the person. Audio life logs such as iRemember [9] are usually used to recover information one learned from audio conversations. Forget-Me-Not [10] helps people find documents by searching for actions in which the document is involved. The cues it presents to trigger memories of the target document related action also include other actions in the day which are presented by iconized attributes, including people, location, actions on documents and time stamps, then allow filtering/searching for an action on the document.. Most work in PLL capture to date has focused on short term studies of a few days or a week or two of data. To support research exploring technologies to truly augment human memory it is our belief that much longer term PLLs archives are needed for research. As should be obvious, capturing PLLs using current technologies requires a considerable investment by the subject capturing their own PLL. Software must be monitored and data carefully archived, more demandingly though the batteries on peripheral devices must be charged regularly and important data uploaded to secure reliable storage locations. The iCLIPS project has so far gathered PLLs of 20 months duration from 3 subjects. Our experiences in capturing and archiving this data are described in detail in [11] .

O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


On the Dimension of a Face Exposed by Proper Separation of Convex Polyhedra Abstract Whenever two nonempty convex polyhedra can be properly separated, a separating hyperplane may be chosen to contain a face of either polyhedron. It is demonstrated that, in fact, one or the other of the polyhedra admits such an exposed face having dimension no smaller than approximately half the larger dimension of the two polyhedra. An example shows that the bound on face dimension is optimal, and a linear programming representation of the problem is given. Separation of sets plays a fundamental role in many areas of mathematics. Familiar classical results relate the quality of linear separation of two convex sets in a real vector space to the degree to which the two sets fail to overlap. A typical result along these lines is the following [4, Theorem 11.3

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Deterministic parallelism via liquid effects Shared memory multithreading is a popular approach to parallel programming, but also fiendishly hard to get right. We present Liquid Effects, a type-and-effect system based on refinement types which allows for fine-grained, low-level, shared memory multithreading while statically guaranteeing that a program is deterministic. Liquid Effects records the effect of an expression as a formula in first-order logic, making our type-and-effect system highly expressive. Further, effects like Read and Write are recorded in Liquid Effects as ordinary uninterpreted predicates, leaving the effect system open to extension by the user. By building our system as an extension to an existing dependent refinement type system, our system gains precise value-and branch-sensitive reasoning about effects. Finally, our system exploits the Liquid Types refinement type inference technique to automatically infer refinement types and effects. We have implemented our type-and-effect checking techniques in CSOLVE, a refinement type inference system for C programs. We demonstrate how CSOLVE uses Liquid Effects to prove the determinism of a variety of benchmarks. How do we program multi-core hardware? While many models have been proposed, the model of multiple sequential threads concurrently executing over a single shared memory remains popular due to its efficiency, its universal support in mainstream programming languages and its conceptual simplicity. Unfortunately, shared memory multithreading is fiendishly hard to get right, due to the inherent non-determinism of thread scheduling. Unless the programmer is exceptionally vigilant, concurrent accesses to shared Determinism By Default. One way forward is to make parallel programs "deterministic by default" [2] such that, no matter how threads are scheduled, program behavior remains the same, eliminating unruly heisenbugs and allowing the programmer to reason about their parallel programs as if they were sequential. In recent years, many static and dynamic approaches have been proposed for ensuring determinism in parallel programs. While dynamic approaches allow arbitrary data sharing patterns, they also impose non-trivial run-time overheads and hence are best in situations where there is relatively little sharing [5] . In contrast, while static approaches have nearly no run-time overhead, they have been limited to high-level languages like Haskell [7] and Java [2] and require that shared structures be refactored into specific types or classes for which deterministic compilation strategies exist, thereby restricting the scope of sharing patterns.. Liquid Effects. In this paper, we present Liquid Effects, a typeand-effect system based on refinement type inference which uses recent advances in SMT solvers to provide the best of both worlds: it allows for fine-grained shared memory multithreading in lowlevel languages with program-specific data access patterns, and yet statically guarantees that programs are deterministic.. Any system that meets these goals must satisfy several criteria. First, the system must support precise and expressive effect specifications. To precisely characterize the effect of program statements, it must precisely reason about complex heap access patterns, including patterns not foreseen by the system's designers, and it must be able to reason about relations between program values like loop bounds and array segment sizes. Second, the system must be extensible with user-defined effects to track effects which are domainspecific and thus could not be foreseen by the system's designers. Finally, the system must support effect inference, so that the programmer is not overwhelmed by the burden of providing effect annotations. We start with a high-level overview of our approach. Figures 1 and 2 show two functions, sum1 and sum2 respectively, which add up the elements of an array of size 2 k in-place by dividing the work up into independent sub-computations that can be executed in parallel. At the end of both procedures, the first element of the array contains the final sum. In this section, we demonstrate how our system seamlessly combines path-sensitive reasoning using refinement types, heap effect tracking, and SMT-based reasoning to prove that sum1 and sum2 are deterministic. We limit our discussion to static mechanisms for checking and enforcing determinism, in particular the literature that pertains to reasoning about heap disjointness: type-and-effect systems, semantic determinism checking, and other closely related techniques.. Named Regions. Region-based approaches assign references (or objects) to distinct segments of the heap, which are explicitly named and manipulated by the programmer. This approach was introduced in the context of adding impure computations to a functional language, and developed as a means of controlling the side-effects incurred by segments of code in sequential programs [20, 21] . Effects were also investigated in the context of safe, programmer-controlled memory management [31, 15, 19] . Ideas from this work led to the notion of abstract heap locations [34, 13, 10] and our notion of fold and unfold.. Ownership Types. In the OO setting, regions are closely related to ownership types which use the class hierarchy of the program to separate the heap into disjoint, nested regions [9, 29] . In addition to isolation, ownership types can be used to track effects [8] , and to reason about data races and deadlocks [6, 4, 22] . Such techniques can be used to enforce determinism [30] , but regions and ownership relations are not enough to enforce finegrained separation. Instead, we must precisely track relations between program variables. We are inspired by DPJ [2] , which shows how some sharing patterns can be captured in a dependent region system. However, we show the full expressiveness of refinement type inference and SMT solvers can be brought to bear to enable complex, low-level sharing with static determinism guarantees. Checking Properties of Multithreaded Programs. Several authors have looked into type-and-effect systems for checking other properties of multithreaded programs. For example, [11, 24] show how types can be used to prevent races, [12] describes an effect discipline that encodes Lipton's Reduction method for proving atomicity. Our work focuses on the higher-level semantic property of determinism. Nevertheless, it would be useful to understand how race-freedom and atomicity could be used to establish determinism. Others [27, 3] have looked at proving that different blocks of operations commute. In future work, we could use these to automatically generate effect labels and commutativity constraints. Program Logics and Abstract Interpretation. There is a vast literature on the use of logic (and abstract interpretation) to reason about sets of addresses (i.e., the heap). The literature on logically reasoning about the heap includes the pioneering work in TVLA [35] , separation logic [26] , and the direct encoding of heaps in firstorder logic [17, 18] , or with explicit sets of addresses called dynamic frames [14] . These logics have also been applied to reason about concurrency and parallelism: [25] looks at using separation logic to obtain (deterministic) parallel programs, and [35] uses abstract interpretation to find loop invariants for multithreaded, heapmanipulating Java programs. The above look at analyzing disjointness for linked data structures. The most closely related to our work is [32] , which uses intra-procedural numeric abstract interpretation to determine the set of array indices used by different threads, and then checks disjointness over the domains.. Our work differs in that we show how to consolidate all the above lines of work into a uniform location-based heap abstraction (for separation logic-style disjoint structures) with type refinements that track finer-grained invariants. Unlike [25] , we can verify access patterns that require sophisticated arithmetic reasoning, and unlike [32] we can check separation between disjoint structures, and even indices drawn from compound structures like arrays, lists and so on. Our type system allows "context-sensitive" reasoning about (recursive) procedures. Further, first-order refinements allow us to verify domain-specific sharing patterns via first class effect labels [21] .

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O B I O O B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O