A GRAMMAR BASED METHODOLOGY TO SUPPORT THE ADAPTIVE REUSE OF HISTORIC BUILDINGS: THE CASE STUDY OF THE SOBRADO BUILDING TYPE

The historical center of São Luı́s is host to a diverse historic and urban ensemble, reminiscent of the 18th and 19th centuries. The architectural typology which can be found there illustrates the strong influence drawn from the Portuguese style known as Pombalino, developed during the reconstruction process of Lisbon after the 1755 earthquake. Due to the historical relevance of these buildings which encapsulate this period in time, it is important to preserve and maintain the buildings located in this region. Adaptive reuse projects have an important role to play in preserving architectural ensembles like this. The first part of the adaptive process is to document and understand the original configuration of the building with the aim of maintaining the elements with historical relevance. Therefore, this project proposes the use of a shape grammar approach to analyze floor plans, aiming to further contribute to adaptive reuse projects for ‘Sobrado’ buildings. The process focuses specifically on a case study building and aims to document and identify the specific placement of elements in the floor plan in an effort to provide a deeper understanding of future adaptive reuse.


INTRODUCTION
To preserve and adaptively reuse a historic structure, the asbuilt and as-used geometry (Napolitano et al., 2019a) as well as existing damage conditions  must be properly documented. Currently in the fields of architectural engineering, civil engineering, and architecture, documentation techniques such as laser scanning and photogrammetry are widely applied. In addition, adaptive reuse techniques are coupled with documentation efforts to understand how older structures can meet newer needs. However, since thorough analysis can often be time-consuming and computationally expensive (Napolitano et al., 2019c), during the translation from existing geometry to plans for adaptive reuse, the geometry and boundary conditions for a structure are commonly oversimplified (Napolitano et al., 2019b). This work seeks to illustrate how more accurate geometries derived from point clouds can be used to assist in generating new adaptive reuse designs. This paper focuses on the analysis of an architectural typology prevalent in the historical center of São Luís. This city maintains an important historical center, recognized by UNESCO as World Cultural Heritage in 1997. This ensemble preserves a significant architectural, historical and urban collection, reminiscent of the 18th and 19th centuries, a time of economic prosperity for the state through the exportation of rice and cotton.
During the colonization period, the administrative state of Grão-Pará and Maranhão was governed by Portugal. During its economic expansion, the state of Grão-Pará and Maranhão preserved a strong relationship with Portugal. São Luís was the capital of the state and therefore experienced rapid urban development, presenting a high demand for buildings for both hab- * Corresponding author itational and commercial purposes. Thus, the buildings built during this period presented a strong influence from the emerging style in Lisbon, known as Pombalino (Lopes et al., 2014).
The architectural composition of the historical center of São Luís maintains a large variety of buildings representing the lusobrazilian architecture. Despite the similarities with the Pombalino style, it is an outstanding example of adaptation to the climatic conditions of equatorial South America. Therefore, it is imperative to study the conceptual design of those buildings. This work utilizes shape grammar concepts to document and understand the arrangement of elements in the space distribution. This pro-cess will focus on floor plans analysis.
Shape grammar formalism offers a visual, rule-based framework for interpreting architectural languages for over forty years (Ligler and Economou, 2019). Thus, this work develops a grammar-based methodology that supports the floor plan analysis for a historical dwelling: the Sobrado' building. Subsequently, the rules are computationally implemented within Rhino, using rhinoscript syntax and python. The developed code allows for a user-friendly interface, that potentially can be used as a generative design tool, allowing for multiple solutions for an initial boundary. The final output from this computational tool is a labeled floor plan representing key structural features of the existing building, which can be used during the adaptive reuse process. This will be detailed in the following sections.

LITERATURE REVIEW
In recent years, computational tools have introduced innovative form-finding techniques, revolutionizing architectural design and production. This process can be defined as 'generative design', 'parametric design' or 'algorithmic design' (Agkathidis, 2015). This concept can be integrated to the adaptive reuse process, auto-mating the steps and optimizing the solutions. Various approa-ches have been developed to use representations of architectural examples for artificially tackling architectural design tasks. One of the methods that can be used in this process is Shape Grammar (SG) formalism, which comprises a set of shape rules that can be applied consecutively to modify design representations (Sönmez, 2018).
SG studies can be categorized into two groups: analytical and original variants (Duarte, 2005). Analytical grammars have been developed to describe and analyze historical styles or languages of designs by architects no longer living. Analytical studies are mostly concerned with the analysis and description of building styles or design manners. The rules are tested to demonstrate whether they can generate existing examples and are sometimes used to derive relevant new examples within the same style. Original studies target the development of new design styles and may generate a multitude of potential building redesigns within the same style. This research focuses on using the analytical grammars concept to understand the spatial configuration of the sobrado building type.
Shape Grammars can be used to understand the formal and syntactic information underlying plan layouts for spatial configuration. Previous works showing this idea can be described as follows. In fact, the first grammar developed to explain a corpus of architectural artifacts concerned the space division for the Palladian villas (Stiny and Mitchell, 1978). This groundbreaking study served as a reference for a multitude of studies. More than four decades after the first proposed grammar for the Palladian villas, a study recreated this analysis and proposed a new grammar recreating the subdivision rules for (Benrós et al., 2012). The authors developed a computer-based design tool that can explore and derive subdivision of spaces, comparing with the original Palladian grammar (Figure1) Figure 1. Villa generation: comparison between original and alternative grammar. (Benrós et al., 2012) Another example is the grammar for traditional Turkish Houses (Cagdas, 1996). Those buildings have a certain design language through an interactive and highly visual expert system. From this concept, an algorithm can be developed to generate plan layouts that incorporates the SG for traditional Turkish Houses (Güzelci, 2014). It provides a user-friendly approach, due to the interactive structure of this process. The SG interpreter helps to understand the formal compositions and plan layouts of traditional Turkish houses and can record differents outputs generated by the users.
In addition, SG can be applied in the adaptation of historical dwellings. SG formalism was employed in the development of guide-lines and rehabilitation methodology to a type of dwelling known as 'Rabo-de-bacalhau' (cod-tail), built-in Lisbon between 1945 and 1965. A transformation grammar is proposed, which applies transformation rules that enable modifying the building according to user needs (Eloy and Duarte, 2015). The methodology considered the sustainability requirements and economic feasibility, as well as the incorporation and updating of information communication and automation technology (ICAT). The authors propose a precise sequence of steps to achieve the adaptation process considering variable factors, namely different families and their needs and lifestyles.
Following this concept, SG was used to study spatial syntax of three types of Portuguese dwellings: the 'Pombalinos', 'Gaioleiros', and 'Rabo-de-bacalhau' (Eloy and Guerreiro, 2016). The data constituted of three floor plans for each type of dwelling. The procedure followed the steps: data collecting, graphic analysis through space syntax, and transformation grammar generation process. The graph analysis is conducted using Agraph software, with nodes embedded in convex spaces and connections. Then, the authors made a visibility analysis on Depthmap software. In the graph analysis, it can be calculated the Total Depth, Integration and Control Value. After analyzing the three types of dwellings, the authors develop a transformation grammarbased methodology to rehabilitate to the type 'Rabo-de-bacalhau' dwelling, using four steps. This transformation grammar aims to address the necessity of rehabilitation of housing stock in European cities.
Furthermore, a grammar-based methodology is used to facilitate the conversion of redundant office buildings into housing in Portugal (Guerritore and Duarte, 2019). First, a survey was conducted to verify the most common types of buildings in the urban region of Milan. The study intends to propose a general methodology; thus, a representative model has its floor plan reduced to an abstract schema. The proposed grammar, The Office into Housing Adaptation (OHA) grammar, is organized into two parts: the user inputs and the generated outputs. The generated outputs are divided into three phases, and this work corresponds only to one of these phases, named the Generation phase. The authors propose six levels to the development of the OHA grammar. From these levels, the study focuses on the subdivision of the major floor plan into dwellings. Then, this stage is detailed, and the set of rules is defined. Contextual data is translated into general conditions to facilitate the applicability of the grammar to a general design.

THE 'SOBRADO' BUILDINGS
In the urban landscape of the historic center of São Luís ( Figure  2), the architectural ensemble shows strong traces of influence from the Pombaline's style. This particular building system marked Lisbon's reconstruction after the 1755 earthquake, in the region known as Baixa Pombalina. This style is named after Sebastião José de Carvalho e Melo, the first Marquês de Pombal, responsible for supervising the reconstruction plan. The chosen urban plan envisaged rebuilding the Baixa on the rubble of the old city, but with a new orthogonal layout, designed by the architects Eugênio dos Santos and Carlos Mardel, featuring wide streets, buildings with earthquake-resistant structure, alignment of the facades, installation of sewage and other technical measures to ensure the speed of construction. Figure 2. Buildings in the historical center of São Luís. (Figueiredo et al., 2011) Some historical factors contributed to this Portuguese influence, mainly related to the economic rising period of Grão-Pará a Maranhão State, which had São Luís as capital (Venâncio and Figueiredo, 2008). As part of a plan to improve the state's economic situation, the General Company of Grão-Para e Maranhão (CGGPM) was created in 1755. It provided its members with financing for the acquisition of slave labor and tools for agriculture. In addition to encouraging agricultural production, the Company facilitated exports through ships, placing Maranhão on the international exportation circuit for agricultural products, mainly cotton and rice.   In this context, buildings started to be constructed in São Luís according to the new demand for buildings for both habitation and commercial purpose. São Luís presented an orthogonal mesh, therefore supporting the adaptation of the Pombalino architectural typology , as demonstrated in Figure 3. The import of Pombalino's style occurred during the late 18th century and throughout the 19th century.
Despite the similarities to Lisbon, São Luís is an outstanding example of a Portuguese colonial town adapted to the climatic conditions of equatorial South America.
The Pombaline buildings were designed to include earthquake safety measures and sewerage channeling. Additionally, modular methods of construction were implemented as the prevalence of prefabricated architectural elements, such as woodwork and carpentry (cage and roof structure), ironwork, lintels, and jambs in Lioz stone , was on the rise. Building on those characteristics, the buildings in São Lís were constructed with a similar structural arrangement, and they too benefitted from the use of modular construction. Due to the easy access to São Luís by the sea, most of the construction materials employed in the buildings came from Portugal by ships. Figure 4. Schema representing the architectural set of São Luís, featuring blocks of buildings at varying heights.  The main difference between Pombaline buildings and the constructive system found in São Luís is found in the distribution of volumes within urban blocks. The Pombalino's buildings followed a strict distribution per block, resulting in a uniform volume, usually a five-story distribution. However, in São Luís the buildings showed variation in the number of floors in the same block distribution 4. Thus, considering the volume and composition of the façade elements, the buildings of civil architecture in the historic center of São Luís are classified as: Solares, Sobrados, and Casas Térreas. The majority of buildings are classified as Sobrados, especially in the federal area of protection (de Figueiredo, 2014). The term 'Sobrado' primitively designates the space left or gained due to the suspended floor enabled by the topography level differences (Ghignatti, 2019).
In general, Sobrados have two to three floors and, in some cases, terraces and basements. The facades can be covered with old tiles, mostly from Porto and Lisbon, dating the 18th and 19th centuries. In relation to the implementation in the urban center, these buildings are presented without frontal and lateral indentations, projecting in the form of "L", "C", "O", "U" or in rectangle shape, forming the internal patios, which allow ventilation and lighting of the rear balcony, and indirectly of the alcoves, through the hollow wooden flags.
Structurally, the Baixa Pombalina building has a three-dimensional locking system formed externally by the main walls in stone masonry and internally by the frontal walls. Also known as gaiola pombalina, the Pombaline frontal was constituted by a skeleton of wood, formed by vertical, horizontal, and diagonal pieces, known as Santo André cross (Figueiredo et al., 2011). Using this system, it was possible to build walls lighter and more flexible in the event of an earthquake, unlike traditional stone or brick masonry walls (Mascarenhas, 2005). Although there was no risk of earthquake in São Luís, this construction system is found in many Sobrados in the region ( Figure 5).

METHODOLOGY
The proposed methodology aims to develop a computation tool to assist the adaptive reuse of historical dwellings in the center of São Luís. The general framework can be summarized in Figure 6. The procedure is implemented using Python and visualized on Rhino. The first step is to document and identify the building characteristics, such as the geometry of elements and The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVI-M-1-2021 28th CIPA Symposium "Great Learning & Digital Emotion", 28 August-1 September 2021, Beijing, China  Then, a grammar-based approach is defined to produce a labeled plan to the original building configuration. Presently during this process, the plan is idealized as a grid domain, aiming to facilitate the rehabilitation process, in which each cell grid can be considered as a possible solution for the placement of new elements; discretization of these cells is at the discretion of the size of walls and based upon the accuracy of floor plans used. The initial grid can later be refined during the rehabilitation process.
Subsequently, regulations and user needs must be investigated to identify the adaptive reuse requirements. Based on these requirements, a rehabilitation strategy can be proposed. The second grammar-based approach is defined, consisting of a subdivision schema. In addition, new labeling rules can be included as new elements may be inserted during the rehabilitation process. The subdivision schema can be integrated with optimization techniques to automatically define the placement of new elements on the plan, considering both spatial and structural requirements.

Documentation Process
To capture the geometry of the as-built and as-used building conditions, photogrammetry and/or laser scanning methods can be used to document the structure (Blyth et al., 2019). From the generated point clouds, slices can be taken at different altitudes to create accurate floor plans. Not only does this capture the geometry more accurately than architectural drawings, but it additionally provides useful information about the location of certain architectural elements and regions of damage.
Computer vision techniques could be integrated using point clouds.
The model created using the extracted point clouds could be trained and transformed into data sets. Once the model is trained, it could be used to further understand and infer the floor plan of the specified Sobrado building to detect elements and information on the building. Semantic segmentation can be used to break the interior and exterior portions of the point cloud into discrete architectural regions (windows, doors, walls) as well as novel methods in convolutional neural networks can be used to automatically detect and document damages. Both the specific geometry and the damage conditions are vital information to include in the methodology during the adaptive reuse process and must be taken into consideration in the training process.
At the present stage of this work, only photogrammetry techniques are used to extract information on exterior dimensions. From an aerial view of Google Earth Pro, a video can be generated representing the 3D model of a building. Free editing software can be used to extract frames of the video. These extracted images can be processed using Autodesk ReCap to generate a 3D model. The model can be used to process exterior elements information. Interior elements information is extracted based on the original floor plan sketch. The information on elements is stored in an array. It contains the coordinates and dimensions of each element, type of element, and its state of conservation (damaged or non-damaged).

Generating Labeled Floor Plans
Then, phase two consists of generating the labeled floor plan. A grammar-based approach is considered: defining a labeling system for the floor plan elements (set of rules 1) that characterize the Sobrado typology. The structural system for the Sobrado building is composed of load-bearing masonry walls and Pombaline walls. Identify the type of walls, whether they correspond to structural elements (masonry walls and pombaline walls) or non-structural elements (division elements). These elements are fundamental for adaptive reuse, once the proposed methodology aims to consider the state of damaged or undamaged elements to orientate the redesign process.
Other elements may be relevant for representing the floor plan.
Opening elements (entrance of the building, windows, doors, interior passages, etc) are fundamental identify the circulation areas and the connectivity between spaces. In addition, rooms and circulation areas are fundamental elements when analyzing the use of space on the original building. The correct identification of these elements can contribute to identifying the best solutions for the adaptive reuse project. Therefore, it is important to correctly map all these components.
At the present stage of this research, labels for the main elements are defined, according to Figure 7. These rules produce a labeled plan that identifies: a) type of walls -load-bearing masonry walls (rule 1.1), pombaline walls (rule 1.2) and nonstructural walls (rule 1.3); b) façade elements -the main entrance (rule 1.4) and the façade doors (rule 1.5); c) circulation areas: stairs and corridors (rule 1.6).

Adaptive Reuse Process
The Sobrado buildings located in São Luís are usually converted into mixed-type buildings: public offices on the ground floor and multifamily apartments on the first and second floor (Cardoso, 2012). Therefore, the adaptive reuse process must consider the different use requirements and regulations to define new subdivisions of spaces.
In addition, the state of structural elements can be used to orientate this process, identifying the placement of elements on the plan according to strengthening requirements. Therefore, two main caracteristics can be used while defining the placement of elements: space requirements (quantity of rooms and required areas) and structural performance. Then, target functions can be defined and optimization techniques such as genetic algorithms can be used to determine the new floor plan configuration. At the present state of this project, the first part of this process is defined: a subdivision schema. It allows interpreting the plan as a series of structural and spatial divisions. The placement of interior walls can be achieved essentially considering two rules ( Figure 8). Further expansion of these rules may be required, according to different adaptive reuse requirements.
Those rules consist of subdividing a space into two new spaces (with one internal wall), and into three new spaces (with two internal wall). These rules can be translated into a rule schemata using Equations 1 and 2, corresponding respectively to rule 2.1 and rule 2.2.
x → x/2 (1) x → x/3 The subdivision schema is applied considering the original plan configuration. The new floor plan configuration must maintain the non-damaged existing elements. Future work will take into consideration the spatial and structural requirements to conduct floor plan generation for the adaptive reuse project.

CASE STUDY BUILDING
The authors identified a typical Sobrado located at Rua do Giz 445 9, with a existing adaptive reuse project. The project consists of a mixed-use type of building, with public offices on the ground floor and multi-family apartments on the first and second floors. Before the execution of the restoration project, the state of conservation of this sobrado can be classified as significantly damaged. Figure 9. Case study building façade.
The 3D model was generated accordingly to the procedure described in section 4.1. From an aerial view of the identified Sobrado building in Google Earth Pro, a video of the 3D model of the building was taken. Using free editing software, frames of the video were extracted. These extracted images were processed using Autodesk ReCap. The model was used for processing dimensions and having a general understanding of the overall building. In addition, the original floor plan configuration is used to extract information on the interior walls ( Figure  11). Then, the information is stored and processed on the developed code. The width of the masonry walls is equal to 1m. This ro- The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVI-M-1-2021 28th CIPA Symposium "Great Learning & Digital Emotion", 28 August-1 September 2021, Beijing, China bust width is justified by the Pombaline style structural standards. The internal pombaline walls have approximately half the width of the masonry walls. The length of the building is equal to 26.5m and the width is equal to 21m. Then, the element size for the grid is set up to be equal to 50cm. Figure 11. Original plan configuration for the case study Sobrado.
The information on elements is stored in an array, as previously described. It contains the coordinates and dimensions of each element, type of element, and its state of conservation (damaged or non-damaged). Based on this information, the labeled floor plan is generated. Figure 12 displays the resulting labeled plan for the 'Sobrado' case study. The subdivision schema can be applied after the labeled floor plan for the original project is generated. Although this process only considered the subdivision schema, it can be later integrated to spatial and structural requirements. A user-friendly interface allows the user to select spaces on the grid by drawing rectangles. The code automatically places the interior walls, by applying rules 2.1 or 2.2 to each selected space. The interior walls generated are labeled according to the label in Figure 7 (rule 1.3).
A refinement of the grid is applied, considering the element size equal to 25cm. The new mesh size is applied to achieve thinner non-structural walls dividing the spaces. For this work, the  proposed subdivision considered the ground floor as public offices. Two subdivision schema are proposed: 1) considering all the original walls ( Figure 13) and 2) considering only the nondamaged walls (Figure 14). These two examples are shown to demonstrate the different possibilities of the proposed computational application. The user can run the code and select different spaces, as well as different subdivision rules. Once the user finishes selecting the spaces, the labeled floor plan for the new project is achieved.

CONCLUSIONS
This work proposes a methodology for supporting the adaptive reuse of a historical Brazilian architectural typology: the Sobrado house type. The methodology is based on the Shape Grammar formalism to define a rehabilitation strategy. In this paper, a grammar-based approach is presented to generate labeled floor plans. Two strategies are defined: labeling rules to identify elements in the plan and subdivision rules to generate internal spaces. A computational approach is developed using rhinoscript and python. It automatically generates labeled floor plans for the original configuration, using extracted information of photogrammetry techniques. In addition, defines a user-friendly interface to produce various subdivision space configuration.
Understanding the characteristics of the building can improve the identification of rehabilitation strategies. This paper focuses on generating a labeled floor plan for a case study building. However, the proposed methodology can be applied to other sobrado buildings. In addition, allows future integration with a genetic algorithm for optimizing the placement of new elements in the floor plan, considering both spatial and structural requirements. Once the overall procedure is implemented, the authors will evaluate the different solutions, accordingly to user and code requirements.